mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-08 17:06:15 -08:00
revert(e2e): leave the sidebar category read race to #1728
#1728 fixes the same readVisibleSidebarCategoryNames race with a shared helper; keeping a second copy here would only conflict. This PR stays about mock-server lifecycle. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8eaa5fcf7c
commit
0f5eb0eeb2
1 file changed
+22
-15
@@ -591,22 +591,29 @@ async function expectVisibleSidebarCategoryNames(
|
||||
}
|
||||
}
|
||||
|
||||
// One DOM snapshot: reading items one by one raced list updates, and
|
||||
// `textContent()` on a removed item auto-waited through the whole poll.
|
||||
async function readVisibleSidebarCategoryNames(page: Page): Promise<string[]> {
|
||||
return page
|
||||
.locator('app-workspace-context-panel .category-item')
|
||||
.filter({ visible: true })
|
||||
.evaluateAll((categories) =>
|
||||
categories
|
||||
.map(
|
||||
(category) =>
|
||||
category
|
||||
.querySelector('.nav-item-label')
|
||||
?.textContent?.trim() ?? ''
|
||||
)
|
||||
.filter((name) => name.length > 0)
|
||||
);
|
||||
const categories = page.locator(
|
||||
'app-workspace-context-panel .category-item'
|
||||
);
|
||||
const actualNames: string[] = [];
|
||||
const count = await categories.count();
|
||||
|
||||
for (let index = 0; index < count; index += 1) {
|
||||
const category = categories.nth(index);
|
||||
if (!(await category.isVisible())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const categoryName =
|
||||
(await category.locator('.nav-item-label').textContent())?.trim() ??
|
||||
'';
|
||||
|
||||
if (categoryName) {
|
||||
actualNames.push(categoryName);
|
||||
}
|
||||
}
|
||||
|
||||
return actualNames;
|
||||
}
|
||||
|
||||
function stringArraysEqual(left: string[], right: string[]): boolean {
|
||||
|
||||
Reference in new issue
Block a user