test: port tests to new structure

This commit is contained in:
Jonathan Lipps
2020-11-05 11:33:52 -08:00
parent 6f6ccd85c0
commit 0205b416fc
16 changed files with 14965 additions and 16006 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
module.exports = {
require: '@babel/register',
timeout: 60 * 1000, // 1 minute timeout
};
};
+6 -5
View File
@@ -2,15 +2,16 @@
module.exports = (api) => {
api.cache(true);
return {
plugins: ["@babel/plugin-transform-runtime", "transform-class-properties"],
plugins: ['@babel/plugin-transform-runtime', 'transform-class-properties'],
presets: [
[
require('@babel/preset-env'),
'@babel/preset-env',
{
targets: { electron: require('electron/package.json').version },
useBuiltIns: 'usage'
targets: { electron: require('./inspector/node_modules/electron/package.json').version },
useBuiltIns: 'usage',
corejs: 2,
}
],
],
};
};
};
+3643 -3808
View File
File diff suppressed because it is too large Load Diff
+5 -13
View File
@@ -23,10 +23,10 @@
"main": "dist/main.js",
"scripts": {
"test": "run-s test:*",
"test:integration": "cross-env NODE_ENV=test mocha --reporter mocha-multi-reporters --reporter-options configFile=./test/mochareporters.json ./test/integration",
"test:unit": "cross-env NODE_ENV=test mocha --reporter mocha-multi-reporters --reporter-options configFile=./test/mochareporters.json ./test/unit/",
"test:lint": "eslint app/ test/",
"e2e": "cross-env NODE_ENV=test RUNNING_IN_SPECTRON=true mocha --reporter mocha-multi-reporters --reporter-options configFile=./test/mochareporters.json ./test/e2e",
"test:integration": "cd .. && npm run test:inspector:integration",
"test:unit": "cd .. && npm run test:inspector:unit",
"test:lint": "cd .. && npm run test:inspector:lint",
"e2e": "cd .. && npm run e2e:inspector",
"build": "run-s build:*",
"build:main": "cross-env NODE_ENV=production parcel build --target node --public-url . --out-dir ./dist --out-file main.js ./app/main.js",
"build:renderer": "cross-env NODE_ENV=production parcel build --no-content-hash --out-dir ./dist --target electron --public-url . ./app/renderer/index.html",
@@ -104,7 +104,6 @@
"electron": "./node_modules/.bin/electron"
},
"dependencies": {
"@babel/polyfill": "^7.4.0",
"antd": "~4.0.4",
"bluebird": "^3.5.5",
"cheerio": "^1.0.0-rc.3",
@@ -143,13 +142,9 @@
"xpath": "0.0.27"
},
"devDependencies": {
"@babel/core": "^7.4.0",
"@babel/plugin-transform-runtime": "^7.4.0",
"@babel/register": "^7.4.0",
"appium-fake-driver": "^1.0.1",
"asyncbox": "^2.5.3",
"babel-eslint": "^10.0.1",
"babel-plugin-transform-class-properties": "^6.24.1",
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"check-engines": "^1.5.0",
@@ -173,17 +168,14 @@
"jquery": "^3.3.1",
"jsdom": "^16.0.1",
"less": "^2.7.3",
"mocha": "^8.1.3",
"mocha-junit-reporter": "^1.18.0",
"mocha-multi-reporters": "^1.1.7",
"node-libs-browser": "^2.1.0",
"npm-run-all": "^4.1.5",
"parcel-bundler": "^1.10.3",
"parcel-plugin-asset-copier": "^1.0.0",
"postcss-modules": "^1.5.0",
"react-addons-test-utils": "^15.6.2",
"release": "^6.0.1",
"rimraf": "^3.0.0",
"run-s": "0.0.0",
"sinon": "^9.0.0",
"spectron": "^9.0.0"
},
-3
View File
@@ -1,3 +0,0 @@
module.exports = {
timeout: 1, // 10 minute timeout for E2E
};
+2 -3
View File
@@ -10,7 +10,7 @@ chai.use(chaiAsPromised);
const FAKE_DRIVER_PORT = 12121;
const TEST_APP = path.resolve('node_modules', 'appium-fake-driver', 'test', 'fixtures', 'app.xml');
const TEST_APP = path.resolve(__dirname, '..', '..', 'node_modules', 'appium-fake-driver', 'test', 'fixtures', 'app.xml');
const DEFAULT_CAPS = {
platformName: 'Fake',
@@ -31,7 +31,6 @@ describe('inspector window', function () {
// Navigate to session URL
client = this.app.client;
inspector = new InspectorPage(client);
await inspector.open('session');
// Set the desired capabilities
await client.waitForExist(inspector.addDesiredCapabilityButton);
@@ -90,4 +89,4 @@ describe('inspector window', function () {
recordedPanes = await client.elements(inspector.recordedActionsPane);
recordedPanes.value.length.should.equal(0);
});
});
});
+1 -1
View File
@@ -9,5 +9,5 @@ const log = logger.getLogger('E2E Test');
chai.should();
chai.use(chaiAsPromised);
before(e2eBefore({log, Application, fs}));
before(e2eBefore({appName: 'inspector', log, Application, fs}));
after(e2eAfter);
@@ -10,7 +10,7 @@ chai.use(chaiAsPromised);
const FAKE_DRIVER_PORT = 12121;
const TEST_APP = path.resolve('node_modules', 'appium-fake-driver', 'test', 'fixtures', 'app.xml');
const TEST_APP = path.resolve(__dirname, '..', '..', 'node_modules', 'appium-fake-driver', 'test', 'fixtures', 'app.xml');
const DEFAULT_CAPS = {
platformName: 'Fake',
+2439 -351
View File
File diff suppressed because it is too large Load Diff
+21 -6
View File
@@ -21,15 +21,20 @@
"homepage": "https://github.com/appium/appium-desktop",
"scripts": {
"test": "npm run test:lint && npm run test:unit && npm run test:integration",
"test:server:integration": "cd server && npm run test:integration",
"test:server:unit": "cd server && npm run test:unit",
"test:server:integration": "echo 'No server integration tests'",
"test:server:unit": "echo 'No server unit tests'",
"test:server:lint": "eslint server/app server/test",
"test:inspector:integration": "cd inspector && npm run test:integration",
"test:inspector:unit": "cd inspector && npm run test:unit",
"test:inspector:integration": "cross-env NODE_ENV=test mocha --reporter mocha-multi-reporters --reporter-options configFile=./inspector/test/mochareporters.json ./inspector/test/integration",
"test:inspector:unit": "cross-env NODE_ENV=test mocha --reporter mocha-multi-reporters --reporter-options configFile=./inspector/test/mochareporters.json ./inspector/test/unit",
"test:inspector:lint": "eslint inspector/app inspector/test",
"test:integration": "npm run test:server:integration && npm run test:inspector:integration",
"test:unit": "npm run test:server:unit && npm run test:inspector:unit",
"test:lint": "npm test:server:lint && npm run test:inspector:lint",
"test:lint": "npm run test:server:lint && npm run test:inspector:lint",
"e2e:inspector": "cross-env E2E_TIMEOUT=600000 NODE_ENV=test RUNNING_IN_SPECTRON=true mocha --reporter mocha-multi-reporters --reporter-options configFile=./inspector/test/mochareporters.json ./inspector/test/e2e",
"e2e:server": "cross-env E2E_TIMEOUT=600000 NODE_ENV=test RUNNING_IN_SPECTRON=true mocha --reporter mocha-multi-reporters --reporter-options configFile=./server/test/mochareporters.json ./server/test/e2e",
"build": "run-s build:*",
"build:server": "cd server && npm run build",
"build:inspector": "cd inspector && npm run build",
"pre-commit": "npm run test:lint",
"pre-push": "npm test",
"i18n-copy:server": "mkdirp server/assets/locales && ncp assets/locales server/assets/locales",
@@ -45,10 +50,17 @@
"pre-push": "npm run pre-push"
}
},
"dependencies": {},
"dependencies": {
"@babel/polyfill": "^7.4.0"
},
"devDependencies": {
"@babel/core": "^7.4.0",
"@babel/plugin-transform-runtime": "^7.4.0",
"@babel/preset-env": "^7.12.1",
"@babel/register": "^7.4.0",
"appium-support": "^2.49.0",
"asyncbox": "^2.6.0",
"babel-plugin-transform-class-properties": "^6.24.1",
"bluebird": "^3.7.2",
"cross-env": "^7.0.0",
"cssnano": "^4.1.10",
@@ -64,6 +76,9 @@
"eslint-plugin-shopify": "^30.0.0",
"husky": "^4.0.2",
"mkdirp": "^1.0.4",
"mocha": "^8.1.3",
"mocha-junit-reporter": "^1.18.0",
"mocha-multi-reporters": "^1.1.7",
"ncp": "^2.0.0",
"npm-run-all": "^4.1.5",
"request": "^2.88.2"
+8831 -11783
View File
File diff suppressed because it is too large Load Diff
+5 -12
View File
@@ -23,9 +23,10 @@
"main": "dist/main.js",
"scripts": {
"test": "run-s test:*",
"test:integration": "cross-env NODE_ENV=test mocha --reporter mocha-multi-reporters --reporter-options configFile=./test/mochareporters.json ./test/integration",
"test:unit": "cross-env NODE_ENV=test mocha --reporter mocha-multi-reporters --reporter-options configFile=./test/mochareporters.json ./test/unit/",
"e2e": "cross-env FORCE_NO_WRONG_FOLDER=true NODE_ENV=test RUNNING_IN_SPECTRON=true mocha --reporter mocha-multi-reporters --reporter-options configFile=./test/mochareporters.json ./test/e2e",
"test:integration": "cd .. && npm run test:server:integration",
"test:unit": "cd .. && npm run test:server:unit",
"test:lint": "cd .. && npm run test:server:lint",
"e2e": "cd .. && npm run e2e:server",
"build": "run-s build:*",
"build:main": "cross-env NODE_ENV=production parcel build --target node --public-url . --out-dir ./dist --out-file main.js ./app/main.js",
"build:renderer": "cross-env NODE_ENV=production parcel build --no-content-hash --out-dir ./dist --target electron --public-url . ./app/renderer/index.html",
@@ -105,7 +106,6 @@
"electron": "./node_modules/.bin/electron"
},
"dependencies": {
"@babel/polyfill": "^7.4.0",
"ansi-to-html": "~0.6.7",
"antd": "~4.0.4",
"appium": "^1.19.0-beta.0",
@@ -150,11 +150,7 @@
"xpath": "0.0.27"
},
"devDependencies": {
"@babel/core": "^7.4.0",
"@babel/plugin-transform-runtime": "^7.4.0",
"@babel/register": "^7.4.0",
"asyncbox": "^2.5.3",
"babel-plugin-transform-class-properties": "^6.24.1",
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"check-engines": "^1.5.0",
@@ -169,17 +165,14 @@
"jquery": "^3.3.1",
"jsdom": "^16.0.1",
"less": "^2.7.3",
"mocha": "^8.1.3",
"mocha-junit-reporter": "^1.18.0",
"mocha-multi-reporters": "^1.1.7",
"node-libs-browser": "^2.1.0",
"npm-run-all": "^4.1.5",
"parcel-bundler": "^1.10.3",
"parcel-plugin-asset-copier": "^1.0.0",
"postcss-modules": "^1.4.1",
"react-addons-test-utils": "^15.6.2",
"release": "^6.0.1",
"rimraf": "^3.0.0",
"run-s": "0.0.0",
"sinon": "^9.0.0",
"spectron": "^9.0.0"
},
-3
View File
@@ -1,3 +0,0 @@
module.exports = {
timeout: 1, // 10 minute timeout for E2E
};
+2 -8
View File
@@ -5,7 +5,6 @@ import path from 'path';
import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
import dirCompare from 'dir-compare';
import { retryInterval } from 'asyncbox';
import MainPage from './pages/main-page-object';
const platform = os.platform();
@@ -23,9 +22,8 @@ describe('application launch', function () {
main = new MainPage(client);
});
it('starts the server and opens a new session window', async function () {
it('starts the server', async function () {
// Start the server
const initialWindowCount = await client.getWindowCount();
await client.waitForExist(main.startServerButton);
await main.startServer();
@@ -34,10 +32,6 @@ describe('application launch', function () {
await B.delay(5000);
const source = await client.source();
source.value.indexOf('Welcome to Appium').should.be.above(0);
// Start a new session and confirm that it opens a new window
await main.startNewSession();
await retryInterval(15, 1000, async () => await client.getWindowCount().should.eventually.equal(initialWindowCount + 1));
});
it('check that WebDriverAgent folder is the same in /releases as it is in /node_modules (regression test for https://github.com/appium/appium-desktop/issues/417)', async function () {
@@ -56,4 +50,4 @@ describe('application launch', function () {
const res = await dirCompare.compare(resourcesWDAPath, localWDAPath);
res.distinct.should.equal(0);
});
});
});
+1 -1
View File
@@ -9,5 +9,5 @@ const log = logger.getLogger('E2E Test');
chai.should();
chai.use(chaiAsPromised);
before(e2eBefore({log, Application, fs}));
before(e2eBefore({appName: 'server', log, Application, fs}));
after(e2eAfter);
+7 -7
View File
@@ -3,21 +3,21 @@ import os from 'os';
const platform = os.platform();
export function e2eBefore () {
async function before ({log, Application, fs}) {
export function e2eBefore ({appName, log, Application, fs}) {
async function before () {
let appPath;
let args = [];
if (process.env.SPECTRON_TEST_PROD_BINARIES) {
if (platform === 'linux') {
appPath = path.join(__dirname, '..', '..', 'release', 'linux-unpacked', 'appium-desktop');
appPath = path.join(__dirname, '..', appName, 'release', 'linux-unpacked', 'appium-desktop');
} else if (platform === 'darwin') {
appPath = path.join(__dirname, '..', '..', 'release', 'mac', 'Appium.app', 'Contents', 'MacOS', 'Appium');
appPath = path.join(__dirname, '..', appName, 'release', 'mac', 'Appium.app', 'Contents', 'MacOS', 'Appium');
} else if (platform === 'win32') {
appPath = path.join(__dirname, '..', '..', 'release', 'win-ia32-unpacked', 'Appium.exe');
appPath = path.join(__dirname, '..', appName, 'release', 'win-ia32-unpacked', 'Appium.exe');
}
} else {
appPath = require('electron');
args = [path.join(__dirname, '..', '..')];
appPath = require(path.join(__dirname, '..', appName, 'node_modules', 'electron'));
args = [path.join(__dirname, '..', appName)];
}
this.timeout(process.env.E2E_TIMEOUT || 60 * 1000);