Skip to content

Commit 8711af8

Browse files
Test fixes
1 parent c45c855 commit 8711af8

8 files changed

Lines changed: 32 additions & 12 deletions

File tree

src/platform/plugins/shared/dashboard/public/dashboard_listing/dashboard_listing.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ export const DashboardListing = ({
9393
return {
9494
primaryActionItem: {
9595
id: 'create',
96+
testId: 'dashboardListingCreateButton',
9697
iconType: 'plus',
9798
label: i18n.translate('dashboard.listing.createButtonLabel', {
9899
defaultMessage: 'Create',

src/platform/plugins/shared/dashboard/test/scout/ui/parallel_tests/dashboard_listing_navigation.spec.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ spaceTest.describe(
3939
'clicking create new dashboard button navigates to the editor',
4040
async () => {
4141
await pageObjects.dashboard.goto();
42-
await page.testSubj.click('newItemButton');
42+
await page.testSubj.click('dashboardListingCreateButton');
43+
await page.testSubj.click('createDashboardButton');
4344
await expect(page.testSubj.locator('dashboardAddTopNavButton')).toBeVisible({
4445
timeout: 20_000,
4546
});
@@ -48,7 +49,7 @@ spaceTest.describe(
4849

4950
await spaceTest.step('navigating back to listing page from a new dashboard', async () => {
5051
await page.goBack();
51-
await expect(page.testSubj.locator('newItemButton')).toBeVisible();
52+
await expect(page.testSubj.locator('dashboardListingCreateButton')).toBeVisible();
5253
});
5354
}
5455
);
@@ -57,7 +58,8 @@ spaceTest.describe(
5758
'saving a dashboard and returning to the listing page shows it',
5859
async ({ page, pageObjects }) => {
5960
await pageObjects.dashboard.goto();
60-
await page.testSubj.click('newItemButton');
61+
await page.testSubj.click('dashboardListingCreateButton');
62+
await page.testSubj.click('createDashboardButton');
6163
await expect(page.testSubj.locator('dashboardAddTopNavButton')).toBeVisible({
6264
timeout: 20_000,
6365
});

src/platform/test/accessibility/apps/dashboard.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
142142
await listingTable.clickDeleteSelected();
143143
await a11y.testAppSnapshot();
144144
await common.clickConfirmOnModal();
145-
await listingTable.isShowingEmptyPromptCreateNewButton();
145+
await dashboard.expectCreateButtonExists();
146146
});
147147
});
148148
}

src/platform/test/functional/page_objects/dashboard_page.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ export class DashboardPageObject extends FtrService {
458458
await this.common.clickConfirmOnModal();
459459
}
460460
}
461-
await this.listingTable.clickNewButton();
461+
await this.clickCreatePopoverItem('createDashboardButton');
462462
if (expectWarning) {
463463
await this.testSubjects.existOrFail('dashboardCreateConfirm');
464464
}
@@ -473,8 +473,23 @@ export class DashboardPageObject extends FtrService {
473473
await this.waitForRenderComplete();
474474
}
475475

476+
public async clickCreatePopoverItem(
477+
itemTestSubj: 'createDashboardButton' | 'createVisualizationButton' | 'createAnnotationButton'
478+
) {
479+
await this.testSubjects.click('dashboardListingCreateButton');
480+
await this.testSubjects.click(itemTestSubj);
481+
}
482+
476483
public async clickCreateDashboardPrompt() {
477-
await this.testSubjects.click('newItemButton');
484+
await this.clickCreatePopoverItem('createDashboardButton');
485+
}
486+
487+
public async expectCreateButtonExists() {
488+
await this.testSubjects.existOrFail('dashboardListingCreateButton');
489+
}
490+
491+
public async expectCreateButtonMissing() {
492+
await this.testSubjects.missingOrFail('dashboardListingCreateButton');
478493
}
479494

480495
public async getCreateDashboardPromptExists() {

x-pack/performance/journeys_e2e/dashboard_listing_page.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ export const journey = new Journey({
3737
await deletedDashboard.waitFor({ state: 'detached' });
3838
})
3939
.step('Add dashboard', async ({ page, inputDelays }) => {
40-
await page.click(subj('newItemButton'));
40+
await page.click(subj('dashboardListingCreateButton'));
41+
await page.click(subj('createDashboardButton'));
4142
await page.click(subj('dashboardInteractiveSaveMenuItem'));
4243
await page.type(subj('savedObjectTitle'), `foobar dashboard ${uuidv4()}`, {
4344
delay: inputDelays.TYPING,

x-pack/platform/test/functional/apps/dashboard/group1/feature_controls/dashboard_security.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
106106
await testSubjects.existOrFail('dashboardLandingPage', {
107107
timeout: config.get('timeouts.waitFor'),
108108
});
109-
await testSubjects.existOrFail('newItemButton');
109+
await dashboard.expectCreateButtonExists();
110110
});
111111

112112
it(`doesn't show read-only badge`, async () => {
@@ -288,7 +288,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
288288
await testSubjects.existOrFail('dashboardLandingPage', {
289289
timeout: config.get('timeouts.waitFor'),
290290
});
291-
await testSubjects.missingOrFail('newItemButton');
291+
await dashboard.expectCreateButtonMissing();
292292
});
293293

294294
it(`shows read-only badge`, async () => {
@@ -396,7 +396,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
396396
args: navigationArgs,
397397
});
398398
await testSubjects.existOrFail('dashboardLandingPage', { timeout: 10000 });
399-
await testSubjects.missingOrFail('newItemButton');
399+
await dashboard.expectCreateButtonMissing();
400400
});
401401

402402
it(`shows read-only badge`, async () => {

x-pack/platform/test/functional/apps/dashboard/group1/feature_controls/dashboard_spaces.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
6161
await testSubjects.existOrFail('dashboardLandingPage', {
6262
timeout: config.get('timeouts.waitFor'),
6363
});
64-
await testSubjects.existOrFail('newItemButton');
64+
await dashboard.expectCreateButtonExists();
6565
});
6666

6767
it(`create new dashboard shows addNew button`, async () => {

x-pack/solutions/search/test/serverless/functional/test_suites/default_dataview.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ export default function ({ getPageObject, getService }: FtrProviderContext) {
4545
await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'dashboards' });
4646
await testSubjects.existOrFail('~breadcrumb-deepLinkId-dashboards');
4747
await testSubjects.existOrFail('emptyListPrompt');
48-
await testSubjects.click('newItemButton');
48+
await testSubjects.click('dashboardListingCreateButton');
49+
await testSubjects.click('createDashboardButton');
4950
await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({
5051
text: 'Editing New Dashboard',
5152
});

0 commit comments

Comments
 (0)