Skip to content

Commit ff0fd5a

Browse files
test: Fix Snaps E2E after settings changes (#22933)
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** A recent change to the settings pages broke a Snaps E2E test on main. This PR fixes that by adding additional steps to exit the settings menu. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Fix Snaps E2E by adding back-navigation support and updating tests to exit Settings before proceeding. > > - **E2E Page Objects**: > - `e2e/pages/Settings/SnapSettingsView.ts`: > - Add `backButton` getter using `CommonSelectorsIDs.BACK_ARROW_BUTTON`. > - Add `tapBackButton()` to tap the back arrow. > - **E2E Tests**: > - `e2e/specs/snaps/test-snap-management.spec.ts`: > - After toggling Snap enablement, navigate out of Settings via two `tapBackButton()` calls and `SettingsView.tapCloseButton()` before continuing. > - Ensure `SettingsView.tapSnaps()` is invoked where needed before selecting a Snap. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 00b8efc. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent fa0c583 commit ff0fd5a

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

e2e/pages/Settings/SnapSettingsView.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import Matchers from '../../framework/Matchers';
22
import Gestures from '../../framework/Gestures';
3+
import { CommonSelectorsIDs } from '../../selectors/Common.selectors';
34

45
class SnapSettingsView {
56
get enabledToggle(): DetoxElement {
@@ -14,6 +15,10 @@ class SnapSettingsView {
1415
return Matchers.getIdentifier('snap-settings-scrollview');
1516
}
1617

18+
get backButton(): DetoxElement {
19+
return Matchers.getElementByID(CommonSelectorsIDs.BACK_ARROW_BUTTON);
20+
}
21+
1722
async toggleEnable(): Promise<void> {
1823
await Gestures.tap(this.enabledToggle, {
1924
elemDescription: 'Snap Settings - Toggle Button',
@@ -36,6 +41,12 @@ class SnapSettingsView {
3641
elemDescription: `Snap Settings - Remove Snap`,
3742
});
3843
}
44+
45+
async tapBackButton(): Promise<void> {
46+
await Gestures.tapAtIndex(this.backButton, 0, {
47+
elemDescription: 'Snap Settings - Back Button',
48+
});
49+
}
3950
}
4051

4152
export default new SnapSettingsView();

e2e/specs/snaps/test-snap-management.spec.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ describe(FlaskBuildTests('Snap Management Tests'), () => {
4141
await SnapSettingsView.selectSnap('Dialog Example Snap');
4242
await SnapSettingsView.toggleEnable();
4343

44+
await SnapSettingsView.tapBackButton();
45+
await SnapSettingsView.tapBackButton();
46+
await SettingsView.tapCloseButton();
47+
4448
await TabBarComponent.tapBrowser();
4549

4650
await TestSnaps.tapButton('sendAlertButton');
@@ -61,10 +65,15 @@ describe(FlaskBuildTests('Snap Management Tests'), () => {
6165
},
6266
async () => {
6367
await TabBarComponent.tapSettings();
68+
await SettingsView.tapSnaps();
6469

6570
await SnapSettingsView.selectSnap('Dialog Example Snap');
6671
await SnapSettingsView.toggleEnable();
6772

73+
await SnapSettingsView.tapBackButton();
74+
await SnapSettingsView.tapBackButton();
75+
await SettingsView.tapCloseButton();
76+
6877
await TabBarComponent.tapBrowser();
6978

7079
await TestSnaps.tapButton('sendAlertButton');
@@ -86,6 +95,7 @@ describe(FlaskBuildTests('Snap Management Tests'), () => {
8695
},
8796
async () => {
8897
await TabBarComponent.tapSettings();
98+
await SettingsView.tapSnaps();
8999

90100
await SnapSettingsView.selectSnap('Dialog Example Snap');
91101
await SnapSettingsView.removeSnap();

0 commit comments

Comments
 (0)