-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Stabilize RecommendedExtensions test #23965
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -198,6 +198,32 @@ export class ProjectAndFileTests { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return projectTreeItem; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * wait for a specific item to appear in the project tree by polling. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * useful after expanding a folder to wait until its children are rendered. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * @param projectSection ViewSection with project tree files. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * @param label Label of the item to wait for. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * @param itemLevel Depth level of the item in the tree. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| async waitProjectTreeItem(projectSection: ViewSection, label: string, itemLevel: number = 2): Promise<void> { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Logger.debug(`waiting for "${label}" at level ${itemLevel}`); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const timeout: number = TIMEOUT_CONSTANTS.TS_EXPAND_PROJECT_TREE_ITEM_TIMEOUT; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const polling: number = TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const attempts: number = Math.ceil(timeout / polling); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for (let i: number = 0; i < attempts; i++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const item: ViewItem | undefined = await projectSection.findItem(label, itemLevel); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (item) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Logger.debug(`"${label}" found after ${i + 1} attempt(s)`); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await this.driverHelper.wait(polling); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| throw new Error(`Item "${label}" not found in the project tree at level ${itemLevel} after ${timeout}ms`); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * @returns {string} Branch name of cloned repository | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+201
to
229
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: rg -n 'findItem|waitProjectTreeItem' tests/e2e
sed -n '190,235p' tests/e2e/tests-library/ProjectAndFileTests.tsRepository: eclipse-che/che Length of output: 3848 🏁 Script executed: set -e
printf '%s\n' '--- imports and helper context ---'
sed -n '1,220p' tests/e2e/tests-library/ProjectAndFileTests.ts
printf '%s\n' '--- caller context ---'
sed -n '300,345p' tests/e2e/specs/dashboard-samples/RecommendedExtensions.spec.ts
printf '%s\n' '--- findItem definitions/usages and dependency references ---'
rg -n --glob '!node_modules' --glob '!dist' --glob '!build' 'class ViewSection|interface ViewSection|findItem\s*\(' .
rg -n 'ViewSection|ViewItem' tests/e2e package.json tests package-lock.json yarn.lock pnpm-lock.yaml 2>/dev/null || trueRepository: eclipse-che/che Length of output: 37321 🏁 Script executed: set -e
printf '%s\n' '--- tracked manifests and dependency references ---'
git ls-files | rg '(^|/)(package\.json|.*lock|.*monaco.*page.*object|node_modules)' || true
rg -n -i 'monaco-page-objects|page-objects' --glob '!tests/e2e/tests-library/ProjectAndFileTests.ts' --glob '!tests/e2e/specs/dashboard-samples/RecommendedExtensions.spec.ts' .
printf '%s\n' '--- repository status and revision availability ---'
git rev-parse --verify 1b2555eefb2b0d47395430b6dd1d0815fe53e1a7^{commit}
git rev-parse --verify 901c3fbb776e2ee4b74354bc7cf973398baec95c^{commit}Repository: eclipse-che/che Length of output: 5533 🌐 Web query:
💡 Result: 🏁 Script executed: set -e
url='https://registry.npmjs.org/monaco-page-objects/-/monaco-page-objects-3.14.1.tgz'
printf '%s\n' '--- package entries for ViewSection ---'
curl -fsSL "$url" | tar -tzf - | grep -E 'ViewSection|viewSection'
printf '%s\n' '--- concrete implementation and declaration ---'
curl -fsSL "$url" | tar -xOzf - package/out/pageobjects/sidebar/ViewSection.js
curl -fsSL "$url" | tar -xOzf - package/out/pageobjects/sidebar/ViewSection.d.tsRepository: eclipse-che/che Length of output: 601 🏁 Script executed: set -e
url='https://registry.npmjs.org/monaco-page-objects/-/monaco-page-objects-3.14.1.tgz'
printf '%s\n' '--- ViewSection implementation ---'
curl -fsSL "$url" | tar -xOzf - package/out/components/sidebar/ViewSection.js
printf '%s\n' '--- ViewSection declaration ---'
curl -fsSL "$url" | tar -xOzf - package/out/components/sidebar/ViewSection.d.ts
printf '%s\n' '--- ExtensionsViewSection implementation ---'
curl -fsSL "$url" | tar -xOzf - package/out/components/sidebar/extensions/ExtensionsViewSection.jsRepository: eclipse-che/che Length of output: 16220 🏁 Script executed: set -e
url='https://registry.npmjs.org/monaco-page-objects/-/monaco-page-objects-3.14.1.tgz'
printf '%s\n' '--- sidebar package files ---'
curl -fsSL "$url" | tar -tzf - | grep '^package/out/components/sidebar/' | sort
printf '%s\n' '--- files declaring findItem ---'
curl -fsSL "$url" | tar -tzf - | grep '^package/out/.*\.js$' |
while read -r file; do
content=$(curl -fsSL "$url" | tar -xOzf - "$file")
if printf '%s\n' "$content" | grep -q 'findItem'; then
printf '%s\n' "### $file"
printf '%s\n' "$content" | grep -n -A45 -B8 'findItem'
fi
doneRepository: eclipse-che/che Length of output: 12434 🏁 Script executed: set -e
url='https://registry.npmjs.org/monaco-page-objects/-/monaco-page-objects-3.14.1.tgz'
printf '%s\n' '--- AbstractElement findElement delegation ---'
curl -fsSL "$url" | tar -xOzf - package/out/components/AbstractElement.js | grep -n -A12 -B5 'findElement'
printf '%s\n' '--- changed hunk against supplied base ---'
git diff --unified=12 901c3fbb776e2ee4b74354bc7cf973398baec95c 1b2555eefb2b0d47395430b6dd1d0815fe53e1a7 -- tests/e2e/tests-library/ProjectAndFileTests.tsRepository: eclipse-che/che Length of output: 3758 🏁 Script executed: set -e
url='https://registry.npmjs.org/monaco-page-objects/-/monaco-page-objects-3.14.1.tgz'
printf '%s\n' '--- ViewContent section construction ---'
curl -fsSL "$url" | tar -xOzf - package/out/components/sidebar/ViewContent.js
printf '%s\n' '--- SideBarView content construction ---'
curl -fsSL "$url" | tar -xOzf - package/out/components/sidebar/SideBarView.jsRepository: eclipse-che/che Length of output: 4050 Keep polling when The default project tree uses Suggested fix for (let i: number = 0; i < attempts; i++) {
- const item: ViewItem | undefined = await projectSection.findItem(label, itemLevel);
+ let item: ViewItem | undefined;
+ try {
+ item = await projectSection.findItem(label, itemLevel);
+ } catch (e) {
+ Logger.debug(`"${label}" lookup failed while the project tree was rendering`);
+ }
if (item) {
Logger.debug(`"${label}" found after ${i + 1} attempt(s)`);
return;📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Check once more before reporting a timeout.
With the default 10-second timeout and 1-second interval, this loop checks at approximately 0–9 seconds. If the file appears after the last check but before 10 seconds, the helper sleeps and then throws. Check at the deadline, or use a deadline-based loop that checks after its final wait.
🤖 Prompt for AI Agents