Skip to content

Commit

Permalink
Merge pull request #3116 from zowe/fix/e2e-test-failures
Browse files Browse the repository at this point in the history
fix(e2e/tests): Resolve flakiness for end-to-end tests
  • Loading branch information
t1m0thyj authored Sep 19, 2024
2 parents da6e014 + ba5ed8e commit c4c9478
Show file tree
Hide file tree
Showing 7 changed files with 147 additions and 501 deletions.
11 changes: 11 additions & 0 deletions packages/zowe-explorer/__tests__/__e2e__/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

This folder contains a set of end-to-end test scenarios that require a test system to run. End-to-end testing ensures that the intended behavior is met without stubbing or mocking chunks of code for a given scenario.

## Creating a Zowe team config

Create a Zowe team config using Zowe CLI or Zowe Explorer and copy it into its own directory for running the end-to-end tests.
Ensure that the config has the following:

- z/OSMF, TSO and SSH profiles are defined in `defaults` section of the config
- All 3 profiles should have their required properties for connecting to a remote system
- Valid TSO account number in the TSO profile properties
- Valid port for SSH in the SSH profile properties
- User and password stored securely for the profiles **in advance** OR user/password specified as properties in a base profile

**Note:** If you need to write a test that involves mocking or stubbing an object, consider writing an [integration test using Mocha](../__integration__/README.md) instead.

## Preparing your environment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,12 @@ Then("a quick pick appears to select a profile", async function () {
});
When("a user selects a profile", async function () {
await expect(this.input).toBeDefined();
let qpItems = await this.input.getQuickPicks();
const qpItems = await this.input.getQuickPicks();
await qpItems.at(0).select();
await expect(this.input.elem).toBeDisplayedInViewport();

// Issue TSO command has an extra quick pick to select from
if (this.openedCommand === "Issue TSO Command") {
qpItems = await this.input.getQuickPicks();
await qpItems.at(0).select();
}
});

Then(/a user can enter in (.*) as the command and submit it/, async function (command: string) {
if (this.openedCommand === "Issue TSO Command") {
await this.input.setText("IZUACCT");
await this.input.confirm();
}
await this.input.setText(command);
await this.input.confirm();
});
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import { TreeItem } from "wdio-vscode-service";

Then("the user should be able to save it successfully", async function () {
await this.editorForFile.save();
// Wait for the editor to remove "dirty" (unsaved) flag to verify successful save operation
await browser.waitUntil(async () => !(await this.editorForFile.isDirty()));
// Give time for the LPAR to finish handling the save
await browser.pause(3000);
// Wait for the editor to remove "dirty" (unsaved) flag to verify successful save operation
await browser.waitUntil(async () => !(await this.editorForFile.isDirty()));
await this.editorView.closeEditor(await this.editorForFile.getTitle());
});
Then("the user can right-click on the child node and add it as a favorite", async function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ Given("a user who has the jobs table view opened", async function () {
});

When("the user clicks on the Gear icon in the table view", async function () {
// clear all notifications to avoid overlapping elements
await browser.executeWorkbench((vscode) => vscode.commands.executeCommand("notifications.clearAll"));

// shift Selenium focus into webview
await this.tableView.open();
const colsBtn = await browser.$("#colsToggleBtn");
await colsBtn.waitForClickable();
Expand Down
1 change: 1 addition & 0 deletions packages/zowe-explorer/__tests__/__e2e__/wdio.conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export const config: Options.Testrunner = {
// optional VS Code settings
userSettings: {
"editor.fontSize": 14,
"extensions.ignoreRecommendations": true,
},
},
},
Expand Down
18 changes: 9 additions & 9 deletions packages/zowe-explorer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1824,19 +1824,19 @@
"@types/fs-extra": "^7.0.0",
"@types/promise-queue": "^2.2.0",
"@types/sinon": "^17.0.3",
"@wdio/cli": "^8.36.1",
"@wdio/cucumber-framework": "^8.36.1",
"@wdio/junit-reporter": "^8.36.1",
"@wdio/local-runner": "^8.36.1",
"@wdio/mocha-framework": "^8.37.0",
"@wdio/spec-reporter": "^8.36.1",
"@wdio/types": "^8.36.1",
"@wdio/cli": "^8.40.5",
"@wdio/cucumber-framework": "^8.40.5",
"@wdio/junit-reporter": "^8.40.3",
"@wdio/local-runner": "^8.40.5",
"@wdio/mocha-framework": "^8.40.3",
"@wdio/spec-reporter": "^8.40.3",
"@wdio/types": "^8.40.3",
"chai": "^4.1.2",
"chai-as-promised": "^7.1.1",
"chalk": "^2.4.1",
"eslint-plugin-zowe-explorer": "3.0.0-next-SNAPSHOT",
"expect": "^24.8.0",
"expect-webdriverio": "^4.13.0",
"expect-webdriverio": "^4.15.4",
"glob": "^7.1.6",
"jest-silent-reporter": "^0.5.0",
"log4js": "^6.4.6",
Expand All @@ -1845,7 +1845,7 @@
"ts-node": "^10.9.2",
"wdio-vscode-service": "^6.1.0",
"wdio-wait-for": "^3.0.11",
"webdriverio": "^8.36.1"
"webdriverio": "^8.40.5"
},
"dependencies": {
"@vscode/codicons": "^0.0.35",
Expand Down
Loading

0 comments on commit c4c9478

Please sign in to comment.