Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

Commit

Permalink
[AUD-1103] Fix probers (#37)
Browse files Browse the repository at this point in the history
* [AUD-1103] Make probers create account tolerant to network ordering

* Fix node version to 14.18

* Add test output directory

* Bump resource class
  • Loading branch information
raymondjacobson committed Nov 30, 2021
1 parent 65ce806 commit 1d9e995
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 6 deletions.
5 changes: 3 additions & 2 deletions packages/probers/.circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ jobs:
coverage:
working_directory: ~/
docker:
- image: circleci/node:latest-browsers
- image: circleci/node:14.18-browsers
resource_class: large
steps:
- attach_workspace:
at: ./
Expand Down Expand Up @@ -53,7 +54,7 @@ jobs:
pings:
working_directory: ~/probers
docker:
- image: circleci/node:latest-browsers
- image: circleci/node:14.18-browsers
steps:
- checkout

Expand Down
2 changes: 1 addition & 1 deletion packages/probers/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
node_modules
.DS_Store
**.account-credentials.json
test_output
test_output/**.png
6 changes: 5 additions & 1 deletion packages/probers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,9 @@ program

Take a screenshot
```js
await page.screenshot({ path: 'test_output/example.png' });

await page.ss('example')

// Under the hood will call (which you may also do)
// await page.screenshot({ path: 'test_output/example.png' });
```
4 changes: 2 additions & 2 deletions packages/probers/src/flows/create-account.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ export const createAccount = async (page, baseUrl, uploadPhoto = false) => {
await page.waitForXPath("//span[contains(text(), 'Start Listening')]", {
timeout: 5 /* min */ * 60 /* sec */ * 1000 /* ms */
})
await waitForAndClickButton(page, 'startListening')

// We still may be following users and playlists in the background, so wait
await waitForNetworkIdle0(page)
// for network idle in addition to clicking startListening
await waitForNetworkIdle0(page, waitForAndClickButton(page, 'startListening'))

// Export account so it can be re-used in other tests that don't want a fresh state
const entropy = await getEntropy(page)
Expand Down
7 changes: 7 additions & 0 deletions packages/probers/src/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@ import getConfig from '../config'

export const newPage = async (width = 1600, height = 960) => {
let page = await global.__BROWSER__.newPage()

page.setViewport({
width,
height
})
await page.setDefaultNavigationTimeout(0);

// Monkeypatch page screenshot method for ease of debugging
page.ss = async (identifier) => {
await page.screenshot({ path: `test_output/${identifier}.png` })
}

return page
}

Expand Down
1 change: 1 addition & 0 deletions packages/probers/test_output/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Test output directory

0 comments on commit 1d9e995

Please sign in to comment.