|
| 1 | +import { BaseMethods } from '../../cypress-e2e/common/base'; |
| 2 | +import { baseSelectors } from '../../cypress-e2e/common/selectors'; |
| 3 | +import { Constants } from '../../cypress-e2e/fixtures/constants'; |
| 4 | +const basePage: BaseMethods = new BaseMethods(); |
| 5 | + |
| 6 | +const appsData = [ |
| 7 | + // { |
| 8 | + // appName: Constants.elementsText.nextJsSsrApp.checkout, |
| 9 | + // host: 3000, |
| 10 | + // }, |
| 11 | + // { |
| 12 | + // appName: Constants.commonConstantsData.home, |
| 13 | + // host: 3001, |
| 14 | + // }, |
| 15 | + { |
| 16 | + appName: Constants.elementsText.nextJsSsrApp.shop, |
| 17 | + host: 3002, |
| 18 | + }, |
| 19 | +]; |
| 20 | + |
| 21 | +appsData.forEach((property: { appName: string; host: number }) => { |
| 22 | + describe(`Check ${property.appName} app functionality and elements`, () => { |
| 23 | + beforeEach(() => { |
| 24 | + basePage.openLocalhost({ |
| 25 | + number: property.host, |
| 26 | + }); |
| 27 | + cy.wait(5000); |
| 28 | + }); |
| 29 | + it('Check the items on the Home page and the links to ZEIT and GitHub in the header', () => { |
| 30 | + basePage.checkElementWithTextPresence({ |
| 31 | + selector: baseSelectors.tags.coreElements.list, |
| 32 | + text: Constants.commonConstantsData.home, |
| 33 | + }); |
| 34 | + basePage.checkElementWithTextPresence({ |
| 35 | + selector: baseSelectors.tags.headers.h1, |
| 36 | + text: Constants.elementsText.nextJsSsrApp.texts.text3, |
| 37 | + }); |
| 38 | + basePage.checkElementWithTextPresence({ |
| 39 | + selector: baseSelectors.tags.paragraph, |
| 40 | + text: Constants.elementsText.nextJsSsrApp.texts.text4, |
| 41 | + }); |
| 42 | + basePage.checkElementWithTextPresence({ |
| 43 | + selector: baseSelectors.tags.headers.h1, |
| 44 | + text: Constants.elementsText.nextJsSsrApp.messages.welcomeMessage, |
| 45 | + }); |
| 46 | + basePage.checkElementWithTextPresence({ |
| 47 | + selector: baseSelectors.tags.paragraph, |
| 48 | + text: Constants.elementsText.nextJsSsrApp.texts.text5, |
| 49 | + }); |
| 50 | + basePage.checkElementWithTextPresence({ |
| 51 | + selector: baseSelectors.tags.headers.h3, |
| 52 | + text: Constants.elementsText.nextJsSsrApp.tiles.documentation, |
| 53 | + }); |
| 54 | + basePage.checkElementWithTextPresence({ |
| 55 | + selector: baseSelectors.tags.headers.h3, |
| 56 | + text: Constants.elementsText.nextJsSsrApp.tiles.learn, |
| 57 | + }); |
| 58 | + basePage.checkElementWithTextPresence({ |
| 59 | + selector: baseSelectors.tags.headers.h3, |
| 60 | + text: Constants.elementsText.nextJsSsrApp.tiles.examples, |
| 61 | + }); |
| 62 | + basePage.checkElementWithTextPresence({ |
| 63 | + selector: baseSelectors.tags.coreElements.list, |
| 64 | + text: Constants.elementsText.nextJsSsrApp.zeit, |
| 65 | + }); |
| 66 | + basePage.checkElementWithTextPresence({ |
| 67 | + selector: baseSelectors.tags.coreElements.list, |
| 68 | + text: Constants.elementsText.nextJsSsrApp.gitHub, |
| 69 | + }); |
| 70 | + }); |
| 71 | + it('Verify the Shop page items', () => { |
| 72 | + basePage.clickElementWithText({ |
| 73 | + selector: baseSelectors.tags.coreElements.list, |
| 74 | + text: Constants.elementsText.nextJsSsrApp.shop, |
| 75 | + wait: 2000, |
| 76 | + }); |
| 77 | + basePage.checkElementWithTextPresence({ |
| 78 | + selector: baseSelectors.tags.headers.h1, |
| 79 | + text: Constants.elementsText.nextJsSsrApp.pages.shopPage, |
| 80 | + }); |
| 81 | + basePage.checkElementWithTextPresence({ |
| 82 | + selector: baseSelectors.tags.headers.h3, |
| 83 | + text: Constants.elementsText.nextJsSsrApp.texts.mainShopText, |
| 84 | + }); |
| 85 | + }); |
| 86 | + it('Verify the Federated page items', () => { |
| 87 | + basePage.clickElementWithText({ |
| 88 | + selector: baseSelectors.tags.coreElements.list, |
| 89 | + text: Constants.elementsText.nextJSv12App.federatedButton.name, |
| 90 | + wait: 2000, |
| 91 | + }); |
| 92 | + basePage.checkElementWithTextPresence({ |
| 93 | + selector: baseSelectors.tags.headers.h1, |
| 94 | + text: Constants.elementsText.nextJSv12App.federatedButton.header, |
| 95 | + }); |
| 96 | + }); |
| 97 | + it('Verify the Checkout page items', () => { |
| 98 | + basePage.clickElementWithText({ |
| 99 | + selector: baseSelectors.tags.coreElements.list, |
| 100 | + text: Constants.elementsText.nextJsSsrApp.checkout, |
| 101 | + wait: 2000, |
| 102 | + }); |
| 103 | + basePage.checkElementWithTextPresence({ |
| 104 | + selector: baseSelectors.tags.headers.h1, |
| 105 | + text: Constants.elementsText.nextJsSsrApp.pages.checkoutPage, |
| 106 | + }); |
| 107 | + basePage.checkElementWithTextPresence({ |
| 108 | + selector: baseSelectors.tags.headers.h3, |
| 109 | + text: Constants.elementsText.nextJsSsrApp.messages.checkoutMessage, |
| 110 | + }); |
| 111 | + basePage.checkElementQuantity({ |
| 112 | + selector: baseSelectors.tags.pre, |
| 113 | + quantity: 2, |
| 114 | + }); |
| 115 | + }); |
| 116 | + }); |
| 117 | +}); |
0 commit comments