Skip to content

Commit

Permalink
Merge pull request #71 from manh-t/chore/37-integration-test-survey-d…
Browse files Browse the repository at this point in the history
…etail-page

[#37] [Chore] UI Integration Testing - Survey Detail page
  • Loading branch information
manh-t authored Aug 31, 2023
2 parents d2592b5 + 9c4d78c commit 6a0180a
Show file tree
Hide file tree
Showing 2 changed files with 2,037 additions and 0 deletions.
33 changes: 33 additions & 0 deletions cypress/e2e/Survey/index.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const surveyScreenTestIds = {
backButton: 'survey__back-button',
};

describe('Survey screen', () => {
context('given the Back button is clicked', () => {
it('backs to the previous page', () => {
cy.signIn();

cy.interceptWithDelay('GET', '**/api/v1/surveys/*', 200, {
statusCode: 200,
fixture: 'Survey/Detail/valid.json',
});
cy.interceptWithDelay('GET', '**/api/v1/surveys*', 200, {
statusCode: 200,
fixture: 'Survey/List/valid.json',
});
cy.interceptWithDelay('GET', '**/api/v1/me', 200, {
statusCode: 200,
fixture: 'User/valid.json',
});

cy.visit('/');
cy.visit('/surveys/d5de6a8f8f5f1cfe51bc');

cy.findByTestId(surveyScreenTestIds.backButton).click();

cy.location().should((location) => {
expect(location.pathname).to.equal('/');
});
});
});
});
Loading

0 comments on commit 6a0180a

Please sign in to comment.