w3wallets 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.js +20 -12
- package/dist/index.mjs +20 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -57,7 +57,7 @@ export { expect } from "@playwright/test";
|
|
|
57
57
|
|
|
58
58
|
#### 3. Use the installed wallets in tests
|
|
59
59
|
|
|
60
|
-
Most
|
|
60
|
+
Most often, you will use the following methods:
|
|
61
61
|
|
|
62
62
|
1. `onboard`: to set up your wallet
|
|
63
63
|
2. `approve`: for operations that confirm actions
|
package/dist/index.js
CHANGED
|
@@ -62,7 +62,7 @@ var Backpack = class extends Wallet {
|
|
|
62
62
|
maxAccountId = 0;
|
|
63
63
|
async gotoOnboardPage() {
|
|
64
64
|
await this.page.goto(
|
|
65
|
-
`chrome-extension://${this.extensionId}/
|
|
65
|
+
`chrome-extension://${this.extensionId}/onboarding.html`
|
|
66
66
|
);
|
|
67
67
|
await (0, import_test.expect)(this.page.getByText("Welcome to Backpack")).toBeVisible();
|
|
68
68
|
}
|
|
@@ -75,7 +75,7 @@ var Backpack = class extends Wallet {
|
|
|
75
75
|
this.maxAccountId++;
|
|
76
76
|
this.currentAccountId = this.maxAccountId;
|
|
77
77
|
await this.page.goto(
|
|
78
|
-
`chrome-extension://${this.extensionId}/
|
|
78
|
+
`chrome-extension://${this.extensionId}/onboarding.html?add-user-account=true`
|
|
79
79
|
);
|
|
80
80
|
await this._importAccount(network, privateKey, false);
|
|
81
81
|
}
|
|
@@ -115,18 +115,26 @@ var Backpack = class extends Wallet {
|
|
|
115
115
|
return this.page.getByRole("button", { name: `A${this.currentAccountId}`, exact: true }).click();
|
|
116
116
|
}
|
|
117
117
|
async _importAccount(network, privateKey, isOnboard) {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
118
|
+
{
|
|
119
|
+
await this.page.waitForTimeout(2e3);
|
|
120
|
+
if (await this.page.getByText("You're all good!").isVisible()) {
|
|
121
|
+
await this.page.getByLabel("Go back").click();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
await this.page.getByRole("button", { name: "I agree to the terms" }).click();
|
|
125
|
+
await this.page.getByText("I already have a wallet").click();
|
|
126
|
+
await this.page.getByText("Show all networks").click();
|
|
127
|
+
await this.page.getByText(network).click();
|
|
128
|
+
await this.page.getByText("Private key").click();
|
|
129
|
+
await this.page.getByPlaceholder("Private key").fill(privateKey);
|
|
130
|
+
await this.page.waitForTimeout(1e3);
|
|
131
|
+
await this.page.getByText("Import", { exact: true }).click();
|
|
123
132
|
if (isOnboard) {
|
|
124
|
-
await this.page.
|
|
125
|
-
await this.page.
|
|
126
|
-
await this.page.
|
|
127
|
-
await this.page.
|
|
133
|
+
await this.page.getByRole("textbox").nth(1).fill(this.defaultPassword);
|
|
134
|
+
await this.page.getByRole("textbox").nth(2).fill(this.defaultPassword);
|
|
135
|
+
await this.page.getByText("Next", { exact: true }).click();
|
|
136
|
+
await (0, import_test.expect)(this.page.getByText("You're all good!")).toBeVisible();
|
|
128
137
|
}
|
|
129
|
-
await (0, import_test.expect)(this.page.getByText("You're all good!")).toBeVisible();
|
|
130
138
|
await this.page.goto(`chrome-extension://${this.extensionId}/popup.html`);
|
|
131
139
|
}
|
|
132
140
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -28,7 +28,7 @@ var Backpack = class extends Wallet {
|
|
|
28
28
|
maxAccountId = 0;
|
|
29
29
|
async gotoOnboardPage() {
|
|
30
30
|
await this.page.goto(
|
|
31
|
-
`chrome-extension://${this.extensionId}/
|
|
31
|
+
`chrome-extension://${this.extensionId}/onboarding.html`
|
|
32
32
|
);
|
|
33
33
|
await expect(this.page.getByText("Welcome to Backpack")).toBeVisible();
|
|
34
34
|
}
|
|
@@ -41,7 +41,7 @@ var Backpack = class extends Wallet {
|
|
|
41
41
|
this.maxAccountId++;
|
|
42
42
|
this.currentAccountId = this.maxAccountId;
|
|
43
43
|
await this.page.goto(
|
|
44
|
-
`chrome-extension://${this.extensionId}/
|
|
44
|
+
`chrome-extension://${this.extensionId}/onboarding.html?add-user-account=true`
|
|
45
45
|
);
|
|
46
46
|
await this._importAccount(network, privateKey, false);
|
|
47
47
|
}
|
|
@@ -81,18 +81,26 @@ var Backpack = class extends Wallet {
|
|
|
81
81
|
return this.page.getByRole("button", { name: `A${this.currentAccountId}`, exact: true }).click();
|
|
82
82
|
}
|
|
83
83
|
async _importAccount(network, privateKey, isOnboard) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
84
|
+
{
|
|
85
|
+
await this.page.waitForTimeout(2e3);
|
|
86
|
+
if (await this.page.getByText("You're all good!").isVisible()) {
|
|
87
|
+
await this.page.getByLabel("Go back").click();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
await this.page.getByRole("button", { name: "I agree to the terms" }).click();
|
|
91
|
+
await this.page.getByText("I already have a wallet").click();
|
|
92
|
+
await this.page.getByText("Show all networks").click();
|
|
93
|
+
await this.page.getByText(network).click();
|
|
94
|
+
await this.page.getByText("Private key").click();
|
|
95
|
+
await this.page.getByPlaceholder("Private key").fill(privateKey);
|
|
96
|
+
await this.page.waitForTimeout(1e3);
|
|
97
|
+
await this.page.getByText("Import", { exact: true }).click();
|
|
89
98
|
if (isOnboard) {
|
|
90
|
-
await this.page.
|
|
91
|
-
await this.page.
|
|
92
|
-
await this.page.
|
|
93
|
-
await this.page.
|
|
99
|
+
await this.page.getByRole("textbox").nth(1).fill(this.defaultPassword);
|
|
100
|
+
await this.page.getByRole("textbox").nth(2).fill(this.defaultPassword);
|
|
101
|
+
await this.page.getByText("Next", { exact: true }).click();
|
|
102
|
+
await expect(this.page.getByText("You're all good!")).toBeVisible();
|
|
94
103
|
}
|
|
95
|
-
await expect(this.page.getByText("You're all good!")).toBeVisible();
|
|
96
104
|
await this.page.goto(`chrome-extension://${this.extensionId}/popup.html`);
|
|
97
105
|
}
|
|
98
106
|
};
|