Skip to content

Commit

Permalink
test(e2e): add home page fixture for compose-txn page settings tests
Browse files Browse the repository at this point in the history
Most of the tests started from the home page, so adding the home page fixture seems appropriate
  • Loading branch information
No-Cash-7970 committed Oct 8, 2024
1 parent 40b0204 commit 3481093
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions src/e2e/compose_txn_settings.spec.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,32 @@
import { test as base, expect } from '@playwright/test';
import { ComposeTxnPage, HomePage } from './pageModels';

// Extend basic test by providing a "composeTxnPage" fixture.
// Extend basic test by providing a "composeTxnPage" fixture and a "homePage" fixture.
// Code adapted from https://playwright.dev/docs/pom
const test = base.extend<{ composeTxnPage: ComposeTxnPage }>({
const test = base.extend<{ composeTxnPage: ComposeTxnPage, homePage: HomePage }>({
composeTxnPage: async ({ page }, use) => {
// Set up the fixture.
const composeTxnPage = new ComposeTxnPage(page);
await composeTxnPage.goto();
// Use the fixture value in the test.
await use(composeTxnPage);
},
homePage: async ({ page }, use) => {
// Set up the fixture.
const homePage = new HomePage(page);
await homePage.goto();
// Use the fixture value in the test.
await use(homePage);
},
});

test.slow();

test.describe('Compose Transaction Settings', () => {

test('uses the default "Automatically set fee" value set in the settings', async ({ page }) => {
test('uses the default "Automatically set fee" value set in the settings',
async ({ homePage /* Adding this loads the home page */, page }) => {
// Change setting when on the home page
await (new HomePage(page)).goto();
const settingsBtn = page.getByRole('button', { name: 'Settings' });
await settingsBtn.click(); // Open settings dialog
const useSugSetting = page.getByLabel('Set fee automatically by default');
Expand Down Expand Up @@ -57,9 +64,8 @@ test.describe('Compose Transaction Settings', () => {
});

test('uses the default "Automatically set valid rounds" value set in the settings',
async ({ page }) => {
async ({ homePage, page }) => {
// Change setting when on the home page
await (new HomePage(page)).goto();
const settingsBtn = page.getByRole('button', { name: 'Settings' });
await settingsBtn.click(); // Open settings dialog
const useSugSetting = page.getByLabel('Set valid rounds automatically by default');
Expand Down Expand Up @@ -97,9 +103,8 @@ test.describe('Compose Transaction Settings', () => {
});

test('uses the "manager address to the sender address by default" value set in the settings',
async ({ page }) => {
async ({ homePage, page }) => {
// Change setting when on the home page
await (new HomePage(page)).goto();
const settingsBtn = page.getByRole('button', { name: 'Settings' });
await settingsBtn.click(); // Open settings dialog
const useSenderSetting = page.getByLabel(
Expand Down Expand Up @@ -139,9 +144,8 @@ test.describe('Compose Transaction Settings', () => {
});

test('uses the "freeze address to the sender address by default" value set in the settings',
async ({ page }) => {
async ({ homePage, page }) => {
// Change setting when on the home page
await (new HomePage(page)).goto();
const settingsBtn = page.getByRole('button', { name: 'Settings' });
await settingsBtn.click(); // Open settings dialog
const useSenderSetting = page.getByLabel(
Expand Down Expand Up @@ -181,9 +185,8 @@ test.describe('Compose Transaction Settings', () => {
});

test('uses the "clawback address to the sender address by default" value set in the settings',
async ({ page }) => {
async ({ homePage, page }) => {
// Change setting when on the home page
await (new HomePage(page)).goto();
const settingsBtn = page.getByRole('button', { name: 'Settings' });
await settingsBtn.click(); // Open settings dialog
const useSenderSetting = page.getByLabel(
Expand Down

0 comments on commit 3481093

Please sign in to comment.