Erez Rokah 7e0a8ad532
feat(core): align GitHub metadata handling with other backends (#3316)
* Revert "Revert "feat(core): Align GitHub metadata handling with other backends (#3292)""

This reverts commit 5bdd3df9ccbb5149c22d79987ebdcd6cab4b261f.

* fix(backend-github): fix migration code

* test(backend-github): fix test

* test(e2e): shorten wait time

* test(e2e): try and fix test on CI
2020-02-24 17:44:10 -05:00

60 lines
1.5 KiB
JavaScript

export const before = (taskResult, options, backend) => {
Cypress.config('taskTimeout', 7 * 60 * 1000);
cy.task('setupBackend', { backend, options }).then(data => {
taskResult.data = data;
Cypress.config('defaultCommandTimeout', data.mockResponses ? 5 * 1000 : 1 * 60 * 1000);
});
};
export const after = (taskResult, backend) => {
cy.task('teardownBackend', {
backend,
...taskResult.data,
});
};
export const beforeEach = (taskResult, backend) => {
const spec = Cypress.mocha.getRunner().suite.ctx.currentTest.parent.title;
const testName = Cypress.mocha.getRunner().suite.ctx.currentTest.title;
cy.task('setupBackendTest', {
backend,
...taskResult.data,
spec,
testName,
});
if (taskResult.data.mockResponses) {
const fixture = `${spec}__${testName}.json`;
console.log('loading fixture:', fixture);
cy.stubFetch({ fixture });
}
return cy.clock(0, ['Date']);
};
export const afterEach = (taskResult, backend) => {
const spec = Cypress.mocha.getRunner().suite.ctx.currentTest.parent.title;
const testName = Cypress.mocha.getRunner().suite.ctx.currentTest.title;
cy.task('teardownBackendTest', {
backend,
...taskResult.data,
spec,
testName,
});
if (
!process.env.RECORD_FIXTURES &&
Cypress.mocha.getRunner().suite.ctx.currentTest.state === 'failed'
) {
Cypress.runner.stop();
}
};
export const seedRepo = (taskResult, backend) => {
cy.task('seedRepo', {
backend,
...taskResult.data,
});
};