Skip to content

Commit

Permalink
Add e2e testing to wps (#634)
Browse files Browse the repository at this point in the history
  • Loading branch information
obany authored Dec 1, 2023
1 parent cbfa83d commit 1d2407c
Show file tree
Hide file tree
Showing 20 changed files with 1,462 additions and 1,574 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ how-to/integrate-with-salesforce-basic/public/js/preload.js
**/build
./public*/
updatable-packages.txt
public-github
public-github
chromedriver*
8 changes: 4 additions & 4 deletions how-to/automation-testing/register-with-home-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
"author": "[email protected]",
"license": "SEE LICENSE IN LICENSE.MD",
"devDependencies": {
"@openfin/automation-cli": "^1.1.11",
"@openfin/automation-helpers": "^1.1.11",
"@openfin/automation-native": "^1.1.11",
"@openfin/automation-cli": "^1.2.0",
"@openfin/automation-helpers": "^1.2.0",
"@openfin/automation-native": "^1.2.0",
"chai": "4.3.10",
"jasmine-pretty-html-reporter": "0.2.5",
"jest-html-reporters": "3.1.4",
"jest-html-reporters": "3.1.5",
"mochawesome": "7.1.3"
}
}
6 changes: 3 additions & 3 deletions how-to/automation-testing/register-with-home-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
"author": "[email protected]",
"license": "SEE LICENSE IN LICENSE.MD",
"devDependencies": {
"@openfin/automation-cli": "^1.1.11",
"@openfin/automation-helpers": "^1.1.11",
"@openfin/automation-native": "^1.1.11",
"@openfin/automation-cli": "^1.2.0",
"@openfin/automation-helpers": "^1.2.0",
"@openfin/automation-native": "^1.2.0",
"@types/chai": "4.3.11",
"chai": "4.3.10"
}
Expand Down
6 changes: 3 additions & 3 deletions how-to/automation-testing/register-with-store-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
"author": "[email protected]",
"license": "SEE LICENSE IN LICENSE.MD",
"devDependencies": {
"@openfin/automation-cli": "^1.1.11",
"@openfin/automation-helpers": "^1.1.11",
"@openfin/automation-native": "^1.1.11",
"@openfin/automation-cli": "^1.2.0",
"@openfin/automation-helpers": "^1.2.0",
"@openfin/automation-native": "^1.2.0",
"chai": "4.3.10"
}
}
4 changes: 2 additions & 2 deletions how-to/automation-testing/selenium/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"author": "[email protected]",
"license": "SEE LICENSE IN LICENSE.MD",
"devDependencies": {
"@openfin/automation-helpers": "^1.1.11",
"@openfin/automation-native": "^1.1.11",
"@openfin/automation-helpers": "^1.2.0",
"@openfin/automation-native": "^1.2.0",
"chai": "4.3.10",
"chromedriver": "116.0.0",
"fkill": "7.2.1",
Expand Down
14 changes: 7 additions & 7 deletions how-to/automation-testing/wdio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
"kill": "fkill -f -s OpenFin.exe OpenFinRVM.exe chromedriver.exe OpenFin OpenFinRVM chromedriver"
},
"devDependencies": {
"@openfin/automation-helpers": "^1.1.11",
"@openfin/automation-native": "^1.1.11",
"@wdio/cli": "8.23.3",
"@wdio/local-runner": "8.23.3",
"@wdio/mocha-framework": "8.23.1",
"@wdio/shared-store-service": "8.23.3",
"@wdio/spec-reporter": "8.23.1",
"@openfin/automation-helpers": "^1.2.0",
"@openfin/automation-native": "^1.2.0",
"@wdio/cli": "8.24.6",
"@wdio/local-runner": "8.24.6",
"@wdio/mocha-framework": "8.24.6",
"@wdio/shared-store-service": "8.24.6",
"@wdio/spec-reporter": "8.24.2",
"chai": "4.3.10",
"chromedriver": "116.0.0",
"fkill": "7.2.1",
Expand Down
2 changes: 1 addition & 1 deletion how-to/customize-home-templates/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"devDependencies": {
"@openfin/core": "33.77.11",
"@openfin/node-adapter": "33.77.11",
"@types/luxon": "^3.3.4",
"@types/luxon": "^3.3.6",
"@types/node-emoji": "^1.8.2",
"eslint": "8.54.0",
"eslint-config-airbnb": "19.0.4",
Expand Down
2 changes: 1 addition & 1 deletion how-to/integrate-with-ms365-basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"author": "[email protected]",
"license": "SEE LICENSE IN LICENSE.MD",
"dependencies": {
"@microsoft/microsoft-graph-types": "^2.38.0",
"@microsoft/microsoft-graph-types": "^2.40.0",
"@openfin/microsoft365": "1.0.1",
"@openfin/workspace": "16.0.6",
"@openfin/workspace-platform": "16.0.6"
Expand Down
2 changes: 1 addition & 1 deletion how-to/integrate-with-ms365/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"license": "SEE LICENSE IN LICENSE.MD",
"dependencies": {
"@finos/fdc3": "^2.0.3",
"@microsoft/microsoft-graph-types": "^2.38.0",
"@microsoft/microsoft-graph-types": "^2.40.0",
"@openfin/microsoft365": "1.0.1",
"@openfin/workspace": "16.0.6",
"@openfin/workspace-platform": "16.0.6",
Expand Down
3 changes: 2 additions & 1 deletion how-to/workspace-platform-starter/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
- Improved platform now starts correctly when no customSettings are provided in manifest
- Fixed dock shows correct workspace buttons to match those configured when restoring from saved config
- InitOptions handlers now have the calling context passed to them, so they know if they were called from `launch` or already `running`
- Added unit testing script `npm run unit-test` tests can be found in ./test folder, for more information see [How to Test Your Platform](./docs/how-to-test-your-platform-code.md)
- Added unit testing script `npm run test` tests can be found in ./test folder, for more information see [How to Test Your Platform Code](./docs/how-to-test-your-platform-code.md)
- Added e2e testing script `npm run e2e` tests can be found in ./e2e folder, for more information see [How to Test Your Platform UI](./docs/how-to-test-your-platform-ui.md)

## v15

Expand Down
1 change: 1 addition & 0 deletions how-to/workspace-platform-starter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,6 @@ The information below provides information related to configuring and using the
| [Deploy Your Platform](./docs/how-to-deploy-your-platform.md) | How can you deploy your platform? |
| [Manage Environments](./docs/how-to-manage-environments.md) | How would you support local, dev, uat, staging, pre-prod and prod environments for your platform? |
| [Testing Your Platform Code](./docs/how-to-test-your-platform-code.md) | How would you test the code for your platform? |
| [Testing Your Platform UI](./docs/how-to-test-your-platform-ui.md) | How would you test the UI for your platform? |

### Read more about [working with Workspace](https://developers.openfin.co/of-docs/docs/overview-of-workspace) on the OpenFin Website
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions how-to/workspace-platform-starter/docs/how-to-test-your-ui.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
> **_:information_source: OpenFin Workspace:_** [OpenFin Workspace](https://www.openfin.co/workspace/) is a commercial product and this repo is for evaluation purposes (See [LICENSE.MD](../LICENSE.MD)). Use of the OpenFin Container and OpenFin Workspace components is only granted pursuant to a license from OpenFin (see [manifest](../public/manifest.fin.json)). Please [**contact us**](https://www.openfin.co/workspace/poc/) if you would like to request a developer evaluation key or to discuss a production license.
[<- Back to Table Of Contents](../README.md)

# How To Test Your UI

Testing your OpenFin platform UI can be achieved using the OpenFin Automation tools.

For more information on the OpenFin automation tools see the following packages.

- [@openfin/automation-cli](https://www.npmjs.com/package/@openfin/automation-cli)
- [@openfin/automation-helpers](https://www.npmjs.com/package/@openfin/automation-helpers)

There is an npm command which will execute the included e2e tests.

```shell
npm run e2e
```

You must first make sure the local web server is serving the manifest for the application using the `npm run start` script.

The tests are executed using Jest as the test runner, the example tests are in the [../e2e](../e2e/) folder.

Example output from running the tests using the npm command:

![How to Test in Shell](./assets/e2e-test-shell.png)

[<- Back to Table Of Contents](../README.md)
5 changes: 5 additions & 0 deletions how-to/workspace-platform-starter/e2e/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
transform: {
'^.+\\.(ts|tsx)?$': ['ts-jest', { diagnostics: { ignoreCodes: ['TS151001'] } }]
}
};
24 changes: 24 additions & 0 deletions how-to/workspace-platform-starter/e2e/tests/platform.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { OpenFinProxy, OpenFinSystem, OpenFinHome, WebDriver } from "@openfin/automation-helpers";

describe("Platform", () => {
it("The runtime is ready", async () => {
const isReady = await OpenFinSystem.waitForReady(10000);
expect(isReady).toEqual(true);
});

it("The title should be set", async () => {
const title = await WebDriver.getTitle();
expect(title).toEqual("Platform Provider");
});

it("The runtime version should be set", async () => {
const fin = await OpenFinProxy.fin();
const version = await fin.System.getVersion();
expect(version).toEqual("33.116.77.11");
});

it("Can open the home window", async () => {
const isShown = await OpenFinHome.show(20000);
expect(isShown).toEqual(true);
});
});
5 changes: 5 additions & 0 deletions how-to/workspace-platform-starter/e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"compilerOptions": {
"esModuleInterop": true
}
}
3 changes: 2 additions & 1 deletion how-to/workspace-platform-starter/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ module.exports = {
verbose: true,
collectCoverage: true,
coverageReporters: ['text-summary'],
setupFilesAfterEnv: ['<rootDir>/test/setup.ts']
setupFilesAfterEnv: ['<rootDir>/test/setup.ts'],
roots: ['<rootDir>/test']
};
6 changes: 5 additions & 1 deletion how-to/workspace-platform-starter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
"eslint": "eslint . --ext .js,.mjs,.ts",
"markdownlint": "markdownlint **/*.md --ignore **/node_modules/**",
"validate": "npm run prettier && npm run eslint && npm run markdownlint",
"test": "jest --config ./jest.config.js"
"test": "jest --config ./jest.config.js",
"e2e": "of-automation http://localhost:8080/manifest.fin.json ./e2e/**/*.spec.ts --workspace 16.0.6 --testFailCount 1 --framework jest --storageFolder ./e2e/storage"
},
"author": "[email protected]",
"contributors": [
Expand All @@ -56,6 +57,9 @@
"node-emoji": "^1.11.0"
},
"devDependencies": {
"@openfin/automation-cli": "^1.2.0",
"@openfin/automation-helpers": "^1.2.0",
"@openfin/automation-native": "^1.2.0",
"@openfin/core": "33.77.11",
"@openfin/node-adapter": "33.77.11",
"@types/express": "^4.17.21",
Expand Down
Loading

0 comments on commit 1d2407c

Please sign in to comment.