Skip to content

Commit

Permalink
test: lw-12256 add tests for debugging switch
Browse files Browse the repository at this point in the history
  • Loading branch information
ljagiela committed Feb 20, 2025
1 parent 222f5ac commit 3a9a132
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 13 deletions.
10 changes: 10 additions & 0 deletions packages/e2e-tests/src/assert/consoleAssert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,15 @@ class ConsoleAssert {
const errors: ConsoleLogEntry[] = logs.filter((log) => log.level === 'error');
expect(errors).is.empty;
};

assertLogsAreCollected = async (shouldBeCollected: boolean) => {
await browser.pause(1000); // some delay to let logs populate
const logs: ConsoleLogEntry[] = await consoleManager.getLogs();
if (shouldBeCollected) {
expect(logs.length).to.be.greaterThan(10);
} else {
expect(logs).is.empty;
}
};
}
export default new ConsoleAssert();
16 changes: 10 additions & 6 deletions packages/e2e-tests/src/assert/settings/SettingsPageAssert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ class SettingsPageAssert {
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')
);
if (!popupView) {
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 @@ -101,9 +103,11 @@ class SettingsPageAssert {
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')
);
if (!popupView) {
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
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Feature: General Settings - Extended Browser View
And I click on "FAQs" setting
Then FAQ page is displayed

@LW-3058 @Mainnet @Testnet
@LW-3058 @LW-12253 @Mainnet @Testnet
Scenario Outline: Extended view - Settings - <option_name> option displayed
When I open settings from header menu
Then I see <option_name> option with proper description and toggle
Expand Down Expand Up @@ -209,6 +209,18 @@ Feature: General Settings - Extended Browser View
When I close "Custom submit API" drawer
Then "Custom submit API" is marked as disabled on Settings page

@LW-12255 @Mainnet @Testnet
Scenario Outline: Extended view - Settings - Debugging option enables verbose logging in console
Given I enable console logs collection
When I open settings from header menu
And Debugging toggle <debugging_enabled> enabled
And I navigate to NFTs extended page
Then I verify that logs <logs_collected> collected
Examples:
| debugging_enabled | logs_collected |
| is not | are not |
| is | are |

# this test should be executed as the last one in this suite
@LW-2521 @LW-9113 @Mainnet @Testnet
Scenario: Extended View - Remove wallet and confirm
Expand Down
14 changes: 13 additions & 1 deletion packages/e2e-tests/src/features/SettingsPagePopup.part2.feature
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Feature: General Settings - Popup View
Then Side drawer "Show 24-word passphrase" is displayed
And Password field is empty

@LW-3061 @Mainnet @Testnet
@LW-3061 @LW-12252 @Mainnet @Testnet
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
Expand Down Expand Up @@ -151,6 +151,18 @@ Feature: General Settings - Popup View
When I close "Custom submit API" drawer
Then "Custom submit API" is marked as disabled on Settings page

@LW-12254 @Mainnet @Testnet
Scenario Outline: Popup view - Settings - Debugging option enables verbose logging in console
Given I enable console logs collection
When I open settings from header menu
And Debugging toggle <debugging_enabled> enabled
And I navigate to NFTs popup page
Then I verify that logs <logs_collected> collected
Examples:
| debugging_enabled | logs_collected |
| is not | are not |
| is | are |

# this test should be executed as the last one in this suite
@LW-2708 @Mainnet @Testnet
Scenario: Popup View - Remove wallet and confirm
Expand Down
11 changes: 9 additions & 2 deletions packages/e2e-tests/src/pageobject/settingsExtendedPageObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import { expect } from 'chai';
import MainLoader from '../elements/MainLoader';
import MenuHeader from '../elements/menuHeader';

const toggleEnabledAttribute = 'aria-checked';

class SettingsExtendedPageObject {
clickOnAbout = async () => {
await SettingsPage.aboutLink.element.click();
Expand Down Expand Up @@ -75,11 +77,16 @@ class SettingsExtendedPageObject {
}
};

toggleAnalytics = async (isEnabled: 'true' | 'false') => {
(await SettingsPage.analyticsSwitch.getAttribute('aria-checked')) !== isEnabled &&
toggleAnalytics = async (isEnabled: boolean) => {
(await SettingsPage.analyticsSwitch.getAttribute(toggleEnabledAttribute)) !== String(isEnabled) &&
(await SettingsPage.analyticsSwitch.click());
};

toggleDebugging = async (isEnabled: boolean) => {
(await SettingsPage.debuggingSwitch.getAttribute(toggleEnabledAttribute)) !== String(isEnabled) &&
(await SettingsPage.debuggingSwitch.click());
};

// eslint-disable-next-line complexity
clickSettingsItem = async (elementName: string): Promise<void> => {
await browser.pause(500);
Expand Down
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 @@ -378,6 +378,10 @@ Then(/^I verify there are no errors in console logs$/, async () => {
await consoleAssert.assertNoErrorsInConsole();
});

Then(/^I verify that logs (are|are not) collected$/, async (logsCollected: 'are' | 'are not') => {
await consoleAssert.assertLogsAreCollected(logsCollected === 'are');
});

Then(/^I wait (\d*) milliseconds$/, async (delay: 1000) => {
await browser.pause(delay);
});
Expand Down
11 changes: 8 additions & 3 deletions packages/e2e-tests/src/steps/settingsSteps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,14 @@ Then(
}
);

When(/Analytics toggle is enabled: (true|false)/, async (isEnabled: 'true' | 'false') => {
await settingsExtendedPageObject.toggleAnalytics(isEnabled);
});
When(
/^(Analytics|Debugging) toggle (is|is not) enabled$/,
async (option: 'Analytics' | 'Debugging', isEnabled: 'is' | 'is not') => {
option === 'Analytics'
? await settingsExtendedPageObject.toggleAnalytics(isEnabled === 'is')
: await settingsExtendedPageObject.toggleDebugging(isEnabled === 'is');
}
);

Then(/^Side drawer "Show 24-word passphrase" is displayed$/, async () => {
await passphraseDrawerAssert.assertSeeDrawerTitle(
Expand Down

0 comments on commit 3a9a132

Please sign in to comment.