|
| 1 | +import { getH1, getH3 } from '../support/app.po'; |
| 2 | + |
| 3 | +describe('3005-runtime-host/', () => { |
| 4 | + beforeEach(() => cy.visit('/')); |
| 5 | + |
| 6 | + describe('Welcome message', () => { |
| 7 | + it('should display welcome message', () => { |
| 8 | + getH1().contains('Runtime Demo'); |
| 9 | + }); |
| 10 | + }); |
| 11 | + |
| 12 | + describe('Image checks', () => { |
| 13 | + it('should check that the home-webpack-png and remote1-webpack-png images are not 404', () => { |
| 14 | + // Get the src attribute of the home-webpack-png image |
| 15 | + cy.get('img.home-webpack-png') |
| 16 | + .invoke('attr', 'src') |
| 17 | + .then((src) => { |
| 18 | + if (!src) { |
| 19 | + throw new Error('src must not be empty'); |
| 20 | + } |
| 21 | + cy.log(src); |
| 22 | + cy.request(src).its('status').should('eq', 200); |
| 23 | + }); |
| 24 | + |
| 25 | + // Get the src attribute of the shop-webpack-png image |
| 26 | + cy.get('img.remote1-webpack-png') |
| 27 | + .invoke('attr', 'src') |
| 28 | + .then((src) => { |
| 29 | + if (!src) { |
| 30 | + throw new Error('src must not be empty'); |
| 31 | + } |
| 32 | + // Send a GET request to the src URL |
| 33 | + cy.request(src).its('status').should('eq', 200); |
| 34 | + }); |
| 35 | + }); |
| 36 | + |
| 37 | + it('should check that the home-webpack-svg and remote1-webpack-svg images are not 404', () => { |
| 38 | + // Get the src attribute of the home-webpack-png image |
| 39 | + cy.get('img.home-webpack-svg') |
| 40 | + .invoke('attr', 'src') |
| 41 | + .then((src) => { |
| 42 | + if (!src) { |
| 43 | + throw new Error('src must not be empty'); |
| 44 | + } |
| 45 | + cy.log(src); |
| 46 | + cy.request(src).its('status').should('eq', 200); |
| 47 | + }); |
| 48 | + |
| 49 | + // Get the src attribute of the shop-webpack-png image |
| 50 | + cy.get('img.remote1-webpack-svg') |
| 51 | + .invoke('attr', 'src') |
| 52 | + .then((src) => { |
| 53 | + if (!src) { |
| 54 | + throw new Error('src must not be empty'); |
| 55 | + } |
| 56 | + // Send a GET request to the src URL |
| 57 | + cy.request(src).its('status').should('eq', 200); |
| 58 | + }); |
| 59 | + }); |
| 60 | + }); |
| 61 | + |
| 62 | + describe('Shared react hook check', () => { |
| 63 | + it('should display text which comes from remote1 hook', () => { |
| 64 | + cy.get('.remote1-text') |
| 65 | + .invoke('html') |
| 66 | + .should('equal', 'Custom hook from localhost:3006 works!'); |
| 67 | + }); |
| 68 | + }); |
| 69 | + |
| 70 | + describe('dynamic remote check', () => { |
| 71 | + describe('dynamic-remote/ButtonOldAnt', () => { |
| 72 | + it('should display remote button', () => { |
| 73 | + cy.get('button.test-remote2').contains('Button'); |
| 74 | + }); |
| 75 | + it('should use host shared(antd)', () => { |
| 76 | + cy.get('button.test-remote2').contains('Button from [email protected]'); |
| 77 | + }); |
| 78 | + }); |
| 79 | + }); |
| 80 | +}); |
0 commit comments