Skip to content

Commit

Permalink
test: add missing checks for settings tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ljagiela committed Feb 19, 2025
1 parent 07809a8 commit 62c2bf7
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export const SettingsPreferences = ({ popupView = false }: SettingsPreferencesPr
sendCurrencyChangeEvent={handleSendCurrencyChangeEvent}
/>
<SettingsCard>
<Title level={5} className={styles.heading5} data-testid="wallet-settings-heading">
<Title level={5} className={styles.heading5} data-testid="wallet-preferences-heading">
{t('browserView.settings.preferences.title')}
</Title>
<SettingsLink
Expand Down
39 changes: 39 additions & 0 deletions packages/e2e-tests/src/assert/settings/SettingsPageAssert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,15 @@ class SettingsPageAssert {
expect(await SettingsPage.betaProgramLink.getTitleText()).to.equal(
await t('browserView.settings.preferences.betaProgram.title')
);
expect(await SettingsPage.debuggingLink.getTitleText()).to.equal(
await t('browserView.settings.preferences.debugging.title')
);
expect(await SettingsPage.showRecoveryPhraseLink.getTitleText()).to.equal(
await t('browserView.settings.security.showPassphrase.title')
);
expect(await SettingsPage.generatePaperWallet.getTitleText()).to.equal(
await t('browserView.settings.generatePaperWallet.title')
);
// TODO: temporarily disabled due to LW-2907
// expect(await SettingsPage.passphraseVerificationLink.getTitleText()).to.equal(
// await t('browserView.settings.security.passphrasePeriodicVerification.title')
Expand Down Expand Up @@ -89,9 +95,15 @@ class SettingsPageAssert {
expect(await SettingsPage.betaProgramLink.getDescriptionText()).to.equal(
await t('browserView.settings.preferences.betaProgram.description')
);
expect(await SettingsPage.debuggingLink.getDescriptionText()).to.equal(
await t('browserView.settings.preferences.debugging.description')
);
expect(await SettingsPage.showRecoveryPhraseLink.getDescriptionText()).to.equal(
await t('browserView.settings.security.showPassphrase.description')
);
expect(await SettingsPage.generatePaperWallet.getDescriptionText()).to.equal(
await t('browserView.settings.generatePaperWallet.description')
);
// TODO: temporarily disabled due to LW-2907
// expect(await SettingsPage.passphraseVerificationLink.getDescriptionText()).to.equal(
// await t('browserView.settings.security.passphrasePeriodicVerification.description')
Expand Down Expand Up @@ -126,6 +138,7 @@ class SettingsPageAssert {

async assertSeeHeadings() {
expect(await SettingsPage.walletHeader.getText()).to.equal(await t('browserView.settings.wallet.title'));
expect(await SettingsPage.preferencesHeader.getText()).to.equal(await t('browserView.settings.preferences.title'));
expect(await SettingsPage.securityHeader.getText()).to.equal(await t('browserView.settings.security.title'));
expect(await SettingsPage.supportHeader.getText()).to.equal(await t('browserView.settings.help.support.title'));
expect(await SettingsPage.legalHeader.getText()).to.equal(await t('browserView.settings.legal.title'));
Expand Down Expand Up @@ -165,6 +178,32 @@ class SettingsPageAssert {
await SettingsPage.analyticsSwitch.waitForDisplayed();
}

async assertSeeBetaProgramSection(switchChecked: boolean) {
await SettingsPage.betaProgramLink.title.waitForDisplayed();
expect(await SettingsPage.betaProgramLink.getTitleText()).to.equal(
await t('browserView.settings.preferences.betaProgram.title')
);
await SettingsPage.betaProgramLink.description.waitForDisplayed();
expect(await SettingsPage.betaProgramLink.getDescriptionText()).to.equal(
await t('browserView.settings.preferences.betaProgram.description')
);
await SettingsPage.betaProgramSwitch.waitForDisplayed();
expect(await SettingsPage.betaProgramSwitch.getAttribute('aria-checked')).to.equal(switchChecked.toString());
}

async assertSeeDebuggingSection(switchChecked: boolean) {
await SettingsPage.debuggingLink.title.waitForDisplayed();
expect(await SettingsPage.debuggingLink.getTitleText()).to.equal(
await t('browserView.settings.preferences.debugging.title')
);
await SettingsPage.debuggingLink.description.waitForDisplayed();
expect(await SettingsPage.debuggingLink.getDescriptionText()).to.equal(
await t('browserView.settings.preferences.debugging.description')
);
await SettingsPage.debuggingSwitch.waitForDisplayed();
expect(await SettingsPage.betaProgramSwitch.getAttribute('aria-checked')).to.equal(switchChecked.toString());
}

async assertShowRecoveryPhraseIsDisplayedUnderSecuritySection() {
await SettingsPage.securitySettingsElements[0].waitForClickable();
// eslint-disable-next-line no-undef
Expand Down
15 changes: 15 additions & 0 deletions packages/e2e-tests/src/elements/settings/SettingsPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class SettingsPage extends CommonDrawerElements {
private readonly SECURITY_HEADER = '[data-testid="security-settings-heading"]';
private readonly SUPPORT_HEADER = '[data-testid="support-settings-heading"]';
private readonly LEGAL_HEADER = '[data-testid="legal-settings-heading"]';
private readonly PREFERENCES_HEADER = '[data-testid="wallet-preferences-heading"]';
private readonly MAIN_TITLE = '[data-testid="settings-page-title"]';
private readonly REMOVE_WALLET_HEADER = '[data-testid="remove-wallet-heading"]';
private readonly REMOVE_WALLET_DESCRIPTION = '[data-testid="remove-wallet-description"]';
Expand Down Expand Up @@ -39,6 +40,8 @@ class SettingsPage extends CommonDrawerElements {
private readonly CURRENCY_LINK_TEST_ID = 'settings-wallet-currency-link';
private readonly THEME_LINK_TEST_ID = 'settings-wallet-theme';
private readonly BETA_PROGRAM_LINK_TEST_ID = 'settings-beta-program-section';
private readonly DEBUGGING_LINK_TEST_ID = 'settings-logging-level-section';
private readonly DEBUGGING_SWITCH_TEST_ID = '[data-testid="settings-logging-switch"]';

get aboutLaceWidget(): typeof AboutLaceWidget {
return AboutLaceWidget;
Expand All @@ -60,6 +63,10 @@ class SettingsPage extends CommonDrawerElements {
return $(this.LEGAL_HEADER);
}

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

get removeWalletHeader(): ChainablePromiseElement<WebdriverIO.Element> {
return $(this.REMOVE_WALLET_HEADER);
}
Expand Down Expand Up @@ -109,6 +116,10 @@ class SettingsPage extends CommonDrawerElements {
return new SettingsLink(this.BETA_PROGRAM_LINK_TEST_ID);
}

get debuggingLink() {
return new SettingsLink(this.DEBUGGING_LINK_TEST_ID);
}

get customSubmitAPILink() {
return new SettingsLink(this.CUSTOM_SUBMIT_API_LINK_TEST_ID);
}
Expand Down Expand Up @@ -165,6 +176,10 @@ class SettingsPage extends CommonDrawerElements {
return $(this.BETA_PROGRAM_SWITCH_TEST_ID);
}

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

get securitySettingsElements(): ChainablePromiseArray<WebdriverIO.ElementArray> {
return $$(this.SECURITY_SETTINGS_ELEMENTS);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@ Feature: General Settings - Extended Browser View
And I click on "FAQs" setting
Then FAQ page is displayed


@LW-3058 @Mainnet @Testnet
Scenario: Extended view - Settings - Analytics option displayed
Scenario Outline: Extended view - Settings - <option_name> option displayed
When I open settings from header menu
Then I see analytics option with proper description and toggle
Then I see <option_name> option with proper description and toggle
Examples:
| option_name |
| Analytics |
| Beta Program |
| Debugging |

@LW-3869 @Mainnet @Testnet
Scenario: Extended view - Settings - Show passphrase displayed above Analytics under the Security section in the Settings page
Expand Down
11 changes: 8 additions & 3 deletions packages/e2e-tests/src/features/SettingsPagePopup.part2.feature
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,14 @@ Feature: General Settings - Popup View
And Password field is empty

@LW-3061 @Mainnet @Testnet
Scenario: Popup view - Settings - Analytics option displayed
Given I open settings from header menu
Then I see analytics option with proper description and toggle
Scenario Outline: Popup view - Settings - <option_name> option displayed
When I open settings from header menu
Then I see <option_name> option with proper description and toggle
Examples:
| option_name |
| Analytics |
| Beta Program |
| Debugging |

@LW-11315 @Mainnet @Testnet
Scenario: Popup View - Custom submit API - open drawer
Expand Down
21 changes: 18 additions & 3 deletions packages/e2e-tests/src/steps/settingsSteps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,24 @@ When(/^I click "Create a support ticket" button on Help drawer$/, async () => {
await HelpDrawer.createASupportTicketButton.click();
});

Then(/I see analytics option with proper description and toggle/, async () => {
await settingsPageExtendedAssert.assertSeeAnalyticsSection();
});
Then(
/I see (Analytics|Beta Program|Debugging) option with proper description and toggle/,
async (optionName: 'Analytics' | 'Beta Program' | 'Debugging') => {
switch (optionName) {
case 'Analytics':
await settingsPageExtendedAssert.assertSeeAnalyticsSection();
break;
case 'Beta Program':
await settingsPageExtendedAssert.assertSeeBetaProgramSection(false);
break;
case 'Debugging':
await settingsPageExtendedAssert.assertSeeDebuggingSection(false);
break;
default:
throw new Error(`Unrecognised option name: ${optionName}`);
}
}
);

When(/Analytics toggle is enabled: (true|false)/, async (isEnabled: 'true' | 'false') => {
await settingsExtendedPageObject.toggleAnalytics(isEnabled);
Expand Down

0 comments on commit 62c2bf7

Please sign in to comment.