From c3e8399096f1c1f90e8a22916d21cdf8b511d6dd Mon Sep 17 00:00:00 2001 From: dzonidoo Date: Tue, 2 Jul 2024 15:09:40 +0200 Subject: [PATCH] changes after review --- e2e/client/playwright/multiedit.spec.ts | 50 +++++++++---------- .../page-object-models/monitoring.ts | 9 ++++ .../apps/search/views/multi-action-bar.html | 2 +- 3 files changed, 33 insertions(+), 28 deletions(-) diff --git a/e2e/client/playwright/multiedit.spec.ts b/e2e/client/playwright/multiedit.spec.ts index cdfa1795fb..fe2fba84d1 100644 --- a/e2e/client/playwright/multiedit.spec.ts +++ b/e2e/client/playwright/multiedit.spec.ts @@ -3,40 +3,17 @@ import {Monitoring} from './page-object-models/monitoring'; import {restoreDatabaseSnapshot, s} from './utils'; test.describe('Multiedit', async () => { - test('Can open article in multiedit', async ({page}) => { + test('Can edit articles in multiedit', async ({page}) => { const monitoring = new Monitoring(page); await restoreDatabaseSnapshot(); await page.goto('/#/workspace/monitoring'); + await monitoring.selectDeskOrWorkspace('Sports'); - await monitoring.executeActionOnMonitoringItem( - page.locator(s('article-item=test sports story')), - 'Edit', - ); - await monitoring.executeActionInEditor( - 'Multiedit', - 'OK', - ); - await expect(page.locator(s('multiedit-screen', 'multiedit-article=test sports story'))).toBeVisible(); - }); - - test('Can edit article in multiedit', async ({page}) => { - const monitoring = new Monitoring(page); - - await restoreDatabaseSnapshot(); - await page.goto('/#/workspace/monitoring'); - - await monitoring.executeActionOnMonitoringItem( - page.locator(s('article-item=test sports story')), - 'Edit', - ); - await monitoring.executeActionInEditor( - 'Multiedit', - 'OK', - ); + await monitoring.executeMultiAction(['test sports story', 'story 2'], 'Multi-edit'); await page - .locator(s('multiedit-screen', 'multiedit-article', 'field--headline')) + .locator(s('multiedit-screen', 'multiedit-article=test sports story', 'field--headline')) .getByRole('textbox') .fill('test sports story 1.1'); await page.locator(s('multiedit-screen', 'multiedit-article=test sports story')).hover(); @@ -44,6 +21,17 @@ test.describe('Multiedit', async () => { .locator(s('multiedit-screen', 'multiedit-article=test sports story')) .getByRole('button', {name: 'save'}) .click(); + + await page + .locator(s('multiedit-screen', 'multiedit-article=story 2', 'field--headline')) + .getByRole('textbox') + .fill('story 2.1'); + await page.locator(s('multiedit-screen', 'multiedit-article=story 2')).hover(); + await page + .locator(s('multiedit-screen', 'multiedit-article=story 2')) + .getByRole('button', {name: 'save'}) + .click(); + await page.locator(s('multiedit-subnav')).getByRole('button', {name: 'exit'}).click(); await monitoring.executeActionOnMonitoringItem( @@ -53,6 +41,14 @@ test.describe('Multiedit', async () => { await expect( page.locator(s('authoring', 'field--headline')).getByRole('textbox'), ).toHaveText('test sports story 1.1'); + + await monitoring.executeActionOnMonitoringItem( + page.locator(s('article-item=story 2.1')), + 'Edit', + ); + await expect( + page.locator(s('authoring', 'field--headline')).getByRole('textbox'), + ).toHaveText('story 2.1'); }); test('Can remove article in multiedit', async ({page}) => { diff --git a/e2e/client/playwright/page-object-models/monitoring.ts b/e2e/client/playwright/page-object-models/monitoring.ts index 89571857f0..36329b1c0e 100644 --- a/e2e/client/playwright/page-object-models/monitoring.ts +++ b/e2e/client/playwright/page-object-models/monitoring.ts @@ -52,6 +52,15 @@ export class Monitoring { .click(); } + async executeMultiAction(selectedArticles: Array, action: string): Promise { + for (const selectedArticle of selectedArticles) { + await this.page.locator(s(`article-item=${selectedArticle}`, 'item-type-and-multi-select')).hover(); + await this.page.locator(s(`article-item=${selectedArticle}`, 'multi-select-checkbox')).check(); + } + + await this.page.locator(s('multi-action-bar', 'multi-actions-inline', action)).click(); + } + async createArticleFromTemplate(template: string, options?: {slugline?:string, body_html?: string}): Promise { await this.page.locator(s('content-create')).click(); await this.page.locator(s('content-create-dropdown')).getByRole('button', {name: 'More Templates...'}).click(); diff --git a/scripts/apps/search/views/multi-action-bar.html b/scripts/apps/search/views/multi-action-bar.html index 48629b8fcd..9e516c729d 100644 --- a/scripts/apps/search/views/multi-action-bar.html +++ b/scripts/apps/search/views/multi-action-bar.html @@ -1,4 +1,4 @@ -
+