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
feat: wdi5 test
~ opa5 test journey
  • Loading branch information
vobu committed Sep 18, 2023
commit b69cfbc8d67b200e28b1c388739255d3d5ddd622
17 changes: 17 additions & 0 deletions webapp/test/e2e/dialog.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
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()
})

it("Should close the Hello dialog", async () => {
await AppPage.iPressTheOkButtonInTheDialog()
const dialogNotVisible = await AppPage.iShouldNotSeeTheHelloDialog()
expect(dialogNotVisible).toBeTruthy()
})
})
31 changes: 31 additions & 0 deletions webapp/test/e2e/pages/AppPage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/* eslint-disable @typescript-eslint/no-unsafe-return */
/* 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 { buttonLocator, dialogLocator, OKButtonLocator } from "./locators"

class AppPage {
async iPressTheSayHelloWithDialogButton() {
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>()
}

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

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

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

export const dialogLocator = {
selector: {
controlType: "sap.m.Dialog",
properties: {
type: "Message"
},
searchOpenDialogs: true
}
}

export const OKButtonLocator = {
selector: {
controlType: "sap.m.Button",
properties: {
text: "OK"
},
searchOpenDialogs: true
}
}
24 changes: 0 additions & 24 deletions webapp/test/e2e/sample.test.ts

This file was deleted.