forked from superdesk/superdesk-client-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Multiedit e2e tests (superdesk#4464)
- Loading branch information
Showing
6 changed files
with
116 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import {test, expect} from '@playwright/test'; | ||
import {Monitoring} from './page-object-models/monitoring'; | ||
import {Authoring} from './page-object-models/authoring'; | ||
import {MultiEdit} from './page-object-models/multiedit'; | ||
import {restoreDatabaseSnapshot, s} from './utils'; | ||
|
||
test.describe('Multiedit', async () => { | ||
test('editing articles in multi-edit mode', async ({page}) => { | ||
const monitoring = new Monitoring(page); | ||
const multiedit = new MultiEdit(page); | ||
|
||
await restoreDatabaseSnapshot(); | ||
await page.goto('/#/workspace/monitoring'); | ||
await monitoring.selectDeskOrWorkspace('Sports'); | ||
|
||
await monitoring.executeBulkAction('Multi-edit', ['test sports story', 'story 2']); | ||
|
||
await page | ||
.locator(s('multiedit-screen', 'multiedit-article=test sports story', 'field--headline')) | ||
.getByRole('textbox') | ||
.clear(); | ||
await page | ||
.locator(s('multiedit-screen', 'multiedit-article=test sports story', 'field--headline')) | ||
.getByRole('textbox') | ||
.fill('test sports story 1.1'); | ||
|
||
await multiedit.save('test sports story'); | ||
|
||
await page | ||
.locator(s('multiedit-screen', 'multiedit-article=story 2', 'field--headline')) | ||
.getByRole('textbox') | ||
.clear(); | ||
await page | ||
.locator(s('multiedit-screen', 'multiedit-article=story 2', 'field--headline')) | ||
.getByRole('textbox') | ||
.fill('story 2.1'); | ||
|
||
await multiedit.save('story 2'); | ||
|
||
await page.locator(s('multiedit-subnav')).getByRole('button', {name: 'exit'}).click(); | ||
|
||
await monitoring.executeActionOnMonitoringItem( | ||
page.locator(s('article-item=test sports story 1.1')), | ||
'Edit', | ||
); | ||
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('removing an article from multi-edit view', async ({page}) => { | ||
const monitoring = new Monitoring(page); | ||
const authoring = new Authoring(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 authoring.executeActionInEditor( | ||
'Multiedit', | ||
'OK', | ||
); | ||
|
||
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: 'remove item'}) | ||
.click(); | ||
await expect(page.locator(s('multiedit-screen', 'multiedit-article=test sports story'))).not.toBeVisible(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import {Page} from '@playwright/test'; | ||
import {s} from '../utils'; | ||
|
||
export class MultiEdit { | ||
private page: Page; | ||
|
||
constructor(page: Page) { | ||
this.page = page; | ||
} | ||
|
||
async save(article: string): Promise<void> { | ||
await this.page.locator(s('multiedit-screen', `multiedit-article=${article}`)).hover(); | ||
|
||
await this.page | ||
.locator(s('multiedit-screen', `multiedit-article=${article}`)) | ||
.getByRole('button', {name: 'save'}) | ||
.click(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
scripts/apps/authoring/multiedit/views/sd-multiedit-article.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters