w3wallets 0.4.0 → 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 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 of the actions will use the following methods:
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}/options.html?onboarding=true`
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}/options.html?add-user-account=true`
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
- await this.page.getByRole("button", { name: "Import wallet" }).click();
119
- await this.page.getByRole("button", { name: network }).click();
120
- await this.page.getByRole("button", { name: "Import private key" }).click();
121
- await this.page.getByPlaceholder("Enter private key").fill(privateKey);
122
- await this.page.getByRole("button", { name: "Import" }).click();
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.getByPlaceholder("Password", { exact: true }).fill(this.defaultPassword);
125
- await this.page.getByPlaceholder("Confirm Password").fill(this.defaultPassword);
126
- await this.page.getByRole("checkbox").click();
127
- await this.page.getByRole("button", { name: "Next" }).click();
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
  };
@@ -291,7 +299,7 @@ function withWallets(test, ...config) {
291
299
  extensionPaths.push(polkadotJSPath);
292
300
  }
293
301
  if (withMetamask) {
294
- ensureWalletExtensionExists(polkadotJSPath, "metamask");
302
+ ensureWalletExtensionExists(metamaskPath, "metamask");
295
303
  extensionPaths.push(metamaskPath);
296
304
  }
297
305
  const context = await import_test4.chromium.launchPersistentContext(userDataDir, {
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}/options.html?onboarding=true`
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}/options.html?add-user-account=true`
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
- await this.page.getByRole("button", { name: "Import wallet" }).click();
85
- await this.page.getByRole("button", { name: network }).click();
86
- await this.page.getByRole("button", { name: "Import private key" }).click();
87
- await this.page.getByPlaceholder("Enter private key").fill(privateKey);
88
- await this.page.getByRole("button", { name: "Import" }).click();
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.getByPlaceholder("Password", { exact: true }).fill(this.defaultPassword);
91
- await this.page.getByPlaceholder("Confirm Password").fill(this.defaultPassword);
92
- await this.page.getByRole("checkbox").click();
93
- await this.page.getByRole("button", { name: "Next" }).click();
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
  };
@@ -257,7 +265,7 @@ function withWallets(test, ...config) {
257
265
  extensionPaths.push(polkadotJSPath);
258
266
  }
259
267
  if (withMetamask) {
260
- ensureWalletExtensionExists(polkadotJSPath, "metamask");
268
+ ensureWalletExtensionExists(metamaskPath, "metamask");
261
269
  extensionPaths.push(metamaskPath);
262
270
  }
263
271
  const context = await chromium.launchPersistentContext(userDataDir, {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "w3wallets",
3
3
  "description": "browser wallets for playwright",
4
- "version": "0.4.0",
4
+ "version": "0.4.2",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "homepage": "https://github.com/Maksandre/w3wallets",