Skip to content

Instantly share code, notes, and snippets.

@AndreyBelym
Created December 10, 2018 12:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AndreyBelym/c9afd908d4b2891a62a4ba87623ec064 to your computer and use it in GitHub Desktop.
Save AndreyBelym/c9afd908d4b2891a62a4ba87623ec064 to your computer and use it in GitHub Desktop.
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