Skip to content

Commit

Permalink
Flaky Playwright test - notebook split cell eclipse-theia#14450 (ecli…
Browse files Browse the repository at this point in the history
  • Loading branch information
dhuebner authored Nov 22, 2024
1 parent a0a453d commit 832287d
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 22 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ dependency-check-summary.txt*
/performance-result.json
*.vsix
/scripts/native-dependencies-*
allure-results
2 changes: 1 addition & 1 deletion examples/playwright/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"src"
],
"dependencies": {
"@playwright/test": "^1.37.1",
"@playwright/test": "^1.47.0",
"fs-extra": "^9.0.8"
},
"devDependencies": {
Expand Down
22 changes: 15 additions & 7 deletions examples/playwright/src/tests/theia-notebook-editor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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 () => {
Expand Down Expand Up @@ -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();
Expand All @@ -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 () => {
Expand Down Expand Up @@ -309,8 +316,9 @@ async function firstCell(editor: TheiaNotebookEditor): Promise<TheiaNotebookCell

async function loadApp(args: TheiaPlaywrightTestConfig & PlaywrightWorkerArgs): Promise<TheiaApp> {
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
Expand Down
28 changes: 14 additions & 14 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"

Expand Down

0 comments on commit 832287d

Please sign in to comment.