Skip to content

Commit

Permalink
added more e2e tests #73
Browse files Browse the repository at this point in the history
  • Loading branch information
MatteoGuarnaccia5 committed Nov 1, 2023
1 parent 6acbd23 commit 5f3071b
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions cypress/e2e/manufacturer/manufacturer.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,4 +236,53 @@ describe('Manufacturer', () => {
cy.contains('Please enter a valid URL');
});
});

it('Not changing any fields shows error', () => {
cy.findByRole('button', {
name: 'Edit Manufacturer A manufacturer',
}).click();

cy.findByRole('button', { name: 'Save' }).click();

cy.findByRole('dialog')
.should('be.visible')
.within(() => {
cy.contains(
"There have been no changes made. Please change a field's value or press Cancel to exit"
);
});
});

it('Required fields that are cleared are not allowed and show error message', () => {
cy.findByRole('button', {
name: 'Edit Manufacturer A manufacturer',
}).click();

cy.findByLabelText('Name').clear();
cy.findByLabelText('Building number').clear();
cy.findByLabelText('Street name').clear();
cy.findByLabelText('Post/Zip code').clear();

cy.findByRole('button', { name: 'Save' }).click();
cy.findByRole('dialog')
.should('be.visible')
.within(() => {
cy.contains('Please enter a name.');
});
cy.findByRole('dialog')
.should('be.visible')
.within(() => {
cy.contains('Please enter a building number.');
});
cy.findByRole('dialog')
.should('be.visible')
.within(() => {
cy.contains('Please enter a street name.');
});
cy.findByRole('dialog')
.should('be.visible')
.within(() => {
cy.contains('Please enter a post code or zip code.');
});
});
});

0 comments on commit 5f3071b

Please sign in to comment.