w3wallets 0.2.1 → 0.2.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
@@ -32,52 +32,33 @@ The unzipped files should be stored in the `.w3wallets/<wallet-name>` directory.
32
32
 
33
33
  #### 2. Wrap your fixture `withWallets`
34
34
 
35
+ Install needed wallets into the chromium using `withWallets`.
36
+
35
37
  ```ts
38
+ // your-fixture.ts
39
+ import { withWallets } from "w3wallets";
36
40
  import { test as base } from "@playwright/test";
37
- import { withWallets } from "../src/withWallets";
38
-
39
- // Specify one or many wallets that should be installed in the browser
40
- const test = withWallets(base, "backpack", "polkadotJS");
41
41
 
42
- test("has title", async ({ page, backpack }) => {
43
- const privateKey =
44
- "4wDJd9Ds5ueTdS95ReAZGSBVkjMcNKbgZk47xcmqzpUJjCt7VoB2Cs7hqwXWRnopzXqE4mCP6BEDHCYrFttEcBw2";
45
-
46
- await backpack.onboard("Eclipse", privateKey);
42
+ export const test = withWallets(base, 'backpack', 'polkadotJS').extend<BaseFixture>({
43
+ magic: (_, use) => use(42),
47
44
  });
48
- ```
49
45
 
50
- ## Run tests
46
+ type BaseFixture = {
47
+ magic: number;
48
+ };
51
49
 
52
- To work on this project in VS Code, make sure you open the project's root directory.
53
-
54
- 0. Create the `.env` using `.env.example` as a reference.
55
- 1. Install dependencies
56
-
57
- ```sh
58
- yarn
59
- ```
60
-
61
- 2. Install Chrome browser
62
-
63
- ```sh
64
- npx playwright install chromium
50
+ export { expect } from "@playwright/test";
65
51
  ```
66
52
 
67
- 3. Download wallet extensions
53
+ #### 3. Use the installed wallets in tests
68
54
 
69
- ```sh
70
- npx w3wallets backpack polkadotJS
71
- ```
72
-
73
- 4. Start UI
74
-
75
- ```sh
76
- yarn start:ui
77
- ```
55
+ ```ts
56
+ import { test } from "./your-fixture";
78
57
 
79
- 5. Run Tests with Playwright
58
+ test("Can use wallet", async ({ page, backpack }) => {
59
+ const privateKey =
60
+ "4wDJd9Ds5ueTdS95ReAZGSBVkjMcNKbgZk47xcmqzpUJjCt7VoB2Cs7hqwXWRnopzXqE4mCP6BEDHCYrFttEcBw2";
80
61
 
81
- ```sh
82
- yarn test
62
+ await backpack.onboard("Eclipse", privateKey);
63
+ });
83
64
  ```
package/dist/index.js CHANGED
@@ -98,10 +98,10 @@ var Backpack = class extends Wallet {
98
98
  await ignoreButton.click();
99
99
  }
100
100
  async approve() {
101
- await this.page.getByText("Approve").click();
101
+ await this.page.getByText("Approve", { exact: true }).click();
102
102
  }
103
103
  async deny() {
104
- await this.page.getByText("Deny").click();
104
+ await this.page.getByText("Deny", { exact: true }).click();
105
105
  }
106
106
  };
107
107
 
package/dist/index.mjs CHANGED
@@ -64,10 +64,10 @@ var Backpack = class extends Wallet {
64
64
  await ignoreButton.click();
65
65
  }
66
66
  async approve() {
67
- await this.page.getByText("Approve").click();
67
+ await this.page.getByText("Approve", { exact: true }).click();
68
68
  }
69
69
  async deny() {
70
- await this.page.getByText("Deny").click();
70
+ await this.page.getByText("Deny", { exact: true }).click();
71
71
  }
72
72
  };
73
73
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "w3wallets",
3
3
  "description": "browser wallets for playwright",
4
- "version": "0.2.1",
4
+ "version": "0.2.2",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "homepage": "https://github.com/Maksandre/w3wallets",