Skip to content

Commit

Permalink
test(extension): update tests to cope with new modal
Browse files Browse the repository at this point in the history
  • Loading branch information
wklos-iohk committed May 17, 2024
1 parent 4688efb commit f7d2c26
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* eslint-disable no-undef */
import { ChainablePromiseElement } from 'webdriverio';

class MultidelegationDAppIssueModal {
private TITLE = '[data-testid="stake-modal-title"]';
private DESCRIPTION = '[data-testid="stake-modal-description"]';
private GOT_IT_BUTTON = '[data-testid="multidelegation-dapp-modal-button"]';

get title(): ChainablePromiseElement<WebdriverIO.Element> {
return $(this.TITLE);
}

get description(): ChainablePromiseElement<WebdriverIO.Element> {
return $(this.DESCRIPTION);
}

get gotItButton(): ChainablePromiseElement<WebdriverIO.Element> {
return $(this.GOT_IT_BUTTON);
}
}

export default new MultidelegationDAppIssueModal();
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Feature: Delegating funds to new pool E2E
And I navigate to Transactions extended page
Then the Received transaction is displayed with value: "5.00 tADA" and tokens count 1
And I disable showing Multidelegation beta banner
And I disable showing Multidelegation DApps issue modal
And I navigate to Staking extended page
And I open Browse pools tab
And I switch to list view on "Browse pools" tab
Expand Down
4 changes: 4 additions & 0 deletions packages/e2e-tests/src/fixture/localStorageInitializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ class LocalStorageInitializer {
await localStorageManager.setItem('analyticsStatus', '');
};

disableShowingMultidelegationDAppsIssueModal = async () => {
await localStorageManager.setItem('isMultiDelegationDAppCompatibilityModalVisible', 'false');
};

initialiseBasicLocalStorageData = async (
walletName: string,
chainName: 'Preprod' | 'Preview' | 'Mainnet'
Expand Down
7 changes: 7 additions & 0 deletions packages/e2e-tests/src/hooks/beforeTagHooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,13 @@ Before(
Before({ tags: '@Staking-NonDelegatedFunds-Extended' }, async () => {
await extendedViewWalletInitialization(TestWalletName.TAWalletNonDelegatedFunds);
await localStorageInitializer.disableShowingMultidelegationBetaBanner();
await localStorageInitializer.disableShowingMultidelegationDAppsIssueModal();
});

Before({ tags: '@Staking-NonDelegatedFunds-Popup' }, async () => {
await popupViewWalletInitialization(TestWalletName.TAWalletNonDelegatedFunds);
await localStorageInitializer.disableShowingMultidelegationBetaBanner();
await localStorageInitializer.disableShowingMultidelegationDAppsIssueModal();
});

Before(
Expand All @@ -174,6 +176,7 @@ Before({ tags: '@AdaHandle-popup' }, async () => await popupViewWalletInitializa
Before({ tags: '@Multidelegation-SwitchingPools-Extended-E2E' }, async () => {
await extendedViewWalletInitialization(TestWalletName.WalletMultidelegationSwitchPoolsE2E);
await localStorageInitializer.disableShowingMultidelegationBetaBanner();
await localStorageInitializer.disableShowingMultidelegationDAppsIssueModal();
});

Before(
Expand All @@ -189,23 +192,27 @@ Before(
Before({ tags: '@Multidelegation-DelegatedFunds-SinglePool-Popup' }, async () => {
await popupViewWalletInitialization(TestWalletName.MultidelegationDelegatedSingle);
await localStorageInitializer.disableShowingMultidelegationBetaBanner();
await localStorageInitializer.disableShowingMultidelegationDAppsIssueModal();
await localStorageInitializer.initializeShowMultiAddressDiscoveryModal(false);
});

Before({ tags: '@Multidelegation-DelegatedFunds-SinglePool-Extended' }, async () => {
await extendedViewWalletInitialization(TestWalletName.MultidelegationDelegatedSingle);
await localStorageInitializer.disableShowingMultidelegationBetaBanner();
await localStorageInitializer.disableShowingMultidelegationDAppsIssueModal();
await localStorageInitializer.initializeShowMultiAddressDiscoveryModal(false);
});

Before({ tags: '@Multidelegation-DelegatedFunds-MultiplePools-Popup' }, async () => {
await popupViewWalletInitialization(TestWalletName.MultidelegationDelegatedMulti);
await localStorageInitializer.disableShowingMultidelegationBetaBanner();
await localStorageInitializer.disableShowingMultidelegationDAppsIssueModal();
await localStorageInitializer.initializeShowMultiAddressDiscoveryModal(false);
});

Before({ tags: '@Multidelegation-DelegatedFunds-MultiplePools-Extended' }, async () => {
await extendedViewWalletInitialization(TestWalletName.MultidelegationDelegatedMulti);
await localStorageInitializer.disableShowingMultidelegationBetaBanner();
await localStorageInitializer.disableShowingMultidelegationDAppsIssueModal();
await localStorageInitializer.initializeShowMultiAddressDiscoveryModal(false);
});
4 changes: 4 additions & 0 deletions packages/e2e-tests/src/steps/commonSteps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,10 @@ Given(/^I disable showing Multidelegation persistence banner$/, async () => {
await localStorageInitializer.disableShowingMultidelegationPersistenceBanner();
});

Given(/^I disable showing Multidelegation DApps issue modal$/, async () => {
await localStorageInitializer.disableShowingMultidelegationDAppsIssueModal();
});

Given(/^I enable showing Analytics consent banner$/, async () => {
await localStorageInitializer.enableShowingAnalyticsBanner();
await browser.refresh();
Expand Down
7 changes: 7 additions & 0 deletions packages/e2e-tests/src/steps/multidelegationSteps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import MoreOptionsComponentAssert from '../assert/multidelegation/MoreOptionsCom
import { mapColumnNameStringToEnum, mapSortingOptionNameStringToEnum } from '../utils/stakePoolListContent';
import { browser } from '@wdio/globals';
import { StakePoolSortingOption } from '../enums/StakePoolSortingOption';
import MultidelegationDAppIssueModal from '../elements/staking/MultidelegationDAppIssueModal';

const validPassword = 'N_8J@bne87A';

Expand Down Expand Up @@ -584,3 +585,9 @@ Then(
);
}
);

When(/^I close the modal about issues with multidelegation and DApps$/, async () => {
if (await MultidelegationDAppIssueModal.gotItButton.isDisplayed()) {
await MultidelegationDAppIssueModal.gotItButton.click();
}
});

0 comments on commit f7d2c26

Please sign in to comment.