From 832287da3e45f09842c78dc4fbeefb80772d06d2 Mon Sep 17 00:00:00 2001 From: Dennis Huebner Date: Fri, 22 Nov 2024 09:13:49 +0100 Subject: [PATCH] Flaky Playwright test - notebook split cell #14450 (#14457) --- .gitignore | 1 + examples/playwright/package.json | 2 +- .../src/tests/theia-notebook-editor.test.ts | 22 ++++++++++----- yarn.lock | 28 +++++++++---------- 4 files changed, 31 insertions(+), 22 deletions(-) diff --git a/.gitignore b/.gitignore index aab5678aabd83..40f967eea81da 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,4 @@ dependency-check-summary.txt* /performance-result.json *.vsix /scripts/native-dependencies-* +allure-results diff --git a/examples/playwright/package.json b/examples/playwright/package.json index 837388a347cd3..8939769f04819 100644 --- a/examples/playwright/package.json +++ b/examples/playwright/package.json @@ -31,7 +31,7 @@ "src" ], "dependencies": { - "@playwright/test": "^1.37.1", + "@playwright/test": "^1.47.0", "fs-extra": "^9.0.8" }, "devDependencies": { diff --git a/examples/playwright/src/tests/theia-notebook-editor.test.ts b/examples/playwright/src/tests/theia-notebook-editor.test.ts index 3045d25421b87..152d8c4540741 100644 --- a/examples/playwright/src/tests/theia-notebook-editor.test.ts +++ b/examples/playwright/src/tests/theia-notebook-editor.test.ts @@ -21,6 +21,7 @@ import { TheiaNotebookCell } from '../theia-notebook-cell'; import { TheiaNotebookEditor } from '../theia-notebook-editor'; import { TheiaWorkspace } from '../theia-workspace'; import path = require('path'); +import fs = require('fs'); // See .github/workflows/playwright.yml for preferred python version const preferredKernel = process.env.CI ? 'Python 3.11' : 'Python 3'; @@ -39,7 +40,9 @@ test.describe('Theia Notebook Editor interaction', () => { }); test.afterAll(async () => { - await app.page.close(); + if (app.page) { + await app.page.close(); + } }); test.afterEach(async () => { @@ -110,9 +113,11 @@ test.describe('Theia Notebook Editor interaction', () => { <|>print("Line-2") */ const line = await cell.editor.lineByLineNumber(1); - await line?.waitForElementState('visible'); - await line?.click(); - await line?.press('ArrowRight'); + expect(line, { message: 'Line number 1 should exists' }).toBeDefined(); + const box = await line?.boundingBox(); + console.log(`Split cell test: visible = ${await line?.isVisible()}, box = {${box?.x},${box?.y},${box?.width},${box?.height}}`); + await line!.click(); + await line!.press('ArrowRight'); // split cell await cell.splitCell(); @@ -134,7 +139,9 @@ test.describe('Theia Notebook Cell interaction', () => { }); test.afterAll(async () => { - await app.page.close(); + if (app.page) { + await app.page.close(); + } }); test.beforeEach(async () => { @@ -309,8 +316,9 @@ async function firstCell(editor: TheiaNotebookEditor): Promise { const workingDir = path.resolve(); - // correct WS path. When running from IDE the path is playwright/configs with CLI it's playwright/ - const prefix = workingDir.endsWith('playwright/configs') ? '../' : ''; + // correct WS path. When running from IDE the path is workspace root or playwright/configs, with CLI it's playwright/ + const isWsRoot = fs.existsSync(path.join(workingDir, 'examples', 'playwright')); + const prefix = isWsRoot ? 'examples/playwright/' : (workingDir.endsWith('playwright/configs') ? '../' : ''); const ws = new TheiaWorkspace([prefix + 'src/tests/resources/notebook-files']); const app = await TheiaAppLoader.load(args, ws); // auto-save are disabled using settings.json file diff --git a/yarn.lock b/yarn.lock index 3a312954d3c6a..7ddee1084ff44 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1742,12 +1742,12 @@ resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33" integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg== -"@playwright/test@^1.37.1": - version "1.41.2" - resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.41.2.tgz#bd9db40177f8fd442e16e14e0389d23751cdfc54" - integrity sha512-qQB9h7KbibJzrDpkXkYvsmiDJK14FULCCZgEcoe2AvFAS64oCirWTwzTlAYEbKaRxWs5TFesE1Na6izMv3HfGg== +"@playwright/test@^1.47.0": + version "1.48.2" + resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.48.2.tgz#87dd40633f980872283404c8142a65744d3f13d6" + integrity sha512-54w1xCWfXuax7dz4W2M9uw0gDyh+ti/0K/MxcCUxChFh37kkdxPdfZDw5QBbuPUJHr1CiHJ1hXgSs+GgeQc5Zw== dependencies: - playwright "1.41.2" + playwright "1.48.2" "@puppeteer/browsers@2.3.1": version "2.3.1" @@ -9961,17 +9961,17 @@ pkg-up@^3.1.0: dependencies: find-up "^3.0.0" -playwright-core@1.41.2: - version "1.41.2" - resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.41.2.tgz#db22372c708926c697acc261f0ef8406606802d9" - integrity sha512-VaTvwCA4Y8kxEe+kfm2+uUUw5Lubf38RxF7FpBxLPmGe5sdNkSg5e3ChEigaGrX7qdqT3pt2m/98LiyvU2x6CA== +playwright-core@1.48.2: + version "1.48.2" + resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.48.2.tgz#cd76ed8af61690edef5c05c64721c26a8db2f3d7" + integrity sha512-sjjw+qrLFlriJo64du+EK0kJgZzoQPsabGF4lBvsid+3CNIZIYLgnMj9V6JY5VhM2Peh20DJWIVpVljLLnlawA== -playwright@1.41.2: - version "1.41.2" - resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.41.2.tgz#4e760b1c79f33d9129a8c65cc27953be6dd35042" - integrity sha512-v0bOa6H2GJChDL8pAeLa/LZC4feoAMbSQm1/jF/ySsWWoaNItvrMP7GEkvEEFyCTUYKMxjQKaTSg5up7nR6/8A== +playwright@1.48.2: + version "1.48.2" + resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.48.2.tgz#fca45ae8abdc34835c715718072aaff7e305167e" + integrity sha512-NjYvYgp4BPmiwfe31j4gHLa3J7bD2WiBz8Lk2RoSsmX38SVIARZ18VYjxLjAcDsAhA+F4iSEXTSGgjua0rrlgQ== dependencies: - playwright-core "1.41.2" + playwright-core "1.48.2" optionalDependencies: fsevents "2.3.2"