-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon-page.js
42 lines (36 loc) · 1.27 KB
/
common-page.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { continueButton, feedbackLink, mainHeading } from '../partials';
/**
* commonPageAssertions
* Assert common elements in a page.
* These are elements that are repeated on every page, or the majority of pages.
* with the only difference being for example, headings and button copy.
* @param {String} expectedContinueButton: Expected "continue" button text.
* @param {String} expectedMainHeading: Expected "main heading" text".
* @param {Boolean} assertFeedbackLink: Flag for asserting the feedback link.
*/
const commonPageAssertions = ({
expectedContinueButton = 'Continue',
expectedMainHeading,
assertFeedbackLink = true
}) => {
describe('common page assertions', () => {
// it should render a header
it('should render a main heading', () => {
cy.assertText(mainHeading(), expectedMainHeading);
});
it('should render a continue button', () => {
cy.assertText(continueButton(), expectedContinueButton);
});
if (assertFeedbackLink) {
it('should render a feedback link', () => {
cy.assertFeedbackLink();
});
} else {
it('should NOT render a feedback link', () => {
feedbackLink().should('not.exist');
});
}
// it should render a footer
});
};
export default commonPageAssertions;