Skip to content

Commit fa99991

Browse files
committed
Capture db state once before all tests, restore in a few tests
1 parent 3f5a1b2 commit fa99991

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

cypress/e2e/rails_examples/using_factory_bot.cy.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
describe('Rails using factory bot examples', function() {
2-
beforeEach(() => {
3-
cy.app('start');
4-
});
5-
62
afterEach(() => {
7-
cy.app('clean');
3+
cy.appDbState('restore');
84
});
95

106
it('using single factory bot', function() {

cypress/e2e/ui/Settings/Application-Settings/schedule.cy.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -533,11 +533,7 @@ describe('Automate Schedule form operations: Settings > Application Settings > S
533533
cy.expect_flash(flashClassMap.success, FLASH_MESSAGE_SCHEDULE_QUEUED);
534534
});
535535

536-
beforeEach(() => {
537-
cy.app('start');
538-
});
539-
540536
afterEach(() => {
541-
cy.app('clean');
537+
cy.appDbState('restore');
542538
});
543539
});

cypress/support/e2e.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,16 @@ Cypress.on('uncaught:exception', (err, runnable) => {
8686
return false;
8787
}
8888
});
89+
// capture the database table state before all tests
90+
before(() => {
91+
cy.appDbState('capture');
92+
});
8993

9094
beforeEach(() => {
9195
// Global hook run once before each test
9296
// cy.throttle_response(500, 56);
9397
// cy.stub_notifications();
94-
98+
9599
// Reset the intercepted aliases tracking object
96100
cy.resetInterceptedApiAliases();
97101
})

0 commit comments

Comments
 (0)