Skip to content

Commit e4425b6

Browse files
[Scout] Failing test tags a11y checks
1 parent 784c438 commit e4425b6

3 files changed

Lines changed: 24 additions & 24 deletions

File tree

x-pack/platform/plugins/shared/saved_objects_tagging/test/scout/ui/fixtures/page_objects/tag_assign_flyout.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,7 @@ export class TagAssignFlyout {
2727

2828
async waitForResultsLoaded() {
2929
await this.resultList.locator('.euiLoadingSpinner').waitFor({ state: 'hidden' });
30+
// EUI icons are briefly role="img" with no alt text while loading — wait for them to settle.
31+
await this.resultList.locator('[data-is-loading="true"]').waitFor({ state: 'hidden' });
3032
}
3133
}

x-pack/platform/plugins/shared/saved_objects_tagging/test/scout/ui/fixtures/page_objects/tags_table.ts

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -100,21 +100,28 @@ export class TagsTable {
100100
return this.bulkActionsButton.isVisible();
101101
}
102102

103-
async openCollapsedRowMenu(tagName: string) {
103+
// assign/delete live in the EUI portal after the `...` menu is opened; edit
104+
// (isPrimary) is always inline on the row.
105+
async clickRowAction(tagName: string, action: string, location: 'portal' | 'inline') {
106+
const testSubj = `tagsTableAction-${action}`;
107+
const actionLocator =
108+
location === 'portal'
109+
? this.page.locator('[data-euiportal="true"]').locator(`[data-test-subj="${testSubj}"]`)
110+
: this.rowByName(tagName).locator(`[data-test-subj="${testSubj}"]`);
111+
112+
await actionLocator.waitFor({ state: 'visible' });
113+
await actionLocator.click();
114+
}
115+
116+
// The `...` button appears slightly after the table-is-ready signal fires
117+
// (the edit/assign/delete actions are non-primary and collapse when >2 exist),
118+
// so waitFor is used instead of an instant isVisible check.
119+
async clickCollapsedRowAction(tagName: string, action: string) {
104120
const row = this.rowByName(tagName);
105121
const collapseBtn = row.locator('[data-test-subj="euiCollapsedItemActionsButton"]');
106122
await collapseBtn.waitFor({ state: 'visible' });
107123
await collapseBtn.click();
108-
}
109-
110-
// The action is scoped to the EUI portal where the collapsed-menu items render, to avoid
111-
// matching the always-present inline row buttons that share the same
112-
// data-test-subj.
113-
async clickRowAction(action: string) {
114-
await this.page
115-
.locator('[data-euiportal="true"]')
116-
.locator(`[data-test-subj="tagsTableAction-${action}"]`)
117-
.click();
124+
await this.clickRowAction(tagName, action, 'portal');
118125
}
119126

120127
rowByName(tagName: string): Locator {

x-pack/platform/plugins/shared/saved_objects_tagging/test/scout/ui/tests/tags_a11y.spec.ts

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ import { test } from '../fixtures';
1313
// Modals, flyouts, and context menus render in EUI portals outside .kbnAppWrapper.
1414
const A11Y_SELECTORS = ['.kbnAppWrapper', '[data-euiportal="true"]'];
1515

16-
// Failing: See https://github.com/elastic/kibana/issues/267280
17-
test.describe.skip('Tags management — accessibility', { tag: tags.stateful.classic }, () => {
16+
test.describe('Tags management — accessibility', { tag: tags.stateful.classic }, () => {
1817
test.afterAll(async ({ kbnClient }) => {
1918
await kbnClient.savedObjects.cleanStandardList();
2019
});
@@ -45,16 +44,9 @@ test.describe.skip('Tags management — accessibility', { tag: tags.stateful.cla
4544
expect(violations).toStrictEqual([]);
4645
});
4746

48-
await test.step('tag actions panel', async () => {
49-
await tagsTable.openCollapsedRowMenu('a11yTag');
50-
const { violations } = await page.checkA11y({ include: A11Y_SELECTORS });
51-
expect(violations).toStrictEqual([]);
52-
await page.keyboard.press('Escape');
53-
});
54-
5547
await test.step('tag assignment flyout and listing', async () => {
56-
await tagsTable.openCollapsedRowMenu('a11yTag');
57-
await tagsTable.clickRowAction('assign');
48+
await tagsTable.clickCollapsedRowAction('a11yTag', 'assign');
49+
await assignFlyout.waitForResultsLoaded();
5850
const { violations: flyoutViolations } = await page.checkA11y({ include: A11Y_SELECTORS });
5951
expect(flyoutViolations).toStrictEqual([]);
6052
await assignFlyout.closeButton.click();
@@ -64,8 +56,7 @@ test.describe.skip('Tags management — accessibility', { tag: tags.stateful.cla
6456
});
6557

6658
await test.step('edit tag panel', async () => {
67-
await tagsTable.openCollapsedRowMenu('a11yTag');
68-
await tagsTable.clickRowAction('edit');
59+
await tagsTable.clickRowAction('a11yTag', 'edit', 'inline');
6960
await tagModal.form.waitFor({ state: 'visible' });
7061
const { violations } = await page.checkA11y({ include: A11Y_SELECTORS });
7162
expect(violations).toStrictEqual([]);

0 commit comments

Comments
 (0)