Skip to content

Commit f22f5ed

Browse files
Fix UMD federation e2e tests (#4388)
1 parent ae8b6b0 commit f22f5ed

File tree

4 files changed

+20
-22
lines changed

4 files changed

+20
-22
lines changed

umd-federation/app1/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
},
1111
"dependencies": {
1212
"react": "^18.2.0",
13-
"react-dom": "^18.2.0"
13+
"react-dom": "^18.2.0",
14+
"module-federation-runtime": "1.2.4"
1415
},
1516
"devDependencies": {
1617
"@babel/core": "7.24.7",

umd-federation/e2e/checkUmdFederationApps.spec.ts

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { test } from '@playwright/test';
1+
import { expect, test } from '@playwright/test';
22

3-
import { BaseMethods } from '../../playwright-e2e/common/base';
43
import { baseSelectors } from '../../cypress-e2e/common/selectors';
54
import { Constants } from '../../cypress-e2e/fixtures/constants';
65

@@ -19,32 +18,26 @@ const appsData = [
1918
test.describe('UMD Federation', () => {
2019
appsData.forEach(({ header1, header2, header3, host }) => {
2120
test.describe(`Check application on localhost:${host}`, () => {
22-
let basePage: BaseMethods;
21+
const baseUrl = `http://localhost:${host}/`;
2322

2423
test.beforeEach(async ({ page }) => {
25-
basePage = new BaseMethods(page);
26-
await basePage.openLocalhost({ number: host });
24+
await page.goto(baseUrl, { waitUntil: 'networkidle' });
2725
});
2826

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);
3132

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+
}
4437
});
4538

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);
4841
});
4942
});
5043
});

umd-federation/playwright.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export default defineConfig({
2020
screenshot: 'only-on-failure',
2121
video: 'retain-on-failure',
2222
viewport: { width: 1920, height: 1080 },
23+
ignoreHTTPSErrors: true,
2324
},
2425
projects: [
2526
{

umd-federation/pnpm-lock.yaml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)