Skip to content

Commit

Permalink
test(e2e): add a simple test for viewport addon
Browse files Browse the repository at this point in the history
CLI now generates project with `addon-essential` so it enable `addon-viewport` by default.
I added a simple test to check that viewport is properly loaded:
 - Go to Welcome Story
 - Click on Viewport button in the toolbar
 - Select "Small Mobile"
 - Check that Welcome Story is still displayed
  • Loading branch information
gaetanmaisse committed Jul 11, 2020
1 parent a057ed7 commit 44348e8
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions cypress/generated/addon-viewport.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
describe('addon-viewport', () => {
before(() => {
cy.visitStorybook();
});

it('should have viewport button in the toolbar', () => {
cy.navigateToStory('button', 'Text');

// Click on viewport button and select small mobile
cy.get('[title="Change the size of the preview"]').click();
cy.get('#mobile1').click();

// Check that Welcome story is still displayed
cy.getStoryElement().should('contain.text', 'Button');
});
});

0 comments on commit 44348e8

Please sign in to comment.