Skip to content

Commit 07ae676

Browse files
fix e2e tests
1 parent 13c8634 commit 07ae676

File tree

6 files changed

+37
-70
lines changed

6 files changed

+37
-70
lines changed

test/e2e/page-objects/flows/sign.flow.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ export const signTypedDataV3WithSnapAccount = async (
8585
): Promise<void> => {
8686
const testDapp = new TestDapp(driver);
8787
await testDapp.check_pageIsLoaded();
88-
await testDapp.signTypedDataV3();
88+
await testDapp.signTypedDataV3Redesign();
89+
8990
if (!isSyncFlow) {
9091
await driver.switchToWindowWithTitle(WINDOW_TITLES.Dialog);
9192
await new SnapSimpleKeyringPage(driver).approveRejectSnapAccountTransaction(

test/e2e/page-objects/pages/settings/experimental-settings.ts

-8
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ class ExperimentalSettings {
1616
tag: 'h4',
1717
};
1818

19-
private readonly redesignedSignatureToggle =
20-
'[data-testid="toggle-redesigned-confirmations-container"]';
21-
2219
private readonly watchAccountToggleState =
2320
'[data-testid="watch-account-toggle"]';
2421

@@ -65,11 +62,6 @@ class ExperimentalSettings {
6562
await this.driver.clickElement(this.addAccountSnapToggle);
6663
}
6764

68-
async toggleRedesignedSignature(): Promise<void> {
69-
console.log('Toggle Redesigned Signature on experimental setting page');
70-
await this.driver.clickElement(this.redesignedSignatureToggle);
71-
}
72-
7365
async toggleWatchAccount(): Promise<void> {
7466
console.log('Toggle Watch Account on experimental setting page');
7567
await this.driver.clickElement(this.watchAccountToggle);

test/e2e/page-objects/pages/snap-simple-keyring-page.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Driver } from '../../webdriver/driver';
2-
import { WINDOW_TITLES } from '../../helpers';
2+
import { regularDelayMs, WINDOW_TITLES } from '../../helpers';
33

44
class SnapSimpleKeyringPage {
55
private readonly driver: Driver;
@@ -170,6 +170,9 @@ class SnapSimpleKeyringPage {
170170
console.log(
171171
'Approve/Reject snap account transaction on Snap Simple Keyring page',
172172
);
173+
174+
await this.driver.delay(regularDelayMs);
175+
173176
if (isSignatureRequest) {
174177
await this.driver.clickElementAndWaitForWindowToClose(
175178
this.confirmationSubmitButton,

test/e2e/page-objects/pages/test-dapp.ts

+31-49
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ class TestDapp {
2424
private readonly confirmScrollToBottomButtonRedesign =
2525
'.confirm-scroll-to-bottom__button';
2626

27-
private readonly confirmSignatureButton =
28-
'[data-testid="page-container-footer-next"]';
29-
3027
private readonly confirmSignatureButtonRedesign =
3128
'[data-testid="confirm-footer-button"]';
3229

@@ -80,11 +77,6 @@ class TestDapp {
8077

8178
private readonly personalSignResult = '#personalSignVerifyECRecoverResult';
8279

83-
private readonly personalSignSignatureRequestMessage = {
84-
text: 'personal_sign',
85-
tag: 'div',
86-
};
87-
8880
private readonly personalSignVerifyButton = '#personalSignVerify';
8981

9082
private personalSignSigUtilResultSelector =
@@ -96,11 +88,6 @@ class TestDapp {
9688

9789
private readonly signPermitResult = '#signPermitResult';
9890

99-
private readonly signPermitSignatureRequestMessage = {
100-
text: 'Permit',
101-
tag: 'p',
102-
};
103-
10491
private readonly signPermitVerifyButton = '#signPermitVerify';
10592

10693
private readonly signPermitVerifyResult = '#signPermitVerifyResult';
@@ -115,11 +102,6 @@ class TestDapp {
115102

116103
private readonly signTypedDataResult = '#signTypedDataResult';
117104

118-
private readonly signTypedDataSignatureRequestMessage = {
119-
text: 'Hi, Alice!',
120-
tag: 'div',
121-
};
122-
123105
private readonly signTypedDataV3Button = '#signTypedDataV3';
124106

125107
private readonly signTypedDataV3Result = '#signTypedDataV3Result';
@@ -704,9 +686,8 @@ class TestDapp {
704686
console.log('Sign message with personal sign');
705687
await this.clickPersonalSign();
706688
await this.driver.switchToWindowWithTitle(WINDOW_TITLES.Dialog);
707-
await this.driver.waitForSelector(this.personalSignSignatureRequestMessage);
708689
await this.driver.clickElementAndWaitForWindowToClose(
709-
this.confirmSignatureButton,
690+
this.confirmSignatureButtonRedesign,
710691
);
711692
}
712693

@@ -717,9 +698,8 @@ class TestDapp {
717698
console.log('Sign message with signPermit');
718699
await this.clickPermit();
719700
await this.driver.switchToWindowWithTitle(WINDOW_TITLES.Dialog);
720-
await this.driver.waitForSelector(this.signPermitSignatureRequestMessage);
721701
await this.driver.clickElementAndWaitForWindowToClose(
722-
this.confirmSignatureButton,
702+
this.confirmSignatureButtonRedesign,
723703
);
724704
}
725705

@@ -730,11 +710,8 @@ class TestDapp {
730710
console.log('Sign message with signTypedData');
731711
await this.clickSignTypedData();
732712
await this.driver.switchToWindowWithTitle(WINDOW_TITLES.Dialog);
733-
await this.driver.waitForSelector(
734-
this.signTypedDataSignatureRequestMessage,
735-
);
736713
await this.driver.clickElementAndWaitForWindowToClose(
737-
this.confirmSignatureButton,
714+
this.confirmSignatureButtonRedesign,
738715
);
739716
}
740717

@@ -750,39 +727,44 @@ class TestDapp {
750727
);
751728
await this.driver.clickElementSafe(this.confirmDialogScrollButton, 200);
752729
await this.driver.clickElementAndWaitForWindowToClose(
753-
this.confirmSignatureButton,
730+
this.confirmSignatureButtonRedesign,
731+
);
732+
}
733+
734+
async signTypedDataV3Redesign() {
735+
await this.clickSignTypedDatav3();
736+
await this.driver.switchToWindowWithTitle(WINDOW_TITLES.Dialog);
737+
await this.driver.waitForSelector(
738+
this.signTypedDataV3V4SignatureRequestMessageRedesign,
739+
);
740+
await this.driver.clickElementSafe(
741+
this.confirmScrollToBottomButtonRedesign,
742+
200,
743+
);
744+
await this.driver.clickElementAndWaitForWindowToClose(
745+
this.confirmSignatureButtonRedesign,
754746
);
755747
}
756748

757749
/**
758750
* Sign a message with the signTypedDataV4 method.
759751
*
760-
* @param confirmationRedesign - Indicates whether the redesigned signature confirmation flow is used. Defaults to false.
761752
*/
762-
async signTypedDataV4(confirmationRedesign: boolean = false) {
753+
async signTypedDataV4() {
763754
console.log('Sign message with signTypedDataV4');
764755
await this.clickSignTypedDatav4();
765756
await this.driver.switchToWindowWithTitle(WINDOW_TITLES.Dialog);
766-
if (confirmationRedesign) {
767-
await this.driver.waitForSelector(
768-
this.signTypedDataV3V4SignatureRequestMessageRedesign,
769-
);
770-
await this.driver.clickElementSafe(
771-
this.confirmScrollToBottomButtonRedesign,
772-
200,
773-
);
774-
await this.driver.clickElementAndWaitForWindowToClose(
775-
this.confirmSignatureButtonRedesign,
776-
);
777-
} else {
778-
await this.driver.waitForSelector(
779-
this.signTypedDataV3V4SignatureRequestMessage,
780-
);
781-
await this.driver.clickElementSafe(this.confirmDialogScrollButton, 200);
782-
await this.driver.clickElementAndWaitForWindowToClose(
783-
this.confirmSignatureButton,
784-
);
785-
}
757+
758+
await this.driver.waitForSelector(
759+
this.signTypedDataV3V4SignatureRequestMessageRedesign,
760+
);
761+
await this.driver.clickElementSafe(
762+
this.confirmScrollToBottomButtonRedesign,
763+
200,
764+
);
765+
await this.driver.clickElementAndWaitForWindowToClose(
766+
this.confirmSignatureButtonRedesign,
767+
);
786768
}
787769

788770
async pasteIntoEip747ContractAddressInput() {

test/e2e/tests/account/snap-account-signatures-and-disconnects.spec.ts

-10
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,6 @@ describe('Snap Account Signatures and Disconnects @no-mmi', function (this: Suit
3535
const headerNavbar = new HeaderNavbar(driver);
3636
await headerNavbar.check_accountLabel('SSK Account');
3737

38-
// Navigate to experimental settings and disable redesigned signature.
39-
await headerNavbar.openSettingsPage();
40-
const settingsPage = new SettingsPage(driver);
41-
await settingsPage.check_pageIsLoaded();
42-
await settingsPage.goToExperimentalSettings();
43-
44-
const experimentalSettings = new ExperimentalSettings(driver);
45-
await experimentalSettings.check_pageIsLoaded();
46-
await experimentalSettings.toggleRedesignedSignature();
47-
4838
// Open the Test Dapp and connect
4939
const testDapp = new TestDapp(driver);
5040
await testDapp.openTestDappPage();

test/e2e/tests/account/snap-account-signatures.spec.ts

-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ describe('Snap Account Signatures @no-mmi', function (this: Suite) {
5656

5757
const experimentalSettings = new ExperimentalSettings(driver);
5858
await experimentalSettings.check_pageIsLoaded();
59-
await experimentalSettings.toggleRedesignedSignature();
6059

6160
// Connect the SSK account
6261
const testDapp = new TestDapp(driver);

0 commit comments

Comments
 (0)