1
- import { test } from '@playwright/test' ;
1
+ import { expect , test } from '@playwright/test' ;
2
2
3
- import { BaseMethods } from '../../playwright-e2e/common/base' ;
4
3
import { baseSelectors } from '../../cypress-e2e/common/selectors' ;
5
4
import { Constants } from '../../cypress-e2e/fixtures/constants' ;
6
5
@@ -19,32 +18,26 @@ const appsData = [
19
18
test . describe ( 'UMD Federation' , ( ) => {
20
19
appsData . forEach ( ( { header1, header2, header3, host } ) => {
21
20
test . describe ( `Check application on localhost:${ host } ` , ( ) => {
22
- let basePage : BaseMethods ;
21
+ const baseUrl = `http://localhost: ${ host } /` ;
23
22
24
23
test . beforeEach ( async ( { page } ) => {
25
- basePage = new BaseMethods ( page ) ;
26
- await basePage . openLocalhost ( { number : host } ) ;
24
+ await page . goto ( baseUrl , { waitUntil : 'networkidle' } ) ;
27
25
} ) ;
28
26
29
- test ( 'Check App elements' , async ( ) => {
30
- test . skip ( ! header1 , 'App 2 renders external remote content without headers.' ) ;
27
+ test ( 'Check App elements' , async ( { page } ) => {
28
+ if ( ! header1 || ! header2 || ! header3 ) {
29
+ test . skip ( 'App 2 renders external remote content without headers.' ) ;
30
+ } else {
31
+ const headerLocator = page . locator ( baseSelectors . tags . headers . h1 ) ;
31
32
32
- await basePage . checkElementWithTextPresence ( {
33
- selector : baseSelectors . tags . headers . h1 ,
34
- text : header1 ! ,
35
- } ) ;
36
- await basePage . checkElementWithTextPresence ( {
37
- selector : baseSelectors . tags . headers . h1 ,
38
- text : header2 ! ,
39
- } ) ;
40
- await basePage . checkElementWithTextPresence ( {
41
- selector : baseSelectors . tags . headers . h1 ,
42
- text : header3 ! ,
43
- } ) ;
33
+ for ( const text of [ header1 , header2 , header3 ] ) {
34
+ await expect ( headerLocator . filter ( { hasText : text } ) ) . toBeVisible ( ) ;
35
+ }
36
+ }
44
37
} ) ;
45
38
46
- test ( 'Check App URL' , async ( ) => {
47
- await basePage . checkUrlText ( `http://localhost: ${ host } /` , true ) ;
39
+ test ( 'Check App URL' , async ( { page } ) => {
40
+ await expect . poll ( ( ) => page . url ( ) ) . toContain ( baseUrl ) ;
48
41
} ) ;
49
42
} ) ;
50
43
} ) ;
0 commit comments