Skip to content

[OCISDEV-843] Flaky search test - 2nd fix#13800

Merged
LukasHirt merged 3 commits into
masterfrom
fix/OCISDEV-843-fix
Jun 5, 2026
Merged

[OCISDEV-843] Flaky search test - 2nd fix#13800
LukasHirt merged 3 commits into
masterfrom
fix/OCISDEV-843-fix

Conversation

@deyankiteworks
Copy link
Copy Markdown
Member

@deyankiteworks deyankiteworks commented May 20, 2026

Summary

  • Uses resourcePage.filesList instead of resourcePage.searchList for asserting search results after pressing Enter
  • After pressing Enter, the test navigates to the full search results page which renders via ResourceTable with [data-test-resource-path] selectors — NOT the dropdown (#files-global-search-options)
  • Removes the unnecessary 2000ms waitForTimeout workaround from the first fix attempt

Related Issue

Test plan

  • Verify the "Search in personal spaces" test passes consistently in CI
  • Confirm no regressions in other search tests

🤖 Generated with Claude Code

@update-docs
Copy link
Copy Markdown

update-docs Bot commented May 20, 2026

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@deyankiteworks deyankiteworks self-assigned this May 20, 2026
@deyankiteworks deyankiteworks requested review from LukasHirt and mzner May 20, 2026 11:04
Comment thread tests/e2e/specs/search/search.spec.ts
Comment thread tests/e2e/specs/search/search.spec.ts
@anon-pradip
Copy link
Copy Markdown
Contributor

anon-pradip commented Jun 2, 2026

My opinions:

@deyankiteworks @mzner

Why was it passing before then?

It wasn't. That's the whole reason OCISDEV-843 exists. The test was already flaky. The original playwright port (commit 9bd7e30cc) had the exact same code: presses enter + titleOnly + searchList. It was broken from day one — just got lucky sometimes. I also tried many times to fix it but no luck.

Why does filesList fix it?

After pressing Enter, two things happen:

  1. onKeyUpEnter in SearchBar.vue:518 calls optionsDrop.hide() (hides the dropdown via Tippy.js), then router.push() navigates to the full results page (List.vue).
  2. List.vue renders search results in a <resource-table> (visible on page).

The assertion then reads from the wrong DOM element:

  • searchList = //div[@id="files-global-search-options"]//li[...]//span[@class="oc-resource-name"] — reads from the hidden Tippy dropdown (#files-global-search-options)
  • filesList = [data-test-resource-path] — reads from the visible resource table on the full results page

After Enter, the actual search results live in the resource-table (where List.vue renders them). The title-only toggle works on this same table. But searchList reads from the hidden dropdown which has stale/empty content — the search() function in SearchBar.vue:483 starts with searchResults.value = [], and when the route changes, parseRouteQuery re-sets term.value which can trigger a re-search that clears dropdown results mid-flight.

So @deyankiteworks Were you testing this test locally with Tika enabled? Because Without Tika, fullTextSearchEnabled is falseList.vue:77 has v-if="fullTextSearchEnabled" → the title-only button never renders → userEnablesTitleOnlySearch times out → same crash regardless of selector. You might have seen it fail with filesList, and you again reverted to searchList, and saw it also fail — concluding that the selector wasn't the problem. But it might be that you were simply hitting a different root cause (missing Tika) that masked the fix.

@anon-pradip
Copy link
Copy Markdown
Contributor

anon-pradip commented Jun 2, 2026

@deyankiteworks

On PR #13831, I ran the search test 10 times in CI with the filesList selector fix — all 10 passed (link: #13831).

The one-line change in search.spec.ts:285:

resourcePage.searchList  resourcePage.filesList

After presses enter, onKeyUpEnter in SearchBar.vue:518 calls optionsDrop.hide() and router.push() to the full results page (List.vue).

The results render in <resource-table> (uses data-test-resource-path), not in the #files-global-search-options dropdown anymore. So:

  • searchList (reads from #files-global-search-options) reads stale/empty DOM.
  • filesList (reads [data-test-resource-path]) reads the actual visible table.

Your rework in this PR avoids this by removing presses enter + titleOnly from the assertion, which also works, but drops test coverage for the "title-only filter on full results page after Enter" flow.

If you'd rather keep that coverage, you could take the filesList fix instead and revert the rework to search.difficult.names back to the original flow.

@kw-security
Copy link
Copy Markdown

kw-security commented Jun 4, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@deyankiteworks
Copy link
Copy Markdown
Member Author

@deyankiteworks

On PR #13831, I ran the search test 10 times in CI with the filesList selector fix — all 10 passed (link: #13831).

The one-line change in search.spec.ts:285:

resourcePage.searchList  resourcePage.filesList

After presses enter, onKeyUpEnter in SearchBar.vue:518 calls optionsDrop.hide() and router.push() to the full results page (List.vue).

The results render in <resource-table> (uses data-test-resource-path), not in the #files-global-search-options dropdown anymore. So:

  • searchList (reads from #files-global-search-options) reads stale/empty DOM.
  • filesList (reads [data-test-resource-path]) reads the actual visible table.

Your rework in this PR avoids this by removing presses enter + titleOnly from the assertion, which also works, but drops test coverage for the "title-only filter on full results page after Enter" flow.

If you'd rather keep that coverage, you could take the filesList fix instead and revert the rework to search.difficult.names back to the original flow.

@anon-pradip

Thanks for the comments and the proposed fix. I reverted back the filesList fix, tested locally few times the whole search.spec.ts and it passed successfully.
I also force pushed this change and waiting for the runners to run the CI jobs.

Let's wait the CI jobs to finish and to check if the flaky search test will pass successfuly.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jun 4, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
39.9% Condition Coverage on New Code (required ≥ 50%)

See analysis details on SonarQube Cloud

@LukasHirt LukasHirt merged commit fb91cb6 into master Jun 5, 2026
20 of 21 checks passed
@LukasHirt LukasHirt deleted the fix/OCISDEV-843-fix branch June 5, 2026 10:00
LukasHirt added a commit that referenced this pull request Jun 5, 2026
* fix(e2e): [OCISDEV-843] Use correct listType for search results after pressing Enter

* fix(e2e): [OCISDEV-843] Keeps resourcePage.searchList as the correct listType

* fix(e2e): [OCISDEV-843] Using the filesList fix for listType

Co-authored-by: Deyan Zhekov <deyan.zhekov@kiteworks.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants