add webdriverio framework
This commit is contained in:
parent
189662b9e0
commit
14beef39c2
9 changed files with 409 additions and 2 deletions
25
test/objects/accounts.ts
Normal file
25
test/objects/accounts.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
import { $, browser } from "@wdio/globals";
|
||||
import Page from "./page.js";
|
||||
|
||||
/**
|
||||
* sub page containing specific selectors and methods for a specific page
|
||||
*/
|
||||
export class SignInPage extends Page {
|
||||
public static get serverUrlInput() {
|
||||
return $("[name=serverUrl]");
|
||||
}
|
||||
|
||||
public static async beTheCurrentPage() {
|
||||
const urlMatched =
|
||||
new URL(await browser.getUrl()).pathname === "/accounts/sign-in";
|
||||
const elementShowed = await this.serverUrlInput.isDisplayed();
|
||||
return urlMatched && elementShowed;
|
||||
}
|
||||
|
||||
/**
|
||||
* overwrite specific options to adapt it to page object
|
||||
*/
|
||||
public static async open() {
|
||||
return await super.open("accounts/sign-in");
|
||||
}
|
||||
}
|
15
test/objects/page.ts
Normal file
15
test/objects/page.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
import { browser } from "@wdio/globals";
|
||||
|
||||
/**
|
||||
* main page object containing all methods, selectors and functionality
|
||||
* that is shared across all page objects
|
||||
*/
|
||||
export default class Page {
|
||||
/**
|
||||
* Opens a sub page of the page
|
||||
* @param path path of the sub page (e.g. /path/to/page.html)
|
||||
*/
|
||||
public static open(path: string) {
|
||||
return browser.url(`/${path}`);
|
||||
}
|
||||
}
|
7
test/objects/timelines.ts
Normal file
7
test/objects/timelines.ts
Normal file
|
@ -0,0 +1,7 @@
|
|||
import Page from "./page";
|
||||
|
||||
export class IndexPage extends Page {
|
||||
public static async open(path: string) {
|
||||
return await super.open(path);
|
||||
}
|
||||
}
|
11
test/sign-in.spec.ts
Normal file
11
test/sign-in.spec.ts
Normal file
|
@ -0,0 +1,11 @@
|
|||
import { expect } from "@wdio/globals";
|
||||
import { SignInPage } from "./objects/accounts.js";
|
||||
import { IndexPage } from "./objects/timelines.js";
|
||||
|
||||
describe("The index page", () => {
|
||||
it("jumps to the sign-in page if no account signed in", async () => {
|
||||
await IndexPage.open("");
|
||||
|
||||
expect(await browser.waitUntil(SignInPage.beTheCurrentPage));
|
||||
});
|
||||
});
|
12
test/tsconfig.json
Normal file
12
test/tsconfig.json
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"extends": ["../tsconfig.super.json"],
|
||||
"compilerOptions": {
|
||||
"types": [
|
||||
"node",
|
||||
"@wdio/globals/types",
|
||||
"@wdio/mocha-framework",
|
||||
"@wdio/lighthouse-service"
|
||||
]
|
||||
},
|
||||
"include": ["./**/*.ts", "../wdio.conf.ts"]
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue