diff --git a/e2e/playwright/actions/src/tests/create-folder-from-template.spec.ts b/e2e/playwright/actions/src/tests/create-folder-from-template.spec.ts index 5982124ea2..67c792f948 100644 --- a/e2e/playwright/actions/src/tests/create-folder-from-template.spec.ts +++ b/e2e/playwright/actions/src/tests/create-folder-from-template.spec.ts @@ -49,8 +49,6 @@ test.describe('Create folder from template', () => { let folderId: string; const selectDialogTitle = 'Select a folder template'; const dialogBreadcrumb = 'Space Templates'; - const cancelButton = 'CANCEL'; - const createButton = 'Create'; const nameLabel = 'Name *'; const titleLabel = 'Title'; const descriptionLabel = 'Description'; @@ -61,21 +59,21 @@ test.describe('Create folder from template', () => { const commandKey = 'Meta'; const random = Utils.random(); - const fileInRootFolder = `afile-in-root-${random}.txt`; - const folderInRootFolder = `afolder-in-root-${random}`; + const fileInRootFolder = `file-in-root-${random}.txt`; + const folderInRootFolder = `folder-in-root-${random}`; - const templateFolder1 = `aatemplate-folder1-${random}`; - const fileInFolder1 = `aafile-1-${random}.txt`; - const templateSubFolder = `atemplate-sub-folder-${random}`; + const templateFolder1 = `template-folder1-${random}`; + const fileInFolder1 = `file-1-${random}.txt`; + const templateSubFolder = `template-sub-folder-${random}`; - const templateFolder2 = `atemplate-folder2-${random}`; - const fileInFolder2 = `afile-2-${random}.txt`; + const templateFolder2 = `template-folder2-${random}`; + const fileInFolder2 = `file-2-${random}.txt`; - const restrictedTemplateFolder = `arestricted-folder-${random}`; - const fileInRestrictedFolder = `arestricted-file-${random}.txt`; + const restrictedTemplateFolder = `restricted-folder-${random}`; + const fileInRestrictedFolder = `restricted-file-${random}.txt`; const createDialogTitle = `Create new folder from '${templateFolder1}'`; - const commonFolderName = `aplaywright-folder-${Utils.random()}`; + const commonFolderName = `playwright-folder-${Utils.random()}`; const templates: NodeContentTree = { folders: [ @@ -128,7 +126,7 @@ test.describe('Create folder from template', () => { selectFolderTemplateDialog = personalFiles.contentNodeSelector; dataTable = personalFiles.dataTable; toolbar = personalFiles.acaHeader; - await toolbar.selectCreateFolderFromTemplate(); + await toolbar.clickCreateFolderFromTemplate(); }); test.describe('Select Template dialog', () => { @@ -224,8 +222,8 @@ test.describe('Create folder from template', () => { await expect.soft(createFolderFromTemplateDialog.getDialogLabel(titleLabel)).toHaveValue(emptyString); await expect.soft(createFolderFromTemplateDialog.getDialogLabel(descriptionLabel)).toBeVisible(); await expect.soft(createFolderFromTemplateDialog.getDialogLabel(descriptionLabel)).toHaveValue(emptyString); - await expect.soft(createFolderFromTemplateDialog.actionButton(cancelButton)).toBeEnabled(); - await expect(createFolderFromTemplateDialog.actionButton(createButton)).toBeEnabled(); + await expect.soft(createFolderFromTemplateDialog.cancelButton).toBeEnabled(); + await expect(createFolderFromTemplateDialog.createButton).toBeEnabled(); }); test('[C325143] Folder name is required', async () => { @@ -237,7 +235,7 @@ test.describe('Create folder from template', () => { expect .soft(await createFolderFromTemplateDialog.isErrorMessageDisplayed(errorStrings.nameIsRequiredError), errorStrings.errorMessageNotPresent) .toBe(true); - await expect(createFolderFromTemplateDialog.actionButton(createButton)).toBeDisabled(); + await expect(createFolderFromTemplateDialog.createButton).toBeDisabled(); }); test('[C325144] Special characters in folder name', async () => { @@ -253,7 +251,7 @@ test.describe('Create folder from template', () => { errorStrings.errorMessageNotPresent ) .toBe(true); - await expect(createFolderFromTemplateDialog.actionButton(createButton)).toBeDisabled(); + await expect(createFolderFromTemplateDialog.createButton).toBeDisabled(); } }); @@ -264,7 +262,7 @@ test.describe('Create folder from template', () => { expect .soft(await createFolderFromTemplateDialog.isErrorMessageDisplayed(errorStrings.nameEndWithDotError), errorStrings.errorMessageNotPresent) .toBe(true); - await expect(createFolderFromTemplateDialog.actionButton(createButton)).toBeDisabled(); + await expect(createFolderFromTemplateDialog.createButton).toBeDisabled(); }); test('[C325146] Folder name containing only spaces', async () => { @@ -278,7 +276,7 @@ test.describe('Create folder from template', () => { errorStrings.errorMessageNotPresent ) .toBe(true); - await expect(createFolderFromTemplateDialog.actionButton(createButton)).toBeDisabled(); + await expect(createFolderFromTemplateDialog.createButton).toBeDisabled(); }); test('[C325141] Title too long', async () => { @@ -288,7 +286,7 @@ test.describe('Create folder from template', () => { expect .soft(await createFolderFromTemplateDialog.isErrorMessageDisplayed(errorStrings.titleLengthLimitError), errorStrings.errorMessageNotPresent) .toBe(true); - await expect(createFolderFromTemplateDialog.actionButton(createButton)).toBeDisabled(); + await expect(createFolderFromTemplateDialog.createButton).toBeDisabled(); }); test('[C325140] Description too long', async () => { @@ -301,7 +299,7 @@ test.describe('Create folder from template', () => { errorStrings.errorMessageNotPresent ) .toBe(true); - await expect(createFolderFromTemplateDialog.actionButton(createButton)).toBeDisabled(); + await expect(createFolderFromTemplateDialog.createButton).toBeDisabled(); }); test('[C325156] Create a folder with a duplicate name', async ({ personalFiles }) => { @@ -314,14 +312,14 @@ test.describe('Create folder from template', () => { test('[C325155] Cancel folder creation', async () => { await expect(createFolderFromTemplateDialog.getDialogTitle(createDialogTitle)).toBeVisible(); - await createFolderFromTemplateDialog.actionButton(cancelButton).click(); + await createFolderFromTemplateDialog.cancelButton.click(); await expect(createFolderFromTemplateDialog.getDialogTitle(createDialogTitle)).not.toBeVisible(); }); }); test.describe('Folder created from template on Personal Files', () => { test.beforeEach(async ({ personalFiles }) => { - randomFolderName = `aplaywright-folder-${Utils.random()}`; + randomFolderName = `playwright-folder-${Utils.random()}`; randomFolderTitle = `folder-title-${Utils.random()}`; randomFolderDescription = `folder-description-${Utils.random()}`; createFolderFromTemplateDialog = personalFiles.createFromTemplateDialogComponent; @@ -360,7 +358,7 @@ test.describe('Create folder from template', () => { }); test.describe('Folder created from template on Personal Files Libraries', () => { - const randomLibraryName = `aplaywright-library-${Utils.random()}`; + const randomLibraryName = `playwright-library-${Utils.random()}`; test.beforeAll(async ({ sitesApiAction, nodesApiAction }) => { await sitesApiAction.createSite(randomLibraryName); @@ -369,7 +367,7 @@ test.describe('Create folder from template', () => { }); test.beforeEach(async ({ myLibrariesPage }) => { - randomFolderName = `aplaywright-folder-${Utils.random()}`; + randomFolderName = `playwright-folder-${Utils.random()}`; randomFolderTitle = `folder-title-${Utils.random()}`; randomFolderDescription = `folder-description-${Utils.random()}`; await myLibrariesPage.navigate(); @@ -380,7 +378,7 @@ test.describe('Create folder from template', () => { await dataTable.goThroughPagesLookingForRowWithName(randomLibraryName); await dataTable.getRowByName(randomLibraryName).dblclick(); await dataTable.spinnerWaitForReload(); - await toolbar.selectCreateFolderFromTemplate(); + await toolbar.clickCreateFolderFromTemplate(); await dataTable.getRowByName(templateFolder1).click(); await selectFolderTemplateDialog.actionButton.click(); }); @@ -402,7 +400,7 @@ test.describe('Create folder from template', () => { test('[C325162] Cancel folder creation in a library', async () => { await expect(createFolderFromTemplateDialog.getDialogTitle(createDialogTitle)).toBeVisible(); - await createFolderFromTemplateDialog.actionButton(cancelButton).click(); + await createFolderFromTemplateDialog.cancelButton.click(); await expect(createFolderFromTemplateDialog.getDialogTitle(createDialogTitle)).not.toBeVisible(); await expect(dataTable.getRowByName(randomFolderName)).not.toBeVisible(); }); diff --git a/projects/aca-content/src/lib/dialogs/node-template/create-from-template.dialog.html b/projects/aca-content/src/lib/dialogs/node-template/create-from-template.dialog.html index 993f504035..f05cda4add 100644 --- a/projects/aca-content/src/lib/dialogs/node-template/create-from-template.dialog.html +++ b/projects/aca-content/src/lib/dialogs/node-template/create-from-template.dialog.html @@ -42,7 +42,7 @@

- diff --git a/projects/aca-playwright-shared/src/page-objects/components/aca-header.component.ts b/projects/aca-playwright-shared/src/page-objects/components/aca-header.component.ts index e330087f0e..bb2fe77b77 100644 --- a/projects/aca-playwright-shared/src/page-objects/components/aca-header.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/aca-header.component.ts @@ -22,9 +22,8 @@ * from Hyland Software. If not, see . */ -import { MatMenuComponent } from '.'; -import { BaseComponent } from './base.component'; import { Page } from '@playwright/test'; +import { BaseComponent, MatMenuComponent } from './'; export class AcaHeader extends BaseComponent { private static rootElement = 'aca-toolbar'; private moreActionsButton = this.getChild('button[id="app.viewer.toolbar.more"]'); @@ -46,7 +45,7 @@ export class AcaHeader extends BaseComponent { await this.moreActionsButton.click(); } - async selectCreateFolderFromTemplate(): Promise { + async clickCreateFolderFromTemplate(): Promise { await this.createButton.click(); await this.matMenu.createFolderFromTemplate.click(); } diff --git a/projects/aca-playwright-shared/src/page-objects/components/base.component.ts b/projects/aca-playwright-shared/src/page-objects/components/base.component.ts index 11910754b1..4b16fe012d 100644 --- a/projects/aca-playwright-shared/src/page-objects/components/base.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/base.component.ts @@ -56,7 +56,7 @@ export abstract class BaseComponent extends PlaywrightBase { async spinnerWaitForReload(): Promise { try { - await this.page.locator('mat-progress-spinner').waitFor({ state: 'attached', timeout: timeouts.normal }); + await this.page.locator('mat-progress-spinner').waitFor({ state: 'attached', timeout: timeouts.medium }); await this.page.locator('mat-progress-spinner').waitFor({ state: 'detached', timeout: timeouts.normal }); } catch (e) { this.logger.info('Spinner was not present'); diff --git a/projects/aca-playwright-shared/src/page-objects/components/dialogs/create-from-template-dialog-component.ts b/projects/aca-playwright-shared/src/page-objects/components/dialogs/create-from-template-dialog-component.ts index 4f4fa3d44c..f92df80493 100644 --- a/projects/aca-playwright-shared/src/page-objects/components/dialogs/create-from-template-dialog-component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/dialogs/create-from-template-dialog-component.ts @@ -33,7 +33,8 @@ export class CreateFromTemplateDialogComponent extends BaseComponent { super(page, CreateFromTemplateDialogComponent.rootElement); } - public actionButton = (text: string) => this.getChild('.mat-button .mat-button-wrapper', { hasText: text }); + cancelButton = this.getChild('[data-automation-id="cancel-folder-template-button"]'); + createButton = this.getChild('[data-automation-id="create-folder-template-button"]'); getDialogTitle = (text: string) => this.getChild('.mat-dialog-title', { hasText: text }); getDialogLabel = (text: string) => this.getChild('label', { hasText: text }); getErrorByText = (text: string): Locator => this.page.locator('mat-error', {hasText: text}); @@ -51,6 +52,6 @@ export class CreateFromTemplateDialogComponent extends BaseComponent { await this.getDialogLabel('Name *').fill(nameInput); if (titleInput) { await this.getDialogLabel('Title').fill(titleInput); } if (descriptionInput) { await this.getDialogLabel('Description').fill(descriptionInput); } - await this.actionButton('Create').click(); + await this.createButton.click(); } }