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 19, 2025
1 parent 222f5ac commit 721d69f
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 6 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();
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 is enabled: <debugging_enabled>
And I navigate to NFTs extended page
Then I verify that logs are collected: <logs_collected>
Examples:
| debugging_enabled | logs_collected |
| false | false |
| true | true |

# 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 is enabled: <debugging_enabled>
And I navigate to NFTs popup page
Then I verify that logs are collected: <logs_collected>
Examples:
| debugging_enabled | logs_collected |
| false | false |
| true | true |

# 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
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 @@ -76,10 +78,15 @@ class SettingsExtendedPageObject {
};

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

toggleDebugging = async (isEnabled: 'true' | 'false') => {
(await SettingsPage.debuggingSwitch.getAttribute(toggleEnabledAttribute)) !== 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 collected: (true|false)$/, async (logsCollected: 'true' | 'false') => {
await consoleAssert.assertLogsAreCollected(logsCollected === 'true');
});

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 enabled: (true|false)$/,
async (option: 'Analytics' | 'Debugging', isEnabled: 'true' | 'false') => {
option === 'Analytics'
? await settingsExtendedPageObject.toggleAnalytics(isEnabled)
: await settingsExtendedPageObject.toggleDebugging(isEnabled);
}
);

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

0 comments on commit 721d69f

Please sign in to comment.