Skip to content
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

test(pom): cross-page chaining of page objects #27155

Open
wants to merge 6 commits into
base: develop
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
fix simple-send tst
  • Loading branch information
dbrans committed Sep 15, 2024
commit e6f94129cbf704332ea384c5e3f7d3a424342109
3 changes: 1 addition & 2 deletions test/e2e/page-objects/flows/login.flow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ export const loginWithBalanceValidation = async (
expectedBalance: string = DEFAULT_GANACHE_ETH_BALANCE_DEC,
): Promise<HomePage> => {
console.log('Navigate to unlock page and try to login with pasword');
const app = await getApp(driver);
const loginPage = await app.getLoginPage();
const loginPage = await getApp(driver).getLoginPage();
const homePage = await loginPage.login(password);
await homePage.check_expectedBalanceIsDisplayed(expectedBalance);
return homePage;
Expand Down
1 change: 0 additions & 1 deletion test/e2e/page-objects/flows/send-transaction.flow.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import HomePage from '../pages/homepage';
import { Driver } from '../../webdriver/driver';

/**
* This function initiates the steps required to send a transaction from the homepage to final confirmation.
Expand Down
3 changes: 2 additions & 1 deletion test/e2e/page-objects/pages/app.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Driver } from '../../webdriver/driver';
import { WALLET_PASSWORD } from '../../helpers';
import { BasePage } from './base-page';
import HeaderNavbar from './header-navbar';
import { SettingsPage } from './settings-page';
Expand All @@ -21,7 +22,7 @@ class App extends BasePage {
return headerNavbar.openSettings();
}

async login(password: string): Promise<HomePage> {
async login(password: string = WALLET_PASSWORD): Promise<HomePage> {
const loginPage = await this.getLoginPage();
return loginPage.login(password);
}
Expand Down
3 changes: 2 additions & 1 deletion test/e2e/page-objects/pages/login-page.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { WALLET_PASSWORD } from '../../helpers';
import HomePage from './homepage';
import { BasePage } from './base-page';

Expand Down Expand Up @@ -35,7 +36,7 @@ class LoginPage extends BasePage {
}

// user lands on homepage after logging in with password
async login(password: string): Promise<HomePage> {
async login(password: string = WALLET_PASSWORD): Promise<HomePage> {
await this.fillPassword(password);
await this.clickUnlockButton();
return new HomePage(this.driver).check_pageIsLoaded();
Expand Down
1 change: 1 addition & 0 deletions test/e2e/tests/transaction/simple-send.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ describe('Simple send eth', function (this: Suite) {
title: this.test?.fullTitle(),
},
async ({ driver }: { driver: Driver }) => {
driver.navigate();
const homePage = await loginWithBalanceValidation(driver);
await sendTransaction(
homePage,
Expand Down