Set up E2E workspace
Summary: To be very clear, this is not the final layout of this in any way but it already automates at least testing that the app starts up and the changelog shows. This sets up the annoyingly verbose setup for this. One of the downsides of workspaces is that we need to be able to install all dependencies at once, including the chrome-webdriver which means we need to install the full electron cache now for linting, too. Reviewed By: nikoant Differential Revision: D21204578 fbshipit-source-id: b3403ab62b799228976a651620ea360e0bb1cf99
This commit is contained in:
committed by
Facebook GitHub Bot
parent
884d64df71
commit
b24b6110fa
18
desktop/e2e/README.md
Normal file
18
desktop/e2e/README.md
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# Flipper E2E
|
||||||
|
|
||||||
|
*Work In Progress*
|
||||||
|
|
||||||
|
This is an expanding collection of end-to-end tests for Flipper.
|
||||||
|
|
||||||
|
## Running
|
||||||
|
|
||||||
|
Currently, running is only supported on MacOS and requires a built
|
||||||
|
version of Flipper:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cd flipper/desktop
|
||||||
|
$ yarn
|
||||||
|
$ yarn build --mac
|
||||||
|
$ cd e2e/
|
||||||
|
$ yarn test
|
||||||
|
```
|
||||||
12
desktop/e2e/main.ts
Normal file
12
desktop/e2e/main.ts
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*
|
||||||
|
* @format
|
||||||
|
*/
|
||||||
|
|
||||||
|
import test from './open';
|
||||||
|
|
||||||
|
test();
|
||||||
74
desktop/e2e/open.ts
Normal file
74
desktop/e2e/open.ts
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*
|
||||||
|
* @format
|
||||||
|
*/
|
||||||
|
|
||||||
|
import {Application} from 'spectron';
|
||||||
|
import assert from 'assert';
|
||||||
|
import path from 'path';
|
||||||
|
|
||||||
|
const app = new Application({
|
||||||
|
path: path.join(
|
||||||
|
__dirname,
|
||||||
|
'..',
|
||||||
|
'..',
|
||||||
|
'dist',
|
||||||
|
'mac',
|
||||||
|
'Flipper.app',
|
||||||
|
'Contents',
|
||||||
|
'MacOS',
|
||||||
|
'Flipper',
|
||||||
|
),
|
||||||
|
args: ['--no-launcher'],
|
||||||
|
});
|
||||||
|
|
||||||
|
async function testSuite(app: Application) {
|
||||||
|
await app.client.waitUntilWindowLoaded();
|
||||||
|
app.browserWindow.focus();
|
||||||
|
await app.client.waitUntilTextExists('html', 'Changelog');
|
||||||
|
await app.client.$('div[type="primary"]=Close').click();
|
||||||
|
await app.client.$('div=Manage Plugins').click();
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function test() {
|
||||||
|
return app
|
||||||
|
.start()
|
||||||
|
.then(async function () {
|
||||||
|
await app.client.waitUntilWindowLoaded();
|
||||||
|
})
|
||||||
|
.then(function () {
|
||||||
|
// Check if the window is visible
|
||||||
|
return app.browserWindow.isVisible();
|
||||||
|
})
|
||||||
|
.then(function (isVisible) {
|
||||||
|
// Verify the window is visible
|
||||||
|
assert.equal(isVisible, true);
|
||||||
|
})
|
||||||
|
.then(function () {
|
||||||
|
// Get the window's title
|
||||||
|
return app.client.getTitle();
|
||||||
|
})
|
||||||
|
.then(function (title) {
|
||||||
|
// Verify the window's title
|
||||||
|
assert.equal(title, 'Flipper');
|
||||||
|
})
|
||||||
|
.then(async function () {
|
||||||
|
await testSuite(app);
|
||||||
|
})
|
||||||
|
.then(function () {
|
||||||
|
// Stop the application
|
||||||
|
return app.stop();
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
// Log any failures
|
||||||
|
console.error('Test failed', error.message);
|
||||||
|
process.exit(1);
|
||||||
|
})
|
||||||
|
.then(function () {
|
||||||
|
console.log('Test suite succeeded.');
|
||||||
|
});
|
||||||
|
}
|
||||||
22
desktop/e2e/package.json
Normal file
22
desktop/e2e/package.json
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"name": "flipper-e2e",
|
||||||
|
"version": "0.38.0",
|
||||||
|
"private": true,
|
||||||
|
"description": "E2E test suite for Flipper",
|
||||||
|
"repository": "facebook/flipper",
|
||||||
|
"main": "./main.ts",
|
||||||
|
"license": "MIT",
|
||||||
|
"bugs": "https://github.com/facebook/flipper/issues",
|
||||||
|
"dependencies": {},
|
||||||
|
"devDependencies": {
|
||||||
|
"spectron": "^10.0.1"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "../ts-node ./main.ts"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/facebook/flipper",
|
||||||
|
"keywords": [
|
||||||
|
"Flipper"
|
||||||
|
],
|
||||||
|
"author": "Facebook, Inc"
|
||||||
|
}
|
||||||
@@ -19,7 +19,8 @@
|
|||||||
"pkg",
|
"pkg",
|
||||||
"pkg-lib",
|
"pkg-lib",
|
||||||
"static",
|
"static",
|
||||||
"plugins/*"
|
"plugins/*",
|
||||||
|
"e2e"
|
||||||
],
|
],
|
||||||
"nohoist": [
|
"nohoist": [
|
||||||
"flipper-plugin-kaios-big-allocations/firefox-client"
|
"flipper-plugin-kaios-big-allocations/firefox-client"
|
||||||
@@ -244,6 +245,7 @@
|
|||||||
"test:debug": "yarn build:pkg && node --inspect node_modules/.bin/jest --runInBand --env=jest-environment-jsdom-sixteen",
|
"test:debug": "yarn build:pkg && node --inspect node_modules/.bin/jest --runInBand --env=jest-environment-jsdom-sixteen",
|
||||||
"test-electron": "yarn build:pkg && jest --env=jest-environment-jsdom-sixteen --testPathPattern=\"electron\\.(js|ts|tsx)$\" --testEnvironment=@jest-runner/electron/environment --runner=@jest-runner/electron --no-cache",
|
"test-electron": "yarn build:pkg && jest --env=jest-environment-jsdom-sixteen --testPathPattern=\"electron\\.(js|ts|tsx)$\" --testEnvironment=@jest-runner/electron/environment --runner=@jest-runner/electron --no-cache",
|
||||||
"test-with-device": "yarn build:pkg && USE_ELECTRON_STUBS=1 jest --env=jest-environment-jsdom-sixteen --testPathPattern=\"device\\.(js|ts|tsx)$\" --detectOpenHandles --no-cache",
|
"test-with-device": "yarn build:pkg && USE_ELECTRON_STUBS=1 jest --env=jest-environment-jsdom-sixteen --testPathPattern=\"device\\.(js|ts|tsx)$\" --detectOpenHandles --no-cache",
|
||||||
|
"test-e2e": "cd e2e && yarn test",
|
||||||
"lint:tsc": "tsc --noemit",
|
"lint:tsc": "tsc --noemit",
|
||||||
"lint:eslint": "eslint . --ext .js,.ts,.tsx",
|
"lint:eslint": "eslint . --ext .js,.ts,.tsx",
|
||||||
"lint:flow": "flow check",
|
"lint:flow": "flow check",
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user