You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: browser-extension/README.md
+39-14Lines changed: 39 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -69,17 +69,42 @@ When the `textarea` gets removed from the page, the `TextareaRegistry` is notifi
69
69
## Testing
70
70
71
71
-`npm run playground` gives you a test environment where you can tinker with the popup with various test data, supports hot reload
72
-
-`npm run har:view` gives you recordings of various web pages which you can see with and without enhancement by the browser extension
73
-
74
-
### Recording new HAR files
75
-
76
-
- the har recordings live in `tests/har`, they are complete recordings of the network requests of a single page load
77
-
- you can add or change URLs in `tests/har-index.ts`
78
-
-`npx playwright codegen https://github.com/login --save-storage=playwright/.auth/gh.json` will store new auth tokens
79
-
- login manually, then close the browser
80
-
-***these cookies are very sensitive! we only run this script using a test account that has no permissions or memberships to anything, recommend you do the same!***
81
-
-`pnpm run har:record` this records new snapshots using those auth tokens (it needs args, run it with no args for docs)
82
-
- DO NOT COMMIT AND PUSH NEW OR CHANGED `har` files!
83
-
- we try to sanitize these (see `har-record.ts` for details) but there may be important PII in them
84
-
- if you need new HAR files for something, let us know and we will generate them ourselves using a dummy account
85
-
- IF YOUR PR CHANGES OR ADDS HAR FILES WE WILL CLOSE IT. Ask for HAR files and we'll be happy to generate clean ones you can test against.
72
+
-`npm run corpus:view` gives you recordings of various web pages which you can see with and without enhancement by the browser extension
73
+
74
+
### Test Corpus
75
+
76
+
We maintain a corpus of test pages in two formats for testing the browser extension:
77
+
78
+
#### HAR Corpus (Automated)
79
+
80
+
- For testing initial page loads and network requests
81
+
- HAR recordings live in `tests/corpus/har/`, complete recordings of the network requests of a single page load
82
+
- You can add or change URLs in `tests/corpus/_corpus-index.ts`
83
+
-**Recording new HAR files:**
84
+
-`npx playwright codegen https://github.com/login --save-storage=playwright/.auth/gh.json` will store new auth tokens
85
+
- login manually, then close the browser
86
+
-***these cookies are very sensitive! we only run this script using a test account that has no permissions or memberships to anything, recommend you do the same!***
87
+
-`pnpm run corpus:record:har` records new HAR files using those auth tokens (it needs args, run it with no args for docs)
88
+
- DO NOT COMMIT AND PUSH NEW OR CHANGED HAR files!
89
+
- we try to sanitize these (see `har-record.ts` for details) but there may be important PII in them
90
+
- if you need new HAR files for something, let us know and we will generate them ourselves using a dummy account
91
+
- IF YOUR PR CHANGES OR ADDS HAR FILES WE WILL CLOSE IT. Ask for HAR files and we'll be happy to generate clean ones you can test against.
92
+
93
+
#### HTML Corpus (Manual)
94
+
95
+
- For testing post-interaction states (e.g., expanded textareas, modal dialogs, dynamic content)
96
+
- HTML snapshots live in `tests/corpus/html/`, manually captured using SingleFile browser extension
97
+
- All assets are inlined in a single HTML file by SingleFile
98
+
-**Creating new HTML corpus files:**
99
+
1. Navigate to the desired page state (click buttons, expand textareas, etc.)
100
+
2. Use SingleFile browser extension to save the complete page
101
+
3. Save the `.html` file to `tests/corpus/html/` with a descriptive name
102
+
4. Add an entry to `tests/corpus/_corpus-index.ts` with `type: 'html'` and a description of the captured state
103
+
104
+
#### Viewing Corpus Files
105
+
106
+
- Run `pnpm run corpus:view` to start the test server at http://localhost:3001
107
+
- Select any corpus file to view in two modes:
108
+
-**Clean**: Original page without extension
109
+
-**Gitcasso**: Page with extension injected for testing
0 commit comments