[ACS-7369] ng15 migration - fix e2es (#3796)

* [ACS-7369] e2e fixes

* [ACS-7369] cr fix
This commit is contained in:
Mykyta Maliarchuk
2024-04-17 10:28:44 +02:00
committed by GitHub
parent b63e8925d4
commit 01ca830dfc
12 changed files with 70 additions and 64 deletions

View File

@@ -78,12 +78,12 @@ test.describe('Create folders', () => {
});
test('[C216345] Create new folder dialog check', async () => {
await expect(folderDialog.getLabelText('Name')).toBeVisible();
await expect(folderDialog.getLabelText('*')).toBeVisible();
// TODO [ACS-7534] add * after it is added to adf placeholder/label
await expect(folderDialog.getElementByPlaceholder('input', 'Name')).toBeVisible();
await expect(folderDialog.folderNameInputLocator).toBeVisible();
await expect(folderDialog.getLabelText('Title')).toBeVisible();
await expect(folderDialog.getElementByPlaceholder('input', 'Title')).toBeVisible();
await expect(folderDialog.folderTitleInput).toBeVisible();
await expect(folderDialog.getLabelText('Description')).toBeVisible();
await expect(folderDialog.getElementByPlaceholder('textarea', 'Description')).toBeVisible();
await expect(folderDialog.folderDescriptionInput).toBeVisible();
await expect(folderDialog.cancelButton).toBeEnabled();
await expect(folderDialog.createButton).toBeDisabled();

View File

@@ -49,8 +49,10 @@ test.describe('Create Libraries ', () => {
let randomLibraryId: string;
let randomLibraryDescription: string;
const libraryDialogTitle = 'Create Library';
const libraryNameLabel = 'Name *';
const libraryIdLabel = 'Library ID *';
// TODO [ACS-7575] add '*' after it is added to the placeholder/label in ADF
const libraryNameLabel = 'Name';
// TODO [ACS-7575] add '*' after it is added to the placeholder/label in ADF
const libraryIdLabel = 'Library ID';
const libraryDescriptionLabel = 'Description';
const publicVisibility = 'Public';
const moderatedVisibility = 'Moderated';
@@ -95,9 +97,9 @@ test.describe('Create Libraries ', () => {
test('[C280024] Create Library dialog UI', async () => {
await expect(libraryDialog.getDialogTitle(libraryDialogTitle)).toBeVisible();
await expect(libraryDialog.getLabelText(libraryNameLabel)).toBeVisible();
await expect(libraryDialog.getLabelText(libraryIdLabel)).toBeVisible();
await expect(libraryDialog.getLabelText(libraryDescriptionLabel)).toBeVisible();
await expect(libraryDialog.getElementByPlaceholder(libraryNameLabel)).toBeVisible();
await expect(libraryDialog.getElementByPlaceholder(libraryIdLabel)).toBeVisible();
await expect(libraryDialog.getElementByPlaceholder(libraryDescriptionLabel)).toBeVisible();
await expect(libraryDialog.getLabelText(publicVisibility)).toBeVisible();
await expect(libraryDialog.getLabelText(publicVisibility)).toBeChecked();
await expect(libraryDialog.getLabelText(privateVisibility)).toBeVisible();
@@ -113,9 +115,9 @@ test.describe('Create Libraries ', () => {
});
test('[C280025] Create a public library', async ({ myLibrariesPage }) => {
await libraryDialog.getLabelText(libraryNameLabel).fill(randomLibraryName);
await expect(libraryDialog.getLabelText(libraryNameLabel)).toHaveValue(randomLibraryName);
await expect(libraryDialog.getLabelText(libraryIdLabel)).toHaveValue(randomLibraryName);
await libraryDialog.getElementByPlaceholder(libraryNameLabel).fill(randomLibraryName);
await expect(libraryDialog.getElementByPlaceholder(libraryNameLabel)).toHaveValue(randomLibraryName);
await expect(libraryDialog.getElementByPlaceholder(libraryIdLabel)).toHaveValue(randomLibraryName);
await libraryDialog.createButton.click();
await expect(libraryBreadcrumb.getItemByTitle(randomLibraryName)).toBeVisible();
@@ -157,17 +159,17 @@ test.describe('Create Libraries ', () => {
await expect(libraryTable.getCellLinkByName(randomLibraryName).and(myLibrariesPage.page.getByTitle(randomLibraryDescription))).toBeVisible();
await libraryTable.getRowByName(randomLibraryName).click();
await libraryViewDetails.click();
await expect(libraryDetails.getNameField('Name').locator('input')).toHaveValue(randomLibraryName);
await expect(libraryDetails.getIdField('Library ID').locator('input')).toHaveValue(randomLibraryId);
await expect(libraryDetails.getVisibilityField('Visibility').getByText(publicVisibility)).toBeVisible();
await expect(libraryDetails.getDescriptionField).toHaveValue(randomLibraryDescription);
expect(await libraryDetails.getNameField('Name').inputValue()).toBe(randomLibraryName);
expect(await libraryDetails.getIdField('Library ID').inputValue()).toBe(randomLibraryId);
await expect(libraryDetails.getVisibilityField('Visibility').locator('.mat-mdc-select-value').getByText(publicVisibility)).toBeVisible();
expect(await libraryDetails.getDescriptionField.inputValue()).toBe(randomLibraryDescription);
createdLibrariesIds.push(randomLibraryId);
});
test('[C280029] Cancel button', async () => {
await expect(libraryDialog.getDialogTitle(libraryDialogTitle)).toBeVisible();
await libraryDialog.getLabelText(libraryNameLabel).fill(randomLibraryName);
await libraryDialog.getElementByPlaceholder(libraryNameLabel).fill(randomLibraryName);
await libraryDialog.cancelButton.click();
await expect(libraryDialog.getDialogTitle(libraryDialogTitle)).toBeHidden();
@@ -210,33 +212,33 @@ test.describe('Create Libraries ', () => {
'a|a'
];
await libraryDialog.getLabelText(libraryNameLabel).fill(randomLibraryName);
await libraryDialog.getElementByPlaceholder(libraryNameLabel).fill(randomLibraryName);
for (const specialLibraryId of idsWithSpecialChars) {
await libraryDialog.getLabelText(libraryIdLabel).clear();
await libraryDialog.getLabelText(libraryIdLabel).fill(specialLibraryId);
await libraryDialog.getElementByPlaceholder(libraryIdLabel).clear();
await libraryDialog.getElementByPlaceholder(libraryIdLabel).fill(specialLibraryId);
await libraryDialog.page.keyboard.press(tabKeyString);
await expect(libraryDialog.getLabelText(libraryIdLabel)).toHaveValue(specialLibraryId);
await expect(libraryDialog.getElementByPlaceholder(libraryIdLabel)).toHaveValue(specialLibraryId);
expect(await libraryDialog.isErrorMessageDisplayed(libraryErrors.useNumbersAndLettersOnly), errorMessageNotPresent).toBe(true);
await expect(libraryDialog.createButton).toBeDisabled();
}
});
test('[C280027] Duplicate library ID', async () => {
await libraryDialog.getLabelText(libraryNameLabel).fill(randomLibraryName);
await libraryDialog.getLabelText(libraryIdLabel).clear();
await libraryDialog.getLabelText(libraryIdLabel).fill(commonLibraryName);
await libraryDialog.getElementByPlaceholder(libraryNameLabel).fill(randomLibraryName);
await libraryDialog.getElementByPlaceholder(libraryIdLabel).clear();
await libraryDialog.getElementByPlaceholder(libraryIdLabel).fill(commonLibraryName);
await libraryDialog.page.keyboard.press(tabKeyString);
await expect(libraryDialog.getLabelText(libraryIdLabel)).toHaveValue(commonLibraryName);
await expect(libraryDialog.getElementByPlaceholder(libraryIdLabel)).toHaveValue(commonLibraryName);
await expect(libraryDialog.createButton).toBeDisabled();
expect(await libraryDialog.isErrorMessageDisplayed(libraryErrors.libraryIdIsNotAvailable), errorMessageNotPresent).toBe(true);
});
test('[C280028] Create library using the ID of a library from the Trashcan', async () => {
await libraryDialog.getLabelText(libraryNameLabel).fill(randomLibraryName);
await libraryDialog.getLabelText(libraryIdLabel).clear();
await libraryDialog.getLabelText(libraryIdLabel).fill(commonTrashLibraryName);
await libraryDialog.getElementByPlaceholder(libraryNameLabel).fill(randomLibraryName);
await libraryDialog.getElementByPlaceholder(libraryIdLabel).clear();
await libraryDialog.getElementByPlaceholder(libraryIdLabel).fill(commonTrashLibraryName);
await libraryDialog.page.keyboard.press(tabKeyString);
await expect(libraryDialog.createButton).toBeEnabled();