Skip to content

feat(testing): add wdi5 e2e scope #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 16 commits into
base: testing
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: semicolons
insert silent weep here
  • Loading branch information
vobu committed Oct 10, 2023
commit 2f171ac2a61538d5ad906b6a70eb3bac1a4ba662
20 changes: 10 additions & 10 deletions webapp/test/e2e/dialog.test.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
import AppPage from "./pages/AppPage"
import AppPage from "./pages/AppPage";

describe("Hello!", () => {
it("Should open the Hello dialog", async () => {
await AppPage.iPressTheSayHelloWithDialogButton()
const dialogVisible = await AppPage.iShouldSeeTheHelloDialog()
expect(dialogVisible).toBeTruthy()
})
await AppPage.iPressTheSayHelloWithDialogButton();
const dialogVisible = await AppPage.iShouldSeeTheHelloDialog();
expect(dialogVisible).toBeTruthy();
});

it("Should close the Hello dialog", async () => {
await AppPage.iPressTheOkButtonInTheDialog()
const dialogNotVisible = await AppPage.iShouldNotSeeTheHelloDialog()
expect(dialogNotVisible).toBeTruthy()
})
})
await AppPage.iPressTheOkButtonInTheDialog();
const dialogNotVisible = await AppPage.iShouldNotSeeTheHelloDialog();
expect(dialogNotVisible).toBeTruthy();
});
});
24 changes: 12 additions & 12 deletions webapp/test/e2e/pages/AppPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,34 @@
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import Button from "sap/m/Button"
import MessageBox from "sap/m/MessageBox"
import Button from "sap/m/Button";
import MessageBox from "sap/m/MessageBox";

import { buttonLocator, dialogLocator, OKButtonLocator } from "./locators"
import { buttonLocator, dialogLocator, OKButtonLocator } from "./locators";

class AppPage {
async iPressTheSayHelloWithDialogButton() {
const button = await browser.asControl<Button>(buttonLocator)
await button.press()
const button = await browser.asControl<Button>(buttonLocator);
await button.press();
}

async iShouldSeeTheHelloDialog(): Promise<boolean> {
const dialog = await browser.asControl<MessageBox>(dialogLocator)
return await dialog.getVisible<boolean>()
const dialog = await browser.asControl<MessageBox>(dialogLocator);
return await dialog.getVisible<boolean>();
}

async iPressTheOkButtonInTheDialog() {
await browser.asControl(OKButtonLocator).press()
await browser.asControl(OKButtonLocator).press();
}

async iShouldNotSeeTheHelloDialog(): Promise<boolean> {
const dialog = await browser.asControl<MessageBox>(dialogLocator)
const dialog = await browser.asControl<MessageBox>(dialogLocator);
// this returns "null" as the message box is not
// part of the DOM after being close, so
// no methods can be executed on the control
const visible = await dialog.getVisible()
return !visible
const visible = await dialog.getVisible();
return !visible;
}
}

export default new AppPage()
export default new AppPage();
6 changes: 3 additions & 3 deletions webapp/test/e2e/pages/locators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export const buttonLocator = {
selector: {
id: "container-ui5.typescript.helloworld---app--helloButton"
}
}
};

export const dialogLocator = {
selector: {
Expand All @@ -12,7 +12,7 @@ export const dialogLocator = {
},
searchOpenDialogs: true
}
}
};

export const OKButtonLocator = {
selector: {
Expand All @@ -22,4 +22,4 @@ export const OKButtonLocator = {
},
searchOpenDialogs: true
}
}
};
8 changes: 4 additions & 4 deletions webapp/test/e2e/wdio.conf.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { wdi5Config } from "wdio-ui5-service"
import { wdi5Config } from "wdio-ui5-service";

export const config: wdi5Config = {
// ====================
Expand Down Expand Up @@ -100,8 +100,8 @@ export const config: wdi5Config = {
process.argv.indexOf("--headless") > -1
? ["--headless"]
: process.argv.indexOf("--debug") > -1
? ["window-size=1440,800", "--auto-open-devtools-for-tabs"]
: ["window-size=1440,800"]
? ["window-size=1440,800", "--auto-open-devtools-for-tabs"]
: ["window-size=1440,800"]
},
acceptInsecureCerts: true
// If outputDir is provided WebdriverIO can capture driver session logs
Expand Down Expand Up @@ -334,4 +334,4 @@ export const config: wdi5Config = {
*/
// onReload: function(oldSessionId, newSessionId) {
// }
}
};