Created
December 10, 2018 12:18
-
-
Save AndreyBelym/c9afd908d4b2891a62a4ba87623ec064 to your computer and use it in GitHub Desktop.
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
const longRunningPostRequest = require('./setup/seed-database'); | |
const createTestCafe = require('testcafe'); | |
const RUN_OPTIONS = {pageLoadTimeout: 120000, selectorTimeout: 15000}; | |
const setupLicense = async () => { | |
const testcafe = await createTestCafe('localhost', 1337, 1338, undefined, true); | |
const runner = testcafe.createRunner(); | |
const failedCount = await runner | |
.src(['fixtures/setup-license.js']) | |
.browsers(['chrome -incognito']) | |
.reporter('spec') | |
.run(RUN_OPTIONS); | |
await testcafe.close(); | |
}; | |
const setupData = async () => { | |
const testcafe = await createTestCafe('localhost', 1337, 1338, undefined, true) | |
const runner = testcafe.createRunner(); | |
await runner | |
.src(['fixtures/setup-wizard.js']) | |
.browsers(['chrome -incognito']) | |
.reporter('spec') | |
.run(RUN_OPTIONS); | |
await testcafe.close(); | |
}; | |
// running them all in sequence | |
setupLicense() | |
.then(() => longRunningPostRequest()) // long-running POST request. Typically takes around 100 seconds to complete | |
.then(() => setupData()) | |
.catch(err => console.log('Error occured:', err)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment