Skip to content

Commit 59c96f1

Browse files
authored
HAR testing (#15)
2 parents 4d38467 + b7afcf5 commit 59c96f1

File tree

17 files changed

+8084
-99
lines changed

17 files changed

+8084
-99
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,8 @@ dist/
1616
# OS junk
1717
.DS_Store
1818
Thumbs.db
19+
20+
# playright
21+
browser-extension/playwright-report/
22+
browser-extension/playwright/
23+
browser-extension/test-results/

browser-extension/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- `npm run biome:fix` - fixes most of what `biome check` finds
1919
- `npm run compile` - typechecking
2020
- `npm test` - vitest
21+
- `npm test -- -u` updates all the snapshots
2122

2223
### Deployment
2324
- `npm run build` - build for mv3 for most browsers
@@ -42,3 +43,21 @@ Every time a `textarea` shows up on a page, on initial load or later on, it gets
4243
Those values get bundled up with the `HTMLTextAreaElement` itself into an `EnhancedTextarea`, which gets added to the `TextareaRegistry`. At some interval, draft edits will get saved by the browser extension (TODO).
4344

4445
When the `textarea` gets removed from the page, the `TextareaRegistry` is notified so that the `CommentSpot` can be marked as abandoned or submitted as appropriate (TODO).
46+
47+
## Testing
48+
49+
In `tests/har` there are various `.har` files. These are complete recordings of a single page load.
50+
51+
- `npm run har:view` and you can see the recordings, with or without our browser extension.
52+
53+
### Recording new HAR files
54+
55+
- you can add or change URLs in `tests/har-index.ts`
56+
- `npx playwright codegen https://github.com/login --save-storage=playwright/.auth/gh.json` will store new auth tokens
57+
- login manually, then close the browser
58+
- ***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!***
59+
- `npm run har:record` this records new snapshots using those auth tokens (it needs args, run it with no args for docs)
60+
- DO NOT COMMIT AND PUSH NEW OR CHANGED `har` files!
61+
- we try to sanitize these (see `har-record.ts` for details) but there may be important PII in them
62+
- if you need new HAR files for something, let us know and we will generate them ourselves using a dummy account
63+
- 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.

0 commit comments

Comments
 (0)