Skip to content

Commit

Permalink
test: do not wait until loaded in new budget test
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiphe committed May 17, 2020
1 parent f1535a4 commit 9a0af16
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
1 change: 1 addition & 0 deletions cypress/integration/createNewBudget.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ describe('Create New Budget', () => {
const categories = [category(), category(), category()];

cy.open({
waitUntilLoaded: false,
ignoreChannels: [
'FILE_EDITED',
'SAVE_CANCELED',
Expand Down
26 changes: 16 additions & 10 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type BBexposed = BB & {
};
type OpenConfig = {
setup?: (bb: BB) => void | Promise<void>;
waitUntilLoaded?: boolean;
ignoreChannels: string[];
};

Expand Down Expand Up @@ -72,13 +73,18 @@ Cypress.Commands.add('readBudget', (file: string) => {
Cypress.Commands.add('cleanup', () => {
cy._bb().then(({ _electron }) => _electron.cleanup());
});
Cypress.Commands.add('open', ({ setup, ignoreChannels }) => {
cy.visit('/');
cy._bb().then(({ _electron }) => {
_electron.ignoreChannels(ignoreChannels);
});
cy.bb().then(setup);
cy._bb().then(({ _startApp }) => _startApp());
cy.findByText(/BudgetBudget - Loading/i).should('be.visible');
cy.findByText(/BudgetBudget - Loading/i).should('not.be.visible');
});
Cypress.Commands.add(
'open',
({ setup, ignoreChannels, waitUntilLoaded = true }) => {
cy.visit('/');
cy._bb().then(({ _electron }) => {
_electron.ignoreChannels(ignoreChannels);
});
cy.bb().then(setup);
cy._bb().then(({ _startApp }) => _startApp());
if (waitUntilLoaded) {
cy.findByText(/BudgetBudget - Loading/i).should('be.visible');
cy.findByText(/BudgetBudget - Loading/i).should('not.be.visible');
}
},
);

0 comments on commit 9a0af16

Please sign in to comment.