w3wallets 0.9.5 → 0.10.0

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/dist/index.d.mts CHANGED
@@ -70,9 +70,6 @@ declare class Metamask extends Wallet {
70
70
  switchAccount(accountName: {
71
71
  name: string;
72
72
  }): Promise<void>;
73
- switchAccount(accountAddress: {
74
- address: string;
75
- }): Promise<void>;
76
73
  importAccount(privateKey: string): Promise<void>;
77
74
  addAccount(accountName?: string): Promise<void>;
78
75
  getAccountName(): Promise<string>;
package/dist/index.d.ts CHANGED
@@ -70,9 +70,6 @@ declare class Metamask extends Wallet {
70
70
  switchAccount(accountName: {
71
71
  name: string;
72
72
  }): Promise<void>;
73
- switchAccount(accountAddress: {
74
- address: string;
75
- }): Promise<void>;
76
73
  importAccount(privateKey: string): Promise<void>;
77
74
  addAccount(accountName?: string): Promise<void>;
78
75
  getAccountName(): Promise<string>;
package/dist/index.js CHANGED
@@ -123,15 +123,14 @@ var Backpack = class extends Wallet {
123
123
  }
124
124
  await this.page.getByRole("button", { name: "I agree to the terms" }).click();
125
125
  await this.page.getByText("I already have a wallet").click();
126
- await this.page.getByText("View all").click();
127
126
  await this.page.getByText(network).click();
128
127
  await this.page.getByText("Private key").click();
129
128
  await this.page.getByPlaceholder("Private key").fill(privateKey);
130
129
  await this.page.waitForTimeout(1e3);
131
130
  await this.page.getByText("Import", { exact: true }).click();
132
131
  if (isOnboard) {
132
+ await this.page.getByRole("textbox").nth(0).fill(this.defaultPassword);
133
133
  await this.page.getByRole("textbox").nth(1).fill(this.defaultPassword);
134
- await this.page.getByRole("textbox").nth(2).fill(this.defaultPassword);
135
134
  await this.page.getByText("Next", { exact: true }).click();
136
135
  await (0, import_test.expect)(this.page.getByText("You're all good!")).toBeVisible();
137
136
  }
@@ -199,13 +198,6 @@ var PolkadotJS = class extends Wallet {
199
198
 
200
199
  // src/metamask/metamask.ts
201
200
  var import_test3 = require("@playwright/test");
202
-
203
- // tests/utils/address.ts
204
- var shortenAddress = (address) => {
205
- return `${address.slice(0, 7)}...${address.slice(-5)}`;
206
- };
207
-
208
- // src/metamask/metamask.ts
209
201
  var Metamask = class extends Wallet {
210
202
  defaultPassword = "11111111";
211
203
  async gotoOnboardPage() {
@@ -224,26 +216,22 @@ var Metamask = class extends Wallet {
224
216
  await this.page.getByTestId("create-password-confirm-input").fill(password);
225
217
  await this.page.getByTestId("create-password-terms").click();
226
218
  await this.page.getByTestId("create-password-submit").click();
227
- await this.page.getByTestId("metametrics-no-thanks").click();
219
+ await this.page.getByTestId("metametrics-i-agree").click();
228
220
  await this.page.getByTestId("onboarding-complete-done").click();
229
- await this.page.getByTestId("download-app-continue").click();
230
- await this.page.getByTestId("pin-extension-done").click();
231
221
  await this.clickTopRightCornerToCloseAllTheMarketingBullshit();
232
222
  }
223
+ // async switchAccount(accountAddress: { address: string }): Promise<void>;
233
224
  async switchAccount(accountNameOrAddress) {
234
225
  await this.page.getByTestId("account-menu-icon").click();
235
- if ("name" in accountNameOrAddress) {
236
- await this.page.locator(".multichain-account-list-item__account-name").getByRole("button", { name: accountNameOrAddress.name, exact: true }).click();
237
- } else {
238
- await this.page.getByTestId("account-list-address").filter({ hasText: shortenAddress(accountNameOrAddress.address) }).click();
239
- }
226
+ await this.page.getByText(accountNameOrAddress.name, { exact: true }).click();
240
227
  }
241
228
  async importAccount(privateKey) {
242
229
  await this.page.getByTestId("account-menu-icon").click();
243
- await this.page.getByTestId("multichain-account-menu-popover-action-button").click();
244
- await this.page.getByTestId("multichain-account-menu-popover-add-imported-account").click();
230
+ await this.page.getByTestId("account-list-add-wallet-button").click();
231
+ await this.page.getByTestId("add-wallet-modal-import-account").click();
245
232
  await this.page.locator("#private-key-box").fill(privateKey);
246
233
  await this.page.getByTestId("import-account-confirm-button").click();
234
+ await this.page.getByRole("button", { name: "Back" }).click();
247
235
  }
248
236
  async addAccount(accountName) {
249
237
  await this.page.getByTestId("account-menu-icon").click();
@@ -263,15 +251,9 @@ var Metamask = class extends Wallet {
263
251
  }
264
252
  async connectToNetwork(networkName, networkType = "Popular") {
265
253
  await this.page.getByTestId("sort-by-networks").click();
266
- await this.page.getByRole("button", { name: networkType, exact: true }).click();
254
+ await this.page.getByRole("tab", { name: networkType, exact: true }).click();
267
255
  const additionalNetwork = this.page.getByTestId("additional-network-item").getByText(networkName);
268
- try {
269
- await additionalNetwork.isEnabled({ timeout: 1e3 });
270
- await additionalNetwork.click();
271
- await this.page.getByTestId("confirmation-submit-button").click();
272
- } catch (error) {
273
- await this.page.getByText(networkName).click();
274
- }
256
+ await this.page.getByText(networkName).click();
275
257
  }
276
258
  async addCustomNetwork(settings) {
277
259
  await this.page.getByTestId("account-options-menu-button").click();
package/dist/index.mjs CHANGED
@@ -89,15 +89,14 @@ var Backpack = class extends Wallet {
89
89
  }
90
90
  await this.page.getByRole("button", { name: "I agree to the terms" }).click();
91
91
  await this.page.getByText("I already have a wallet").click();
92
- await this.page.getByText("View all").click();
93
92
  await this.page.getByText(network).click();
94
93
  await this.page.getByText("Private key").click();
95
94
  await this.page.getByPlaceholder("Private key").fill(privateKey);
96
95
  await this.page.waitForTimeout(1e3);
97
96
  await this.page.getByText("Import", { exact: true }).click();
98
97
  if (isOnboard) {
98
+ await this.page.getByRole("textbox").nth(0).fill(this.defaultPassword);
99
99
  await this.page.getByRole("textbox").nth(1).fill(this.defaultPassword);
100
- await this.page.getByRole("textbox").nth(2).fill(this.defaultPassword);
101
100
  await this.page.getByText("Next", { exact: true }).click();
102
101
  await expect(this.page.getByText("You're all good!")).toBeVisible();
103
102
  }
@@ -165,13 +164,6 @@ var PolkadotJS = class extends Wallet {
165
164
 
166
165
  // src/metamask/metamask.ts
167
166
  import { expect as expect3 } from "@playwright/test";
168
-
169
- // tests/utils/address.ts
170
- var shortenAddress = (address) => {
171
- return `${address.slice(0, 7)}...${address.slice(-5)}`;
172
- };
173
-
174
- // src/metamask/metamask.ts
175
167
  var Metamask = class extends Wallet {
176
168
  defaultPassword = "11111111";
177
169
  async gotoOnboardPage() {
@@ -190,26 +182,22 @@ var Metamask = class extends Wallet {
190
182
  await this.page.getByTestId("create-password-confirm-input").fill(password);
191
183
  await this.page.getByTestId("create-password-terms").click();
192
184
  await this.page.getByTestId("create-password-submit").click();
193
- await this.page.getByTestId("metametrics-no-thanks").click();
185
+ await this.page.getByTestId("metametrics-i-agree").click();
194
186
  await this.page.getByTestId("onboarding-complete-done").click();
195
- await this.page.getByTestId("download-app-continue").click();
196
- await this.page.getByTestId("pin-extension-done").click();
197
187
  await this.clickTopRightCornerToCloseAllTheMarketingBullshit();
198
188
  }
189
+ // async switchAccount(accountAddress: { address: string }): Promise<void>;
199
190
  async switchAccount(accountNameOrAddress) {
200
191
  await this.page.getByTestId("account-menu-icon").click();
201
- if ("name" in accountNameOrAddress) {
202
- await this.page.locator(".multichain-account-list-item__account-name").getByRole("button", { name: accountNameOrAddress.name, exact: true }).click();
203
- } else {
204
- await this.page.getByTestId("account-list-address").filter({ hasText: shortenAddress(accountNameOrAddress.address) }).click();
205
- }
192
+ await this.page.getByText(accountNameOrAddress.name, { exact: true }).click();
206
193
  }
207
194
  async importAccount(privateKey) {
208
195
  await this.page.getByTestId("account-menu-icon").click();
209
- await this.page.getByTestId("multichain-account-menu-popover-action-button").click();
210
- await this.page.getByTestId("multichain-account-menu-popover-add-imported-account").click();
196
+ await this.page.getByTestId("account-list-add-wallet-button").click();
197
+ await this.page.getByTestId("add-wallet-modal-import-account").click();
211
198
  await this.page.locator("#private-key-box").fill(privateKey);
212
199
  await this.page.getByTestId("import-account-confirm-button").click();
200
+ await this.page.getByRole("button", { name: "Back" }).click();
213
201
  }
214
202
  async addAccount(accountName) {
215
203
  await this.page.getByTestId("account-menu-icon").click();
@@ -229,15 +217,9 @@ var Metamask = class extends Wallet {
229
217
  }
230
218
  async connectToNetwork(networkName, networkType = "Popular") {
231
219
  await this.page.getByTestId("sort-by-networks").click();
232
- await this.page.getByRole("button", { name: networkType, exact: true }).click();
220
+ await this.page.getByRole("tab", { name: networkType, exact: true }).click();
233
221
  const additionalNetwork = this.page.getByTestId("additional-network-item").getByText(networkName);
234
- try {
235
- await additionalNetwork.isEnabled({ timeout: 1e3 });
236
- await additionalNetwork.click();
237
- await this.page.getByTestId("confirmation-submit-button").click();
238
- } catch (error) {
239
- await this.page.getByText(networkName).click();
240
- }
222
+ await this.page.getByText(networkName).click();
241
223
  }
242
224
  async addCustomNetwork(settings) {
243
225
  await this.page.getByTestId("account-options-menu-button").click();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "w3wallets",
3
3
  "description": "browser wallets for playwright",
4
- "version": "0.9.5",
4
+ "version": "0.10.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "homepage": "https://github.com/Maksandre/w3wallets",