Skip to content
Snippets Groups Projects
Commit 925c917e authored by David Dorchies's avatar David Dorchies
Browse files

clean: unnecessary files

Refs #618
parent 04ec120b
No related branches found
No related tags found
1 merge request!252release: version 4.18.0
Pipeline #158240 passed
import { ChainablePromiseElement } from 'webdriverio';
import Page from './page';
/**
* sub page containing specific selectors and methods for a specific page
*/
class LoginPage extends Page {
/**
* define selectors using getter methods
*/
public get inputUsername () {
return $('#username');
}
public get inputPassword () {
return $('#password');
}
public get btnSubmit () {
return $('button[type="submit"]');
}
/**
* a method to encapsule automation code to interact with the page
* e.g. to login using username and password
*/
public async login (username: string, password: string) {
await this.inputUsername.setValue(username);
await this.inputPassword.setValue(password);
await this.btnSubmit.click();
}
/**
* overwrite specific options to adapt it to page object
*/
public open () {
return super.open('login');
}
}
export default new LoginPage();
/**
* 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 open (path: string) {
return browser.url(`https://the-internet.herokuapp.com/${path}`)
}
}
import { ChainablePromiseElement } from 'webdriverio';
import Page from './page';
/**
* sub page containing specific selectors and methods for a specific page
*/
class SecurePage extends Page {
/**
* define selectors using getter methods
*/
public get flashAlert () {
return $('#flash');
}
}
export default new SecurePage();
import LoginPage from '../pageobjects/login.page';
import SecurePage from '../pageobjects/secure.page';
describe('My Login application', () => {
it('should login with valid credentials', async () => {
await LoginPage.open();
await LoginPage.login('tomsmith', 'SuperSecretPassword!');
await expect(SecurePage.flashAlert).toBeExisting();
await expect(SecurePage.flashAlert).toHaveTextContaining(
'You logged into a secure area!');
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment