Skip to content

Commit

Permalink
test(extension): unlock LW-4877
Browse files Browse the repository at this point in the history
  • Loading branch information
wklos-iohk committed Apr 29, 2024
1 parent 6ae83e5 commit 8d32c98
Show file tree
Hide file tree
Showing 9 changed files with 85 additions and 72 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import SwitchingStakePoolModal from '../../elements/multidelegation/SwitchingStakePoolModal';
import { expect } from 'chai';
import { t } from '../../utils/translationService';

class SwitchingPoolModalAssert {
assertSeeSwitchingPoolModal = async (shouldBeVisible: boolean) => {
await SwitchingStakePoolModal.title.waitForDisplayed({ reverse: !shouldBeVisible });
await SwitchingStakePoolModal.description.waitForDisplayed({ reverse: !shouldBeVisible });
await SwitchingStakePoolModal.cancelButton.waitForDisplayed({ reverse: !shouldBeVisible });
await SwitchingStakePoolModal.fineByMeButton.waitForDisplayed({ reverse: !shouldBeVisible });

if (shouldBeVisible) {
expect(await SwitchingStakePoolModal.title.getText()).to.equal(
await t('modals.poolsManagement.title', 'staking')
);
expect(await SwitchingStakePoolModal.description.getText()).to.equal(
await t('modals.poolsManagement.description.adjustment', 'staking')
);
expect(await SwitchingStakePoolModal.cancelButton.getText()).to.equal(
await t('modals.poolsManagement.buttons.cancel', 'staking')
);
expect(await SwitchingStakePoolModal.fineByMeButton.getText()).to.equal(
await t('modals.poolsManagement.buttons.confirm', 'staking')
);
}
};
}

export default new SwitchingPoolModalAssert();
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
@Staking-DelegatedFunds-Extended @Testnet @Mainnet @Pending
@Staking-DelegatedFunds-Extended @Testnet @Mainnet
Feature: Staking Page - Funds already delegated - Extended Browser View

Background:
Given Wallet is synced

@LW-2642 @Smoke
@LW-2642 @Smoke @Pending
Scenario: Extended View - Staking - Currently staking component
When I navigate to Staking extended page
Then I see currently staking component for stake pool: "ADA Ocean" in extended mode

@LW-2643 @Smoke
@LW-2643 @Smoke @Pending
Scenario: Extended View - Staking - Details of currently staked pool
And I navigate to Staking extended page
When I click pool name in currently staking component
Expand All @@ -18,19 +18,25 @@ Feature: Staking Page - Funds already delegated - Extended Browser View
@LW-4877
Scenario: Extended View - Stake pool details - Enter and Escape buttons support
Given I am on Staking extended page
And I input "Apex" to the search bar
And I click stake pool with name "Apex Cardano Pool"
And I open Browse pools tab
And I switch to list view on "Browse pools" tab
And I input "APEX" to the search bar
And I click on the stake pool with ticker "APEX"
Then Drawer is displayed
When I press keyboard Enter button
Then An "browserView.staking.details.switchingPoolsModal.title" text is displayed
Then I see Changing Staking Preferences modal
When I press keyboard Enter button
Then An "browserView.staking.details.confirmation.title" text is displayed
Then I see Manage delegation drawer
# When I press keyboard Enter button # TODO: update when LW-8625 is resolved
# Next line in an override for LW-8625
When I click "Confirm new portfolio" button
Then I see Manage delegation drawer Confirmation page
# When I press keyboard Escape button # TODO: update when LW-8623 is resolved
# Then Staking exit modal is displayed
# When I press keyboard Escape button
Then I see Manage delegation drawer Confirmation page
When I press keyboard Enter button
Then An "browserView.transaction.send.enterWalletPasswordToConfirmTransaction" text is displayed
When I press keyboard Escape button
Then An "browserView.staking.details.exitStakingModal.title" text is displayed
When I press keyboard Escape button
Then An "browserView.transaction.send.enterWalletPasswordToConfirmTransaction" text is displayed
Then staking password drawer is displayed
When I press keyboard Escape button
When I press keyboard Enter button
Then Drawer is not displayed
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ Feature: Analytics - Posthog - Switching pools - Popup View
And I click stake pool with name "OtherStakePool"
Then I validate latest analytics single event "staking | staking | stake pool | click"
And I see drawer with "OtherStakePool" stake pool details and a button available for staking
When I click "Stake on this pool" button on stake pool details drawer
When I click on "Stake all on this pool" button on stake pool details drawer
Then I validate latest analytics single event "staking | stake pool detail | stake on this pool | click"
When I click "Fine by me" button on "Switching pool?" modal
When I click "Fine by me" button on "Changing staking preferences?" modal
Then I validate latest analytics single event "staking | switching pool? | fine by me | click"
And I see drawer with stakepool: "OtherStakePool" confirmation screen in popup mode
And I click "Next" button on staking confirmation drawer
And I click on "Stake all on this pool" button on stake pool details drawer
Then I validate latest analytics single event "staking | manage delegation | stake pool confirmation | next | click"
When I enter correct wallet password and confirm staking
Then Switching Delegation success screen is displayed in popup mode
Expand All @@ -44,12 +44,12 @@ Feature: Analytics - Posthog - Switching pools - Popup View
And I click stake pool with name "OtherStakePool"
Then I validate latest analytics single event "staking | staking | stake pool | click"
And I see drawer with "OtherStakePool" stake pool details and a button available for staking
When I click "Stake on this pool" button on stake pool details drawer
When I click on "Stake all on this pool" button on stake pool details drawer
Then I validate latest analytics single event "staking | stake pool detail | stake on this pool | click"
When I click "Fine by me" button on "Switching pool?" modal
When I click "Fine by me" button on "Changing staking preferences?" modal
Then I validate latest analytics single event "staking | switching pool? | fine by me | click"
And I see drawer with stakepool: "OtherStakePool" confirmation screen in popup mode
And I click "Next" button on staking confirmation drawer
And I click on "Stake all on this pool" button on stake pool details drawer
Then I validate latest analytics single event "staking | manage delegation | stake pool confirmation | next | click"
When I enter correct wallet password and confirm staking
Then Switching Delegation success screen is displayed in popup mode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ Feature: Analytics - Posthog - Switching pools - Extended View
And I click stake pool with name "OtherStakePool"
Then I validate latest analytics single event "staking | staking | stake pool | click"
Then I see drawer with "OtherStakePool" stake pool details and a button available for staking
When I click "Stake on this pool" button on stake pool details drawer
When I click on "Stake all on this pool" button on stake pool details drawer
Then I validate latest analytics single event "staking | stake pool detail | stake on this pool | click"
And I click "Fine by me" button on "Switching pool?" modal
And I click "Fine by me" button on "Changing staking preferences?" modal
Then I validate latest analytics single event "staking | switching pool? | fine by me | click"
Then I see drawer with stakepool: "OtherStakePool" confirmation screen in extended mode
And I click "Next" button on staking confirmation drawer
And I click on "Stake all on this pool" button on stake pool details drawer
Then I validate latest analytics single event "staking | manage delegation | stake pool confirmation | next | click"
And I enter correct wallet password and confirm staking
Then Switching Delegation success screen is displayed in extended mode
Expand All @@ -44,12 +44,12 @@ Feature: Analytics - Posthog - Switching pools - Extended View
And I click stake pool with name "OtherStakePool"
Then I validate latest analytics single event "staking | staking | stake pool | click"
Then I see drawer with "OtherStakePool" stake pool details and a button available for staking
When I click "Stake on this pool" button on stake pool details drawer
When I click on "Stake all on this pool" button on stake pool details drawer
Then I validate latest analytics single event "staking | stake pool detail | stake on this pool | click"
And I click "Fine by me" button on "Switching pool?" modal
And I click "Fine by me" button on "Changing staking preferences?" modal
Then I validate latest analytics single event "staking | switching pool? | fine by me | click"
Then I see drawer with stakepool: "OtherStakePool" confirmation screen in extended mode
And I click "Next" button on staking confirmation drawer
And I click on "Stake all on this pool" button on stake pool details drawer
Then I validate latest analytics single event "staking | manage delegation | stake pool confirmation | next | click"
And I enter correct wallet password and confirm staking
Then Switching Delegation success screen is displayed in extended mode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ Feature: Staking Page - Switching pools - Extended Browser View - E2E
And I click stake pool with name "OtherStakePool"
Then I see drawer with "OtherStakePool" stake pool details and a button available for staking
And I save stake pool details
When I click "Stake on this pool" button on stake pool details drawer
And I click "Fine by me" button on "Switching pool?" modal
When 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
Then I see drawer with stakepool: "OtherStakePool" confirmation screen in extended mode
And I click "Next" button on staking confirmation drawer
And I click on "Stake all on this pool" button on stake pool details drawer
And I enter correct wallet password and confirm staking
Then Switching Delegation success screen is displayed in extended mode
When I click "Close" button on staking success drawer
Expand All @@ -38,9 +38,9 @@ Feature: Staking Page - Switching pools - Extended Browser View - E2E
And I click stake pool with name "-"
Then I see drawer with stake pool details without metadata and a button available for staking
And I save stake pool details
When I click "Stake on this pool" button on stake pool details drawer
And I click "Fine by me" button on "Switching pool?" modal
And I click "Next" button on staking confirmation drawer
When 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
And I click on "Stake all on this pool" button on stake pool details drawer
And I enter correct wallet password and confirm staking
Then Switching Delegation success screen is displayed in extended mode
When I click "Close" button on staking success drawer
Expand All @@ -59,9 +59,9 @@ Feature: Staking Page - Switching pools - Extended Browser View - E2E
When I input "OtherStakePool" to the search bar
And I wait for single search result
And I click stake pool with name "OtherStakePool"
And I click "Stake on this pool" button on stake pool details drawer
And I click "Fine by me" button on "Switching pool?" modal
And I click "Next" button on staking confirmation drawer
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
And I click on "Stake all on this pool" button on stake pool details drawer
And staking password drawer is displayed
When I enter correct wallet password and confirm staking
Then the staking error screen is displayed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ Feature: Staking Page - Switching pools - Popup View - E2E
And I click stake pool with name "OtherStakePool"
Then I see drawer with "OtherStakePool" stake pool details and a button available for staking
And I save stake pool details
When I click "Stake on this pool" button on stake pool details drawer
And I click "Fine by me" button on "Switching pool?" modal
When 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
Then I see drawer with stakepool: "OtherStakePool" confirmation screen in popup mode
And I click "Next" button on staking confirmation drawer
And I click on "Stake all on this pool" button on stake pool details drawer
And I enter correct wallet password and confirm staking
Then Switching Delegation success screen is displayed in popup mode
When I click "Close" button on staking success drawer
Expand All @@ -37,9 +37,9 @@ Feature: Staking Page - Switching pools - Popup View - E2E
And I click stake pool with name "-"
Then I see drawer with stake pool details without metadata and a button available for staking
When I save stake pool details
And I click "Stake on this pool" button on stake pool details drawer
And I click "Fine by me" button on "Switching pool?" modal
And I click "Next" button on staking confirmation drawer
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
And I click on "Stake all on this pool" button on stake pool details drawer
And I enter correct wallet password and confirm staking
Then Switching Delegation success screen is displayed in popup mode
When I click "Close" button on staking success drawer
Expand Down
12 changes: 11 additions & 1 deletion packages/e2e-tests/src/steps/multidelegationSteps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ import PortfolioBar from '../elements/multidelegation/PortfolioBar';
import PortfolioBarAssert from '../assert/multidelegation/PortfolioBarAssert';
import ChangingStakingPreferencesModalAssert from '../assert/multidelegation/ChangingStakingPreferencesModalAssert';
import { StakePoolListColumnName, StakePoolSortingOptionType } from '../types/staking';
import SwitchingStakePoolModal from '../elements/staking/SwitchingStakePoolModal';
import SwitchingStakePoolModal from '../elements/multidelegation/SwitchingStakePoolModal';
import MoreOptionsComponentAssert from '../assert/multidelegation/MoreOptionsComponentAssert';
import { mapColumnNameStringToEnum } from '../utils/stakePoolListContent';
import StakingExitModalAssert from '../assert/stakingExitModalAssert';
import StakingExitModal from '../elements/multidelegation/StakingExitModal';
import stakingPageAssert from '../assert/stakingPageAssert';
import SwitchingPoolModalAssert from '../assert/multidelegation/SwitchingPoolModalAssert';

const validPassword = 'N_8J@bne87A';

Expand Down Expand Up @@ -458,6 +460,10 @@ When(/^\(if applicable\) I close "Switching pools\?" modal$/, async () => {
}
});

Then(/^I (do not see|see) "Switching Pool\?" modal$/, async (shouldBeVisible: 'do not see' | 'see') => {
await SwitchingPoolModalAssert.assertSeeSwitchingPoolModal(shouldBeVisible === 'see');
});

Then(/^I see Expanded View banner$/, async () => {
await StartStakingPageAssert.assertSeeExpandedViewBanner();
});
Expand Down Expand Up @@ -557,3 +563,7 @@ Then(
}
}
);

Then(/^the staking error screen is displayed$/, async () => {
await stakingPageAssert.assertSeeStakingError();
});
32 changes: 0 additions & 32 deletions packages/e2e-tests/src/steps/stakingSteps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ import extensionUtils from '../utils/utils';
import stakingConfirmationScreenAssert from '../assert/stakingConfirmationScreenAssert';
import StakingPageObject from '../pageobject/stakingPageObject';
import StakingPage from '../elements/staking/stakingPage';
import StakePoolDetails from '../elements/staking/stakePoolDetails';
import StakingConfirmationDrawer from '../elements/staking/stakingConfirmationDrawer';
import SwitchingStakePoolModal from '../elements/staking/SwitchingStakePoolModal';

Then(
/^I see currently staking component for stake pool: "([^"]*)" in (extended|popup) mode$/,
Expand Down Expand Up @@ -63,10 +60,6 @@ Then(
}
);

Then(/^the staking error screen is displayed$/, async () => {
await stakingPageAssert.assertSeeStakingError();
});

// eslint-disable-next-line no-unused-vars,@typescript-eslint/no-unused-vars
Then(/^I see drawer with "([^"]*)" stake pool details$/, async (_stakePool: string) => {
const adacapital = extensionUtils.isMainnet() ? StakePoolsData.adacapitalMainnet : StakePoolsData.adaocean;
Expand Down Expand Up @@ -152,31 +145,6 @@ When(/^I wait for single search result$/, async () => {
await stakingPageAssert.assertSeeSingleSearchResult();
});

When(/^I click "Stake on this pool" button on stake pool details drawer$/, async () => {
await StakePoolDetails.stakeButton.waitForClickable();
await StakePoolDetails.stakeButton.click();
});

When(/^I click "Next" button on staking confirmation drawer$/, async () => {
await StakingConfirmationDrawer.nextButton.waitForClickable({ timeout: 15_000 });
await StakingConfirmationDrawer.nextButton.click();
});

When(/^I click "(Cancel|Fine by me)" button on "Switching pool\?" modal$/, async (button: 'Cancel' | 'Fine by me') => {
switch (button) {
case 'Cancel':
await SwitchingStakePoolModal.cancelButton.waitForClickable();
await SwitchingStakePoolModal.cancelButton.click();
break;
case 'Fine by me':
await SwitchingStakePoolModal.fineByMeButton.waitForClickable();
await SwitchingStakePoolModal.fineByMeButton.click();
break;
default:
throw new Error(`Unsupported button name: ${button}`);
}
});

Then(
/^"Next" button is (enabled|disabled) on "Staking confirmation" page$/,
async (isButtonEnabled: 'enabled' | 'disabled') => {
Expand Down

0 comments on commit 8d32c98

Please sign in to comment.