mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACS-7575] create library dialog e2e fix (#3803)
This commit is contained in:
committed by
GitHub
parent
95fde425d8
commit
f11ce49ba3
@@ -49,9 +49,7 @@ test.describe('Create Libraries ', () => {
|
|||||||
let randomLibraryId: string;
|
let randomLibraryId: string;
|
||||||
let randomLibraryDescription: string;
|
let randomLibraryDescription: string;
|
||||||
const libraryDialogTitle = 'Create Library';
|
const libraryDialogTitle = 'Create Library';
|
||||||
// TODO [ACS-7575] add '*' after it is added to the placeholder/label in ADF
|
|
||||||
const libraryNameLabel = 'Name';
|
const libraryNameLabel = 'Name';
|
||||||
// TODO [ACS-7575] add '*' after it is added to the placeholder/label in ADF
|
|
||||||
const libraryIdLabel = 'Library ID';
|
const libraryIdLabel = 'Library ID';
|
||||||
const libraryDescriptionLabel = 'Description';
|
const libraryDescriptionLabel = 'Description';
|
||||||
const publicVisibility = 'Public';
|
const publicVisibility = 'Public';
|
||||||
@@ -97,9 +95,9 @@ test.describe('Create Libraries ', () => {
|
|||||||
|
|
||||||
test('[C280024] Create Library dialog UI', async () => {
|
test('[C280024] Create Library dialog UI', async () => {
|
||||||
await expect(libraryDialog.getDialogTitle(libraryDialogTitle)).toBeVisible();
|
await expect(libraryDialog.getDialogTitle(libraryDialogTitle)).toBeVisible();
|
||||||
await expect(libraryDialog.getElementByPlaceholder(libraryNameLabel)).toBeVisible();
|
await expect(libraryDialog.getLabelText(libraryNameLabel)).toBeVisible();
|
||||||
await expect(libraryDialog.getElementByPlaceholder(libraryIdLabel)).toBeVisible();
|
await expect(libraryDialog.getLabelText(libraryIdLabel)).toBeVisible();
|
||||||
await expect(libraryDialog.getElementByPlaceholder(libraryDescriptionLabel)).toBeVisible();
|
await expect(libraryDialog.getLabelText(libraryDescriptionLabel)).toBeVisible();
|
||||||
await expect(libraryDialog.getLabelText(publicVisibility)).toBeVisible();
|
await expect(libraryDialog.getLabelText(publicVisibility)).toBeVisible();
|
||||||
await expect(libraryDialog.getLabelText(publicVisibility)).toBeChecked();
|
await expect(libraryDialog.getLabelText(publicVisibility)).toBeChecked();
|
||||||
await expect(libraryDialog.getLabelText(privateVisibility)).toBeVisible();
|
await expect(libraryDialog.getLabelText(privateVisibility)).toBeVisible();
|
||||||
@@ -115,9 +113,9 @@ test.describe('Create Libraries ', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('[C280025] Create a public library', async ({ myLibrariesPage }) => {
|
test('[C280025] Create a public library', async ({ myLibrariesPage }) => {
|
||||||
await libraryDialog.getElementByPlaceholder(libraryNameLabel).fill(randomLibraryName);
|
await libraryDialog.getLabelText(libraryNameLabel).fill(randomLibraryName);
|
||||||
await expect(libraryDialog.getElementByPlaceholder(libraryNameLabel)).toHaveValue(randomLibraryName);
|
await expect(libraryDialog.getLabelText(libraryNameLabel)).toHaveValue(randomLibraryName);
|
||||||
await expect(libraryDialog.getElementByPlaceholder(libraryIdLabel)).toHaveValue(randomLibraryName);
|
await expect(libraryDialog.getLabelText(libraryIdLabel)).toHaveValue(randomLibraryName);
|
||||||
await libraryDialog.createButton.click();
|
await libraryDialog.createButton.click();
|
||||||
await expect(libraryBreadcrumb.getItemByTitle(randomLibraryName)).toBeVisible();
|
await expect(libraryBreadcrumb.getItemByTitle(randomLibraryName)).toBeVisible();
|
||||||
|
|
||||||
@@ -169,7 +167,7 @@ test.describe('Create Libraries ', () => {
|
|||||||
|
|
||||||
test('[C280029] Cancel button', async () => {
|
test('[C280029] Cancel button', async () => {
|
||||||
await expect(libraryDialog.getDialogTitle(libraryDialogTitle)).toBeVisible();
|
await expect(libraryDialog.getDialogTitle(libraryDialogTitle)).toBeVisible();
|
||||||
await libraryDialog.getElementByPlaceholder(libraryNameLabel).fill(randomLibraryName);
|
await libraryDialog.getLabelText(libraryNameLabel).fill(randomLibraryName);
|
||||||
await libraryDialog.cancelButton.click();
|
await libraryDialog.cancelButton.click();
|
||||||
|
|
||||||
await expect(libraryDialog.getDialogTitle(libraryDialogTitle)).toBeHidden();
|
await expect(libraryDialog.getDialogTitle(libraryDialogTitle)).toBeHidden();
|
||||||
@@ -212,33 +210,33 @@ test.describe('Create Libraries ', () => {
|
|||||||
'a|a'
|
'a|a'
|
||||||
];
|
];
|
||||||
|
|
||||||
await libraryDialog.getElementByPlaceholder(libraryNameLabel).fill(randomLibraryName);
|
await libraryDialog.getLabelText(libraryNameLabel).fill(randomLibraryName);
|
||||||
|
|
||||||
for (const specialLibraryId of idsWithSpecialChars) {
|
for (const specialLibraryId of idsWithSpecialChars) {
|
||||||
await libraryDialog.getElementByPlaceholder(libraryIdLabel).clear();
|
await libraryDialog.getLabelText(libraryIdLabel).clear();
|
||||||
await libraryDialog.getElementByPlaceholder(libraryIdLabel).fill(specialLibraryId);
|
await libraryDialog.getLabelText(libraryIdLabel).fill(specialLibraryId);
|
||||||
await libraryDialog.page.keyboard.press(tabKeyString);
|
await libraryDialog.page.keyboard.press(tabKeyString);
|
||||||
await expect(libraryDialog.getElementByPlaceholder(libraryIdLabel)).toHaveValue(specialLibraryId);
|
await expect(libraryDialog.getLabelText(libraryIdLabel)).toHaveValue(specialLibraryId);
|
||||||
expect(await libraryDialog.isErrorMessageDisplayed(libraryErrors.useNumbersAndLettersOnly), errorMessageNotPresent).toBe(true);
|
expect(await libraryDialog.isErrorMessageDisplayed(libraryErrors.useNumbersAndLettersOnly), errorMessageNotPresent).toBe(true);
|
||||||
await expect(libraryDialog.createButton).toBeDisabled();
|
await expect(libraryDialog.createButton).toBeDisabled();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
test('[C280027] Duplicate library ID', async () => {
|
test('[C280027] Duplicate library ID', async () => {
|
||||||
await libraryDialog.getElementByPlaceholder(libraryNameLabel).fill(randomLibraryName);
|
await libraryDialog.getLabelText(libraryNameLabel).fill(randomLibraryName);
|
||||||
await libraryDialog.getElementByPlaceholder(libraryIdLabel).clear();
|
await libraryDialog.getLabelText(libraryIdLabel).clear();
|
||||||
await libraryDialog.getElementByPlaceholder(libraryIdLabel).fill(commonLibraryName);
|
await libraryDialog.getLabelText(libraryIdLabel).fill(commonLibraryName);
|
||||||
await libraryDialog.page.keyboard.press(tabKeyString);
|
await libraryDialog.page.keyboard.press(tabKeyString);
|
||||||
await expect(libraryDialog.getElementByPlaceholder(libraryIdLabel)).toHaveValue(commonLibraryName);
|
await expect(libraryDialog.getLabelText(libraryIdLabel)).toHaveValue(commonLibraryName);
|
||||||
|
|
||||||
await expect(libraryDialog.createButton).toBeDisabled();
|
await expect(libraryDialog.createButton).toBeDisabled();
|
||||||
expect(await libraryDialog.isErrorMessageDisplayed(libraryErrors.libraryIdIsNotAvailable), errorMessageNotPresent).toBe(true);
|
expect(await libraryDialog.isErrorMessageDisplayed(libraryErrors.libraryIdIsNotAvailable), errorMessageNotPresent).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('[C280028] Create library using the ID of a library from the Trashcan', async () => {
|
test('[C280028] Create library using the ID of a library from the Trashcan', async () => {
|
||||||
await libraryDialog.getElementByPlaceholder(libraryNameLabel).fill(randomLibraryName);
|
await libraryDialog.getLabelText(libraryNameLabel).fill(randomLibraryName);
|
||||||
await libraryDialog.getElementByPlaceholder(libraryIdLabel).clear();
|
await libraryDialog.getLabelText(libraryIdLabel).clear();
|
||||||
await libraryDialog.getElementByPlaceholder(libraryIdLabel).fill(commonTrashLibraryName);
|
await libraryDialog.getLabelText(libraryIdLabel).fill(commonTrashLibraryName);
|
||||||
await libraryDialog.page.keyboard.press(tabKeyString);
|
await libraryDialog.page.keyboard.press(tabKeyString);
|
||||||
|
|
||||||
await expect(libraryDialog.createButton).toBeEnabled();
|
await expect(libraryDialog.createButton).toBeEnabled();
|
||||||
|
@@ -37,7 +37,6 @@ export class AdfLibraryDialogComponent extends BaseComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public getLabelText = (text: string) => this.getChild('label', { hasText: text });
|
public getLabelText = (text: string) => this.getChild('label', { hasText: text });
|
||||||
public getElementByPlaceholder = (text: string) => this.page.getByPlaceholder(text);
|
|
||||||
public getDialogTitle = (text: string) => this.getChild('.mat-mdc-dialog-title', { hasText: text });
|
public getDialogTitle = (text: string) => this.getChild('.mat-mdc-dialog-title', { hasText: text });
|
||||||
public getErrorByText = (text: string): Locator => this.page.locator('mat-error', {hasText: text});
|
public getErrorByText = (text: string): Locator => this.page.locator('mat-error', {hasText: text});
|
||||||
|
|
||||||
@@ -50,13 +49,10 @@ export class AdfLibraryDialogComponent extends BaseComponent {
|
|||||||
* @param visibility visibility of the library
|
* @param visibility visibility of the library
|
||||||
*/
|
*/
|
||||||
async createLibraryWithNameAndId(nameInput: string, libraryIdInput: string, descriptionInput?: string, visibility?: string): Promise<void> {
|
async createLibraryWithNameAndId(nameInput: string, libraryIdInput: string, descriptionInput?: string, visibility?: string): Promise<void> {
|
||||||
// TODO [ACS-7575] add '*' after it is added to the placeholder/label in ADF
|
await this.getLabelText('Name').fill(nameInput);
|
||||||
await this.getElementByPlaceholder('Name').fill(nameInput);
|
await this.getLabelText('Library ID').clear();
|
||||||
// TODO [ACS-7575] add '*' after it is added to the placeholder/label in ADF
|
await this.getLabelText('Library ID').fill(libraryIdInput);
|
||||||
await this.getElementByPlaceholder('Library ID').clear();
|
if (descriptionInput) { await this.getLabelText('Description').fill(descriptionInput); }
|
||||||
// TODO [ACS-7575] add '*' after it is added to the placeholder/label in ADF
|
|
||||||
await this.getElementByPlaceholder('Library ID').fill(libraryIdInput);
|
|
||||||
if (descriptionInput) { await this.getElementByPlaceholder('Description').fill(descriptionInput); }
|
|
||||||
if (visibility) { await this.getLabelText(visibility).click(); }
|
if (visibility) { await this.getLabelText(visibility).click(); }
|
||||||
await this.createButton.click();
|
await this.createButton.click();
|
||||||
await this.spinnerWaitForReload();
|
await this.spinnerWaitForReload();
|
||||||
|
Reference in New Issue
Block a user