From 956de7ebdc4dd5dd7a91a54a25cca4fca6f67ad2 Mon Sep 17 00:00:00 2001 From: wklos-iohk Date: Thu, 7 Aug 2025 10:36:26 +0200 Subject: [PATCH] test: fix multidelegation tests --- .../elements/multidelegation/MultidelegationPage.ts | 7 +++++++ .../MultiDelegationPageExtended.part1.feature | 4 ++-- .../MultiDelegationPageExtended.part2.feature | 4 ---- .../MultiDelegationPageExtended.part3.feature | 3 +++ ...onDelegatedFundsSinglePoolExtended.part2.feature | 2 ++ .../e2e-tests/src/steps/multidelegationSteps.ts | 13 +++++++++++-- 6 files changed, 25 insertions(+), 8 deletions(-) diff --git a/packages/e2e-tests/src/elements/multidelegation/MultidelegationPage.ts b/packages/e2e-tests/src/elements/multidelegation/MultidelegationPage.ts index 4e54c4ad2..1c01d9c4d 100644 --- a/packages/e2e-tests/src/elements/multidelegation/MultidelegationPage.ts +++ b/packages/e2e-tests/src/elements/multidelegation/MultidelegationPage.ts @@ -547,6 +547,13 @@ class MultidelegationPage { }); } + async waitForStakePoolGridToLoad() { + await browser.waitUntil(async () => (await this.displayedCards).length > 1, { + timeout: 30_000, + timeoutMsg: 'failed while waiting for stake pool grid to load' + }); + } + async clickManageButton() { await this.manageBtn.waitForClickable(); await this.manageBtn.click(); diff --git a/packages/e2e-tests/src/features/MultiDelegationPageExtended.part1.feature b/packages/e2e-tests/src/features/MultiDelegationPageExtended.part1.feature index ec0a3fce4..dd00212cf 100644 --- a/packages/e2e-tests/src/features/MultiDelegationPageExtended.part1.feature +++ b/packages/e2e-tests/src/features/MultiDelegationPageExtended.part1.feature @@ -37,8 +37,8 @@ Feature: Staking Page - Extended View And (if applicable) first stake pool search result has "" ticker Examples: | stake_pool_search_term | number_of_results | stake_pool_ticker | - | a Ocean | 3 | OCEAN | - | a ocean | 3 | OCEAN | + | a Capital | 2 | ADACT | + | a capital | 2 | ADACT | | ABC# | 0 | | | HUA | 2 | HUADA | | 123456 | 0 | | diff --git a/packages/e2e-tests/src/features/MultiDelegationPageExtended.part2.feature b/packages/e2e-tests/src/features/MultiDelegationPageExtended.part2.feature index 9ca74853c..392e7e05e 100644 --- a/packages/e2e-tests/src/features/MultiDelegationPageExtended.part2.feature +++ b/packages/e2e-tests/src/features/MultiDelegationPageExtended.part2.feature @@ -96,8 +96,6 @@ Feature: Staking Page - Extended View And I am on Staking extended page And I open Browse pools tab And I switch to list view on "Browse pools" tab - And I wait for stake pool list to be populated - When I scroll down 500 pixels Then stake pool list row skeleton is displayed When I wait 500 milliseconds Then stake pool list row skeleton is not displayed @@ -107,8 +105,6 @@ Feature: Staking Page - Extended View And I am on Staking extended page And I open Browse pools tab And I switch to grid view on "Browse pools" tab - When I scroll down 500 pixels - And I scroll down 500 pixels Then stake pool grid card skeleton is displayed When I wait 500 milliseconds Then stake pool grid card skeleton is not displayed diff --git a/packages/e2e-tests/src/features/MultiDelegationPageExtended.part3.feature b/packages/e2e-tests/src/features/MultiDelegationPageExtended.part3.feature index 79afc2e36..e76390077 100644 --- a/packages/e2e-tests/src/features/MultiDelegationPageExtended.part3.feature +++ b/packages/e2e-tests/src/features/MultiDelegationPageExtended.part3.feature @@ -102,6 +102,7 @@ Feature: Staking Page - Extended View Given I reset default behaviour for modal about issues with multi-delegation and DApps When I navigate to Staking extended page And I open Browse pools tab + And I wait for stake pool grid to be populated And I click on a random stake pool from the grid And I click on "Stake all on this pool" button on stake pool details drawer And I click "Add stake pool" button @@ -117,6 +118,7 @@ Feature: Staking Page - Extended View When I navigate to Staking extended page And I open Browse pools tab And I switch to list view on "Browse pools" tab + And I wait for stake pool list to be populated And I click on a random stake pool from the list And I click on "Stake all on this pool" button on stake pool details drawer And I click "Add stake pool" button @@ -131,6 +133,7 @@ Feature: Staking Page - Extended View Given I reset default behaviour for modal about issues with multi-delegation and DApps When I navigate to Staking extended page And I open Browse pools tab + And I wait for stake pool grid to be populated And I click on a random stake pool from the grid And I click on "Select pool for multi-staking" button on stake pool details drawer Then I see the modal about issues with multi-delegation and DApps diff --git a/packages/e2e-tests/src/features/MultidelegationDelegatedFundsSinglePoolExtended.part2.feature b/packages/e2e-tests/src/features/MultidelegationDelegatedFundsSinglePoolExtended.part2.feature index b3766082c..778bd7510 100644 --- a/packages/e2e-tests/src/features/MultidelegationDelegatedFundsSinglePoolExtended.part2.feature +++ b/packages/e2e-tests/src/features/MultidelegationDelegatedFundsSinglePoolExtended.part2.feature @@ -130,6 +130,7 @@ Feature: Staking Page - Delegated funds - Single pool - Extended View When I navigate to Staking extended page And I open Browse pools tab And I switch to list view on "Browse pools" tab + And I wait for stake pool list to be populated And I click on a random stake pool from the list And I click on "Stake all on this pool" button on stake pool details drawer And I click "Fine by me" button on "Changing staking preferences?" modal @@ -145,6 +146,7 @@ Feature: Staking Page - Delegated funds - Single pool - Extended View Given I reset default behaviour for modal about issues with multi-delegation and DApps When I navigate to Staking extended page And I open Browse pools tab + And I wait for stake pool grid to be populated And I click on a random stake pool from the grid And I click on "Select pool for multi-staking" button on stake pool details drawer Then I see the modal about issues with multi-delegation and DApps diff --git a/packages/e2e-tests/src/steps/multidelegationSteps.ts b/packages/e2e-tests/src/steps/multidelegationSteps.ts index 275a45d37..ea873c4f9 100644 --- a/packages/e2e-tests/src/steps/multidelegationSteps.ts +++ b/packages/e2e-tests/src/steps/multidelegationSteps.ts @@ -360,8 +360,17 @@ Given(/^I click "Expand view" on Start Staking page$/, async () => { await StartStakingPage.clickExpandedViewBannerButton(); }); -When(/^I wait for stake pool list to be populated$/, async () => { - await MultidelegationPage.waitForStakePoolListToLoad(); +When(/^I wait for stake pool (grid|list) to be populated$/, async (view: 'grid' | 'list') => { + switch (view) { + case 'grid': + await MultidelegationPage.waitForStakePoolGridToLoad(); + break; + case 'list': + await MultidelegationPage.waitForStakePoolListToLoad(); + break; + default: + throw new Error(`Unsupported stake pool display view: ${view}`); + } }); Then(