Skip to content

Commit

Permalink
changes after review
Browse files Browse the repository at this point in the history
  • Loading branch information
dzonidoo committed Jul 2, 2024
1 parent 63d85f6 commit c3e8399
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 28 deletions.
50 changes: 23 additions & 27 deletions e2e/client/playwright/multiedit.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,47 +3,35 @@ 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();
await page
.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(
Expand All @@ -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}) => {
Expand Down
9 changes: 9 additions & 0 deletions e2e/client/playwright/page-object-models/monitoring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ export class Monitoring {
.click();
}

async executeMultiAction(selectedArticles: Array<string>, action: string): Promise<void> {
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<void> {
await this.page.locator(s('content-create')).click();
await this.page.locator(s('content-create-dropdown')).getByRole('button', {name: 'More Templates...'}).click();
Expand Down
2 changes: 1 addition & 1 deletion scripts/apps/search/views/multi-action-bar.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="multi-action-bar" ng-if="multi.count && display">
<div class="multi-action-bar" ng-if="multi.count && display" data-test-id="multi-action-bar">
<button class="toggle" ng-click="toggleDisplay()"><i class="icon-chevron-up-thin"></i></button>
<button class="btn" ng-click="multi.reset()">cancel</button>
<span id="multi-select-count"
Expand Down

0 comments on commit c3e8399

Please sign in to comment.