Skip to content

Commit 7a61c2b

Browse files
committed
fixing capabilities before first test
1 parent 0e3c1ae commit 7a61c2b

2 files changed

Lines changed: 21 additions & 20 deletions

File tree

‎.github/workflows/playwright-matrix.yml‎

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@ jobs:
214214
command: |
215215
pwd
216216
ls -la .wp-env*
217-
docker builder prune -f
218217
npx wp-env start --debug
219218
npx wp-env run cli wp core version
220219
@@ -228,19 +227,10 @@ jobs:
228227
229228
- name: Drop broken third-party apt repos on the runner
230229
run: |
231-
# `playwright install --with-deps` runs apt-get update on the RUNNER
232-
# itself (not inside the wp-env container). GitHub's image ships
233-
# third-party apt sources, and Google's has been serving a
234-
# Packages.gz whose checksum does not match its own Release file:
235-
# E: Failed to fetch .../Packages.gz Hash Sum mismatch
236-
# apt fails the whole update on one bad repo, which takes this step
237-
# down on every matrix leg. Playwright's OS dependencies come from
238-
# Ubuntu's own repos, so these third-party sources are unnecessary
239-
# here and safe to remove. Retrying does not help - the bad index is
240-
# served from Google's CDN, not cached locally.
241-
# Match on content, not filename: the runner image has used more
242-
# than one name/URL form for this source. Scoped to sources.list.d so
243-
# /etc/apt/sources.list (Ubuntu's own repos) can never be removed.
230+
# Playwright's OS dependencies come from Ubuntu's own repos
231+
# so these third-party sources are unnecessary here and safe to remove.
232+
# Scoped to sources.list.d so /etc/apt/sources.list (Ubuntu's own repos)
233+
# can never be removed.
244234
sudo grep -rl 'dl\.google\.com' /etc/apt/sources.list.d/ 2>/dev/null \
245235
| sudo xargs -r rm -fv || true
246236
sudo apt-get clean

‎tests/playwright/specs/ai-designer.spec.js‎

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,28 @@ import { auth, a11y, newfold } from '../helpers';
33

44
test.describe('AI Page Designer', () => {
55
test.beforeEach(async ({ page }) => {
6-
test.setTimeout(90000);
6+
test.setTimeout(120000);
77

8-
await newfold.setCapability({
8+
const capabilities = {
99
canAccessAI: true,
1010
canAccessAIPageDesigner: true,
1111
hasAISiteGen: true,
12-
});
13-
await auth.navigateToAdminPage(page, 'admin.php?page=web#/ai-designer');
14-
await page.waitForSelector('#wppw-app-rendered', { timeout: 15000 });
15-
12+
};
1613
const mount = page.locator('#nfd-ai-page-designer-mount');
14+
15+
// On CI the very first admin request of a fresh install renders with an
16+
// empty NewfoldRuntime.capabilities. Re-apply the capabilities and load the page
17+
// again rather than let whichever spec happens to run first absorb the failure.
18+
for (let attempt = 0; attempt < 3; attempt++) {
19+
await newfold.setCapability(capabilities);
20+
await auth.navigateToAdminPage(page, 'admin.php?page=web#/ai-designer');
21+
await page.waitForSelector('#wppw-app-rendered', { timeout: 15000 });
22+
23+
if (await mount.count()) {
24+
break;
25+
}
26+
}
27+
1728
await expect(mount).toBeVisible({ timeout: 15000 });
1829
await expect
1930
.poll(() => mount.evaluate((el) => el.childElementCount), {

0 commit comments

Comments
 (0)