-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Wait for asset discovery finish when awaiting on snapshot resour…
…ces in finalize (#423) * test: Add failing test for snapshots being added after finalize * fix: Wait for asset discovery finish when awaiting on snapshots * test: Clean up test file imports * fix integration tests * Improve tests * Code review fixes
- Loading branch information
Showing
6 changed files
with
53 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import expect from 'expect' | ||
import { | ||
run, | ||
setupApiProxy, | ||
setupDummyApp | ||
} from './helpers' | ||
|
||
describe('Asset discovery', () => { | ||
let proxy = setupApiProxy() | ||
let dummy = setupDummyApp() | ||
|
||
it('waits for snapshot creation before build finalization', async () => { | ||
let [stdout] = await run('percy exec -- node ./test/acceptance/dummy/snapshot-error.js'); | ||
let finalizeReqDate = proxy.requests['/builds/123/finalize'][0].timestamp; | ||
let snapshotReqs = proxy.requests['/builds/123/snapshots']; | ||
let lastSnapshotReqDate = snapshotReqs[snapshotReqs.length - 1].timestamp; | ||
|
||
expect(finalizeReqDate).toBeGreaterThan(lastSnapshotReqDate) | ||
expect(stdout).toHaveEntries([ | ||
'[percy] percy has started.', | ||
/^\[percy\] waiting for \d+ snapshots to complete\.\.\.$/m, | ||
"[percy] snapshot taken: 'Home Page - 0'", | ||
'[percy] done.', | ||
'[percy] finalized build #4: <<build-url>>' | ||
]) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// register babel for the snapshot helper | ||
require('@babel/register') | ||
require('regenerator-runtime/runtime') | ||
|
||
const launch = require('../helpers/snapshot').default | ||
|
||
launch(async (page, snapshot) => { | ||
await page.goto('http://localhost:9999') | ||
|
||
setTimeout(() => { | ||
throw new Error('Surprise!') | ||
}, 100) // magic number | ||
|
||
for (let index = 0; index < 10; index++) { | ||
await snapshot(`Home Page - ${index}`) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters