|
| 1 | +import { baseSelectors } from './../../cypress-e2e/common/selectors'; |
| 2 | +import { BaseMethods } from '../../cypress-e2e/common/base'; |
| 3 | +import { Constants } from '../../cypress-e2e/fixtures/constants'; |
| 4 | + |
| 5 | +const basePage: BaseMethods = new BaseMethods(); |
| 6 | + |
| 7 | +const appsData = [ |
| 8 | + { |
| 9 | + appNameText: Constants.commonConstantsData.basicComponents.host, |
| 10 | + host: 3000, |
| 11 | + }, |
| 12 | + { |
| 13 | + appNameText: Constants.commonConstantsData.basicComponents.remote, |
| 14 | + host: 3002, |
| 15 | + }, |
| 16 | +]; |
| 17 | + |
| 18 | +appsData.forEach((property: { appNameText: string; host: number }) => { |
| 19 | + const appName = property.host === 3000 ? appsData[0].appNameText : appsData[1].appNameText; |
| 20 | + |
| 21 | + describe('CRA', () => { |
| 22 | + context(`Check ${appName}`, () => { |
| 23 | + beforeEach(() => { |
| 24 | + basePage.openLocalhost({ |
| 25 | + number: property.host, |
| 26 | + }); |
| 27 | + }); |
| 28 | + |
| 29 | + it(`Check ${appName} elements exist on the page`, () => { |
| 30 | + basePage.checkElementWithTextPresence({ |
| 31 | + selector: baseSelectors.tags.headers.h1, |
| 32 | + text: Constants.commonConstantsData.basicComponents.basicHostRemote, |
| 33 | + }); |
| 34 | + basePage.checkElementWithTextPresence({ |
| 35 | + selector: baseSelectors.tags.headers.h2, |
| 36 | + text: property.appNameText, |
| 37 | + }); |
| 38 | + basePage.checkElementWithTextPresence({ |
| 39 | + selector: baseSelectors.tags.coreElements.button, |
| 40 | + text: Constants.elementsText.craApp.buttonText, |
| 41 | + }); |
| 42 | + }); |
| 43 | + }); |
| 44 | + }); |
| 45 | +}); |
0 commit comments