fix: e2e-tests

- re-add missing fake-plugin dev dep
- export a `PROJECT_ROOT` from the `helpers` module; use this where needed (DRY)
This commit is contained in:
Christopher Hiller
2021-05-17 14:17:49 -07:00
parent 51625af447
commit 2499b49936
4 changed files with 14 additions and 13 deletions
+1
View File
@@ -42,6 +42,7 @@
"devDependencies": {
"@appium/eslint-config-appium": "file:./packages/eslint-config-appium",
"@babel/plugin-proposal-class-properties": "^7.13.0",
"@appium/fake-plugin": "^1.0.0",
"@babel/register": "^7.13.16",
"appium-test-support": "^1.3.3",
"asyncbox": "^2.8.0",
+1 -5
View File
@@ -4,15 +4,11 @@ import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
import { tempDir, fs, mkdirp, util } from 'appium-support';
import { KNOWN_DRIVERS } from '../lib/drivers';
import findUp from 'find-up';
import { PROJECT_ROOT as cwd } from './helpers';
chai.should();
chai.use(chaiAsPromised);
// monorepo root. this cannot be hardcoded because:
// 1. we may be in 'build/test' or 'test', depending on our config
// 2. Node.js does not support `__dirname` in an ESM context & Babel doesn't fake it well
const cwd = path.dirname(findUp.sync('.git', {type: 'directory'}));
// cannot use `require.resolve()` here (w/o acrobatics) due to the ESM context.
// could also derive it from the `package.json` if we wanted
const executable = path.join(cwd, 'packages', 'appium', 'build', 'lib', 'main.js');
+8 -3
View File
@@ -1,10 +1,15 @@
import path from 'path';
import {insertAppiumPrefixes} from '../lib/utils';
import findUp from 'find-up';
const TEST_HOST = 'localhost';
const TEST_PORT = 4723;
const TEST_FAKE_APP = path.resolve(__dirname, '..', '..', '..', 'fake-driver', 'test', 'fixtures',
'app.xml');
// monorepo root. this cannot be hardcoded because:
// 1. we may be in 'build/test' or 'test', depending on our config
// 2. Node.js does not support `__dirname` in an ESM context & Babel doesn't fake it well
const PROJECT_ROOT = path.dirname(findUp.sync('.git', {type: 'directory'}));
const TEST_FAKE_APP = path.join(PROJECT_ROOT, 'packages', 'fake-driver', 'test', 'fixtures', 'app.xml');
const BASE_CAPS = {
automationName: 'Fake',
@@ -18,4 +23,4 @@ const W3C_CAPS = {
firstMatch: [{}],
};
export { TEST_FAKE_APP, TEST_HOST, TEST_PORT, BASE_CAPS, W3C_PREFIXED_CAPS, W3C_CAPS };
export { TEST_FAKE_APP, TEST_HOST, TEST_PORT, BASE_CAPS, W3C_PREFIXED_CAPS, W3C_CAPS, PROJECT_ROOT };
+4 -5
View File
@@ -8,16 +8,15 @@ import { remote as wdio } from 'webdriverio';
import axios from 'axios';
import { main as appiumServer } from '../lib/main';
import { DEFAULT_APPIUM_HOME, INSTALL_TYPE_LOCAL, DRIVER_TYPE, PLUGIN_TYPE } from '../lib/extension-config';
import { W3C_PREFIXED_CAPS, TEST_HOST, TEST_PORT } from './helpers';
import { W3C_PREFIXED_CAPS, TEST_HOST, TEST_PORT, PROJECT_ROOT } from './helpers';
import { runExtensionCommand } from '../lib/cli/extension';
import findUp from 'find-up';
chai.should();
chai.use(chaiAsPromised);
const root = path.dirname(findUp.sync('.git', {type: 'directory'}));
// TODO: update when fake-plugin pulled in to monorepo
const FAKE_PLUGIN_DIR = path.join(root, 'node_modules', '@appium', 'fake-plugin');
const FAKE_DRIVER_DIR = path.join(root, 'packages', 'fake-driver');
const FAKE_PLUGIN_DIR = path.join(PROJECT_ROOT, 'node_modules', '@appium', 'fake-plugin');
const FAKE_DRIVER_DIR = path.join(PROJECT_ROOT, 'packages', 'fake-driver');
const TEST_SERVER = `http://${TEST_HOST}:${TEST_PORT}`;
const wdOpts = {