File size: 1,171 Bytes
61d39e2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
## Summary

Playwright test the puter-js API in browser environment.

## Motivation

Some features of the puter-js/puter-GUI only work in the browser environment:

- file system
    - naive-cache
    - client-replica (WIP)
    - wspush

## Setup

Install dependencies:

```sh

cd ./tests/playwright

npm install

npx playwright install --with-deps

```

Initialize the client config (working directory: `./tests/playwright`):

1. `cp ../example-client-config.yaml ../client-config.yaml`
2. Edit the `client-config.yaml` to set the `auth_token`

## Run tests

### CLI

Working directory: `./tests/playwright`

```sh

# run all tests

npx playwright test



# run a test by name

# e.g: npx playwright test -g "mkdir in root directory is prohibited"

npx playwright test -g "mkdir in root directory is prohibited"



# run the tests that failed in the last test run

npx playwright test --last-failed



# open the report of the last test run in the browser

npx playwright show-report

```

### VSCode/Cursor

1. Install the "Playwright Test for VSCode" extension.
2. Go to "Testing" tab in the sidebar.
3. Click buttons to run tests.