diff --git a/e2e/client/playwright/page-object-models/authoring.ts b/e2e/client/playwright/page-object-models/authoring.ts new file mode 100644 index 0000000000..7c2c865094 --- /dev/null +++ b/e2e/client/playwright/page-object-models/authoring.ts @@ -0,0 +1,24 @@ +import {Page} from '@playwright/test'; +import {s} from '../utils'; + +export class Authoring { + private page: Page; + + constructor(page: Page) { + this.page = page; + } + + async executeActionInEditor(...actionPath: Array): Promise { + await this.page.locator(s('authoring-topbar', 'actions-button')).click(); + + const actionsWithoutLast = actionPath.slice(0, actionPath.length - 1); + + for (const action of actionsWithoutLast) { + await this.page.locator(s('actions-list')).getByRole('button', {name: action}).hover(); + } + + await this.page.locator(s('actions-list')) + .getByRole('button', {name: actionPath[actionPath.length - 1]}) + .click(); + } +} diff --git a/e2e/client/playwright/page-object-models/monitoring.ts b/e2e/client/playwright/page-object-models/monitoring.ts index d8a7009935..9ee47f36a1 100644 --- a/e2e/client/playwright/page-object-models/monitoring.ts +++ b/e2e/client/playwright/page-object-models/monitoring.ts @@ -50,18 +50,4 @@ export class Monitoring { } } } - - async executeActionInEditor(...actionPath: Array): Promise { - await this.page.locator(s('authoring-topbar', 'actions-button')).click(); - - const actionsWithoutLast = actionPath.slice(0, actionPath.length - 1); - - for (const action of actionsWithoutLast) { - await this.page.locator(s('actions-list')).getByRole('button', {name: action}).hover(); - } - - await this.page.locator(s('actions-list')) - .getByRole('button', {name: actionPath[actionPath.length - 1]}) - .click(); - } } diff --git a/e2e/client/playwright/templates.spec.ts b/e2e/client/playwright/templates.spec.ts index 5504316cf9..664869a4d8 100644 --- a/e2e/client/playwright/templates.spec.ts +++ b/e2e/client/playwright/templates.spec.ts @@ -1,5 +1,6 @@ import {test, expect} from '@playwright/test'; import {Monitoring} from './page-object-models/monitoring'; +import {Authoring} from './page-object-models/authoring'; import {restoreDatabaseSnapshot, s} from './utils'; test('creating new template', async ({page}) => { @@ -9,35 +10,35 @@ test('creating new template', async ({page}) => { await page.locator(s('template-header')).getByRole('button', {name: 'Add new'}).click(); await page.locator(s('template-edit-view')).getByPlaceholder('template name').fill('Template 1'); - await page.locator(s('template-edit-view', 'select-content-profile')).selectOption({label: 'Story'}); + await page.locator(s('template-edit-view')).getByLabel('Content Profile').selectOption({label: 'Story'}); await page.locator(s('template-edit-view')).getByRole('button', {name: 'Save'}).click(); - await expect(page.locator(s('template-content', 'content-template--template 1'))).toBeVisible(); + await expect(page.locator(s('template-content', 'content-template=template 1'))).toBeVisible(); }); -test('editing template', async ({page}) => { +test('editing template name', async ({page}) => { await restoreDatabaseSnapshot(); await page.goto('/#/settings/templates'); - await page.locator(s('template-content', 'content-template--story', 'template-actions')).click(); + await page.locator(s('template-content', 'content-template=story', 'template-actions')).click(); await page.locator(s('template-actions--options')).getByRole('button', {name: 'Edit'}).click(); await page.locator(s('template-edit-view')).getByPlaceholder('template name').fill('story 1.1'); await page.locator(s('template-edit-view')).getByRole('button', {name: 'Save'}).click(); - await expect(page.locator(s('template-content', 'content-template--story 1.1'))).toBeVisible(); + await expect(page.locator(s('template-content', 'content-template=story 1.1'))).toBeVisible(); }); test('removing template', async ({page}) => { await restoreDatabaseSnapshot(); await page.goto('/#/settings/templates'); - await page.locator(s('template-content', 'content-template--story 2', 'template-actions')).click(); + await page.locator(s('template-content', 'content-template=story 2', 'template-actions')).click(); await page.locator(s('template-actions--options')).getByRole('button', {name: 'Remove'}).click(); await page.locator(s('modal-confirm')).getByRole('button', {name: 'Ok'}).click(); - await expect(page.locator(s('template-content', 'content-template--story 2'))).not.toBeVisible(); + await expect(page.locator(s('template-content', 'content-template=story 2'))).not.toBeVisible(); }); -test('Assign template to a desk', async ({page}) => { +test('assigning template to a desk', async ({page}) => { const monitoring = new Monitoring(page); await restoreDatabaseSnapshot(); @@ -46,30 +47,32 @@ test('Assign template to a desk', async ({page}) => { await page.locator(s('content-create')).click(); await page.locator(s('content-create-dropdown')).getByRole('button', {name: 'More Templates...'}).click(); + await page.locator(s('content-create-dropdown', 'search')).fill('Story 2'); await expect(page.locator(s('content-create-dropdown')).getByRole('button', {name: 'Story 2'})).not.toBeVisible(); // assign template to the desk await page.goto('/#/settings/templates'); - await page.locator(s('template-content', 'content-template--story 2', 'template-actions')).click(); + await page.locator(s('template-content', 'content-template=story 2', 'template-actions')).click(); await page.locator(s('template-actions--options')).getByRole('button', {name: 'Edit'}).click(); - await page.locator(s('template-edit-view', 'desks', 'desk--Finances')).first().click(); + await page.locator(s('template-edit-view', 'desks', 'desk--Finances')).click(); + await page.locator(s('template-edit-view')).getByRole('button', {name: 'Save'}).click(); await page.goto('/#/workspace/monitoring'); - await monitoring.selectDeskOrWorkspace('Sports'); + await monitoring.selectDeskOrWorkspace('Finances'); await page.locator(s('content-create')).click(); await page.locator(s('content-create-dropdown')).getByRole('button', {name: 'More Templates...'}).click(); await expect(page.locator(s('content-create-dropdown')).getByRole('button', {name: 'Story 2'})).toBeVisible(); }); -test('Default content template', async ({page}) => { +test('default content template', async ({page}) => { const monitoring = new Monitoring(page); await restoreDatabaseSnapshot(); await page.goto('/#/settings/desks'); await page.locator(s('desk--Sports', 'desk-actions')).click(); - await page.locator(s('actions--options')).getByRole('button', {name: 'Edit'}).click(); + await page.locator(s('desk-actions--options')).getByRole('button', {name: 'Edit'}).click(); await page.locator(s('desk-config-modal', 'field--default-content-template')).selectOption({label: 'story 2'}); await page.locator(s('desk-config-modal')).getByRole('button', {name: 'done'}).click(); @@ -79,7 +82,7 @@ test('Default content template', async ({page}) => { await expect(page.locator(s('content-create-dropdown', 'default-desk-template'))).toHaveText('story 2'); }); -test('Prefill template', async ({page}) => { +test('new article prefilling with content set in template', async ({page}) => { const monitoring = new Monitoring(page); await restoreDatabaseSnapshot(); @@ -91,8 +94,9 @@ test('Prefill template', async ({page}) => { await expect(page.locator(s('authoring', 'field-slugline'))).toHaveValue('article 1'); }); -test('Save as template', async ({page}) => { +test('performing "save as" action on a template', async ({page}) => { const monitoring = new Monitoring(page); + const authoring = new Authoring(page); await restoreDatabaseSnapshot(); await page.goto('/#/workspace/monitoring'); @@ -100,14 +104,14 @@ test('Save as template', async ({page}) => { await monitoring.createArticleFromTemplate('story 2', {slugline: 'article 1'}); - await monitoring.executeActionInEditor( + await authoring.executeActionInEditor( 'Save as template', ); await page.locator(s('modal-save-as-template', 'name-input')).fill('story 2.1'); - await page.locator(s('modal-save-as-template', 'select-desk')).selectOption({label: 'Sports'}); + await page.locator(s('modal-save-as-template')).getByLabel('Desk').selectOption({label: 'Sports'}); await page.locator(s('modal-save-as-template')).getByRole('button', {name: 'Save'}).click(); await page.goto('/#/settings/templates'); - await expect(page.locator(s('template-content', 'content-template--story 2.1'))).toBeVisible(); + await expect(page.locator(s('template-content', 'content-template=story 2.1'))).toBeVisible(); }); diff --git a/e2e/client/specs/monitoring_spec.ts b/e2e/client/specs/monitoring_spec.ts index 0fa40b84cb..cea1f00538 100644 --- a/e2e/client/specs/monitoring_spec.ts +++ b/e2e/client/specs/monitoring_spec.ts @@ -1089,8 +1089,11 @@ xdescribe('marked for me filter in monitoring', () => { nav('/settings/templates'); - el(['content-template--testing', 'template-actions']).click(); - el(['content-template--testing', 'template-actions--options'], by.buttonText('Edit')).click(); + element( + by.css('[data-test-id="content-template"][data-test-value="testing"] [data-test-id="template-actions"]'), + ).click(); + // eslint-disable-next-line + element(by.css('[data-test-id="content-template"][data-test-value="testing"] [data-test-id="template-actions--options"]')).element(by.buttonText('Edit')).click(); browser.sleep(1000); el(['template-edit-view', 'desks', 'desk--Multiple sources']).click(); diff --git a/package-lock.json b/package-lock.json index f4e8d861df..1f2d1b2f98 100644 --- a/package-lock.json +++ b/package-lock.json @@ -80,62 +80,6 @@ } } }, - "@material-ui/lab": { - "version": "4.0.0-alpha.61", - "resolved": "https://registry.npmjs.org/@material-ui/lab/-/lab-4.0.0-alpha.61.tgz", - "integrity": "sha512-rSzm+XKiNUjKegj8bzt5+pygZeckNLOr+IjykH8sYdVk7dE9y2ZuUSofiMV2bJk3qU+JHwexmw+q0RyNZB9ugg==", - "requires": { - "@babel/runtime": "^7.4.4", - "@material-ui/utils": "^4.11.3", - "clsx": "^1.0.4", - "prop-types": "^15.7.2", - "react-is": "^16.8.0 || ^17.0.0" - }, - "dependencies": { - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==" - }, - "prop-types": { - "version": "15.8.1", - "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", - "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", - "requires": { - "loose-envify": "^1.4.0", - "object-assign": "^4.1.1", - "react-is": "^16.13.1" - } - } - } - }, - "@material-ui/utils": { - "version": "4.11.3", - "resolved": "https://registry.npmjs.org/@material-ui/utils/-/utils-4.11.3.tgz", - "integrity": "sha512-ZuQPV4rBK/V1j2dIkSSEcH5uT6AaHuKWFfotADHsC0wVL1NLd2WkFCm4ZZbX33iO4ydl6V0GPngKm8HZQ2oujg==", - "requires": { - "@babel/runtime": "^7.4.4", - "prop-types": "^15.7.2", - "react-is": "^16.8.0 || ^17.0.0" - }, - "dependencies": { - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==" - }, - "prop-types": { - "version": "15.8.1", - "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", - "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", - "requires": { - "loose-envify": "^1.4.0", - "object-assign": "^4.1.1", - "react-is": "^16.13.1" - } - } - } - }, "@metadata/exif": { "version": "github:superdesk/exif#431066d5930de646ceb96e48b57eaf76b0144223", "from": "github:superdesk/exif#431066d" @@ -563,7 +507,7 @@ "dependencies": { "date-fns": { "version": "2.7.0", - "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.7.0.tgz", + "resolved": "https://verdaccio.sourcefabric.org/date-fns/-/date-fns-2.7.0.tgz", "integrity": "sha512-wxYp2PGoUDN5ZEACc61aOtYFvSsJUylIvCjpjDOqM1UDaKIIuMJ9fAnMYFHV3TQaDpfTVxhwNK/GiCaHKuemTA==" } } @@ -879,7 +823,7 @@ }, "@typescript-eslint/parser": { "version": "5.57.0", - "resolved": "https://verdaccio.sourcefabric.org/@typescript-eslint/parser/-/parser-5.57.0.tgz", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.57.0.tgz", "integrity": "sha512-orrduvpWYkgLCyAdNtR1QIWovcNZlEm6yL8nwH/eTxWLd8gsP+25pdLHYzL2QdkqrieaDwLpytHqycncv0woUQ==", "requires": { "@typescript-eslint/scope-manager": "5.57.0", @@ -890,7 +834,7 @@ "dependencies": { "debug": { "version": "4.3.4", - "resolved": "https://verdaccio.sourcefabric.org/debug/-/debug-4.3.4.tgz", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "requires": { "ms": "2.1.2" @@ -1384,7 +1328,7 @@ "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==" }, "prop-types": { "version": "15.8.1", @@ -3425,11 +3369,6 @@ "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-0.0.1.tgz", "integrity": "sha512-dhUqc57gSMCo6TX85FLfe51eC/s+Im2MLkAgJwfaRRexR2tA4dd3eLEW4L6efzHc2iNorrRRXITifnDLlRrhaA==" }, - "clsx": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/clsx/-/clsx-1.2.1.tgz", - "integrity": "sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg==" - }, "co": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", @@ -10219,7 +10158,7 @@ "jsesc": { "version": "0.5.0", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", - "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=" + "integrity": "sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA==" }, "json-loader": { "version": "0.5.7", @@ -14224,7 +14163,7 @@ "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==" + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" } } }, @@ -14620,11 +14559,6 @@ } } }, - "react-fast-compare": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/react-fast-compare/-/react-fast-compare-3.2.2.tgz", - "integrity": "sha512-nsO+KSNgo1SbJqJEYRE9ERzo7YtYbou/OqjSQKxV7jcKox7+usiUVZOAC+XnDOABXggQTno0Y1CpVnuWEc1boQ==" - }, "react-id-generator": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/react-id-generator/-/react-id-generator-3.0.2.tgz", @@ -14677,25 +14611,6 @@ "prop-types": "^15.6.1" } }, - "react-popper": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/react-popper/-/react-popper-2.3.0.tgz", - "integrity": "sha512-e1hj8lL3uM+sgSR4Lxzn5h1GxBlpa4CQz0XLF8kx4MDrDRWY0Ena4c97PUeSX9i5W3UAfDP0z0FXCTQkoXUl3Q==", - "requires": { - "react-fast-compare": "^3.0.1", - "warning": "^4.0.2" - }, - "dependencies": { - "warning": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/warning/-/warning-4.0.3.tgz", - "integrity": "sha512-rpJyN222KWIvHJ/F53XSZv0Zl/accqHR8et1kpaMTD/fLCRxtV8iX8czMzY7sVZupTI3zcUTg8eycS2kNF9l6w==", - "requires": { - "loose-envify": "^1.0.0" - } - } - } - }, "react-portal": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/react-portal/-/react-portal-4.1.3.tgz", @@ -14775,7 +14690,7 @@ "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==" }, "prop-types": { "version": "15.7.2", @@ -15067,7 +14982,7 @@ "regexpu-core": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-1.0.0.tgz", - "integrity": "sha1-hqdj9Y7k18L2sQLkdkBQ3n7ZDGs=", + "integrity": "sha512-Ci+lDRlvAElKjFp5keqmVUaJLqZiHywekXhshT6wVUyDObGPdymNPhxBmf38ZVsaUGOnZ3Fot9YzxvoI31ymYw==", "requires": { "regenerate": "^1.2.1", "regjsgen": "^0.2.0", @@ -15077,12 +14992,12 @@ "regjsgen": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz", - "integrity": "sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc=" + "integrity": "sha512-x+Y3yA24uF68m5GA+tBjbGYo64xXVJpbToBaWCoSNSc1hdk6dfctaRWrNFTVJZIIhL5GxW8zwjoixbnifnK59g==" }, "regjsparser": { "version": "0.1.5", "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz", - "integrity": "sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw=", + "integrity": "sha512-jlQ9gYLfk2p3V5Ag5fYhA7fv7OHzd1KUH0PRP46xc3TgwjwgROIW572AfYg/X9kaNq/LJnu6oJcFRXlIrGoTRw==", "requires": { "jsesc": "~0.5.0" } @@ -17333,11 +17248,10 @@ } }, "superdesk-ui-framework": { - "version": "3.0.74", - "resolved": "https://registry.npmjs.org/superdesk-ui-framework/-/superdesk-ui-framework-3.0.74.tgz", - "integrity": "sha512-p85JZoJUZWkzI/r58gzd7NI7T+iCJ0RYd7fIvVSrrA2gCEglTCEa1lu00z1odmpEJg7ev6YYh3DdWM7ELRQWtA==", + "version": "3.0.77", + "resolved": "https://registry.npmjs.org/superdesk-ui-framework/-/superdesk-ui-framework-3.0.77.tgz", + "integrity": "sha512-o1+OJ7HG2TRqLiZY2rds3IdsWg1DvVhSuoisJ47LtuGIRS8PXGYNcSUr/5nqz/k1oba7iRXYcF+bv3v3wy4wIA==", "requires": { - "@material-ui/lab": "^4.0.0-alpha.56", "@popperjs/core": "^2.4.0", "@superdesk/primereact": "^5.0.2-12", "@superdesk/react-resizable-panels": "0.0.39", @@ -17353,7 +17267,6 @@ "primeicons": "2.0.0", "react-beautiful-dnd": "^13.0.0", "react-id-generator": "^3.0.0", - "react-popper": "^2.2.3", "react-scrollspy": "^3.4.3" }, "dependencies": { diff --git a/package.json b/package.json index 43065383d1..1ae7974877 100644 --- a/package.json +++ b/package.json @@ -122,7 +122,7 @@ "sass-loader": "6.0.6", "shortid": "2.2.8", "style-loader": "0.20.2", - "superdesk-ui-framework": "^3.0.74", + "superdesk-ui-framework": "^3.0.77", "ts-loader": "3.5.0", "typescript": "4.9.5", "uuid": "8.3.1", diff --git a/scripts/apps/desks/views/settings.html b/scripts/apps/desks/views/settings.html index 817ce7411a..77ab3380fa 100644 --- a/scripts/apps/desks/views/settings.html +++ b/scripts/apps/desks/views/settings.html @@ -25,7 +25,7 @@

Desk management

-