Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ACS-5511] create library playwright tests #3318

Merged
merged 61 commits into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
2765357
[ACS-511]-adding-library-tests
azakrzewski-hy Jul 7, 2023
f9bc90a
updating tests and adding before and after all
azakrzewski-hy Jul 7, 2023
e794328
spinner timeouts update
azakrzewski-hy Jul 10, 2023
25ebd0b
updating import statement
azakrzewski-hy Jul 10, 2023
e74602a
update error locator
azakrzewski-hy Jul 10, 2023
0407311
adding random method in general utils
azakrzewski-hy Jul 11, 2023
06feeac
Merge branch 'develop' into ACS-5511-create-library-playwright-tests
azakrzewski-hy Jul 11, 2023
836e31c
[ACA-4715] break dependency on envsubst (#3325)
DenysVuika Jul 11, 2023
7320efa
[ACS-511]-adding-library-tests
azakrzewski-hy Jul 7, 2023
d43abff
adding lost MyLibrariesPage import
azakrzewski-hy Jul 11, 2023
9309213
rebase page initialization merge
azakrzewski-hy Jul 7, 2023
b1724e7
[ACS-511]-adding-library-tests
azakrzewski-hy Jul 7, 2023
0034079
comma deleted
azakrzewski-hy Jul 11, 2023
397a0e8
Merge branch 'develop' into ACS-5511-create-library-playwright-tests
azakrzewski-hy Jul 11, 2023
4fe33db
fix readability and indentation
azakrzewski-hy Jul 11, 2023
d379c1f
adding id to info drawer
azakrzewski-hy Jul 11, 2023
0b54eee
Merge branch 'develop' into ACS-5511-create-library-playwright-tests
azakrzewski-hy Jul 11, 2023
36188b9
adding index and updating import
azakrzewski-hy Jul 11, 2023
c3fb008
updating after wrong rebase
azakrzewski-hy Jul 12, 2023
c654361
after rebase
azakrzewski-hy Jul 7, 2023
1eb2f8c
updating tests and adding before and after all
azakrzewski-hy Jul 7, 2023
51109c0
updating import statement
azakrzewski-hy Jul 10, 2023
d9d5970
update error locator
azakrzewski-hy Jul 10, 2023
f82f4e5
adding random method in general utils
azakrzewski-hy Jul 11, 2023
a29bdf9
[ACS-511]-adding-library-tests
azakrzewski-hy Jul 7, 2023
48469e2
comma deleted
azakrzewski-hy Jul 11, 2023
9c4722c
fix readability and indentation
azakrzewski-hy Jul 11, 2023
78a3396
adding id to info drawer
azakrzewski-hy Jul 11, 2023
bc73f54
adding index and updating import
azakrzewski-hy Jul 11, 2023
7b7c750
next after rebase
azakrzewski-hy Jul 12, 2023
82cf93a
Merge remote-tracking branch 'origin/ACS-5511-create-library-playwrig…
azakrzewski-hy Jul 12, 2023
61cec72
update delete in folder tests
azakrzewski-hy Jul 12, 2023
dffe407
providing string as parameter
azakrzewski-hy Jul 12, 2023
3f385f9
after rebase
azakrzewski-hy Jul 7, 2023
29d3506
updating tests and adding before and after all
azakrzewski-hy Jul 7, 2023
0422c71
adding random method in general utils
azakrzewski-hy Jul 11, 2023
f235eb2
[ACS-511]-adding-library-tests
azakrzewski-hy Jul 7, 2023
33a1052
comma deleted
azakrzewski-hy Jul 11, 2023
72909ac
[ACS-511]-adding-library-tests
azakrzewski-hy Jul 7, 2023
a3407a6
adding index and updating import
azakrzewski-hy Jul 11, 2023
e2f6d2b
providing string as parameter
azakrzewski-hy Jul 12, 2023
b935e17
Merge branch 'develop' into ACS-5511-create-library-playwright-tests
azakrzewski-hy Jul 12, 2023
1c7564b
delete protractor create-library tests
azakrzewski-hy Jul 12, 2023
62c2ee3
update for calls in expect method
azakrzewski-hy Jul 12, 2023
67fbf41
bump to 4.2.0 (#3334)
DenysVuika Jul 12, 2023
36abb0b
adding random method in general utils
azakrzewski-hy Jul 11, 2023
3e9a701
adding index and updating import
azakrzewski-hy Jul 11, 2023
a7b0b89
providing string as parameter
azakrzewski-hy Jul 12, 2023
62352e5
after rebase
azakrzewski-hy Jul 7, 2023
dbffeb1
providing string as parameter
azakrzewski-hy Jul 12, 2023
fedf5a5
update for tests C280026 and C280027
azakrzewski-hy Jul 13, 2023
d77ede7
raising time for visibility check
azakrzewski-hy Jul 13, 2023
ad1c2a9
quotes change in error strings
azakrzewski-hy Jul 13, 2023
badb480
adding waitFor method
azakrzewski-hy Jul 14, 2023
1abfc03
raising timeout in isErrorMessageDisplayed method
azakrzewski-hy Jul 14, 2023
2ac7809
updating mat-error locator
azakrzewski-hy Jul 14, 2023
72af425
adding press tab after fill
azakrzewski-hy Jul 14, 2023
081238c
Merge branch 'develop' into ACS-5511-create-library-playwright-tests
azakrzewski-hy Jul 14, 2023
22e1392
update general-utils to utils for random
azakrzewski-hy Jul 17, 2023
e3fc52e
Merge branch 'develop' into ACS-5511-create-library-playwright-tests
azakrzewski-hy Jul 17, 2023
a9a9a98
updating label typo
azakrzewski-hy Jul 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions e2e/playwright/actions/src/tests/create-folder.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { expect } from '@playwright/test';
import { folderErrors, getUserState, test } from '@alfresco/playwright-shared';

test.use({ storageState: getUserState('hruser') });
test.describe('Create actions', () => {
test.describe('Create folders', () => {
let randomFolderName: string;
let randomFolderTitle: string;
let randomFolderDescription: string;
Expand All @@ -47,7 +47,7 @@ test.describe('Create actions', () => {
await personalFiles.dataTable.goThroughPagesLookingForRowWithName(randomFolderName);
await expect(personalFiles.dataTable.getRowByName(randomFolderName)).toBeVisible();

await personalFiles.dataTable.performActionFromExpandableMenu(randomFolderName, 'Delete');
await personalFiles.dataTable.performActionInExpandableMenu(randomFolderName, 'Delete');
});

test('[C216340] Create a folder with name, title and description', async ({ personalFiles }) => {
Expand All @@ -59,14 +59,12 @@ test.describe('Create actions', () => {
await personalFiles.folderDialog.createButton.click();

await personalFiles.dataTable.goThroughPagesLookingForRowWithName(randomFolderName);
await expect(
personalFiles.dataTable
.getCellLinkByName(randomFolderName)
.and(personalFiles.page.getByTitle(randomFolderTitle))
.and(personalFiles.page.getByTitle(randomFolderDescription))
).toBeVisible();

await personalFiles.dataTable.performActionFromExpandableMenu(randomFolderName, 'Delete');
await expect(personalFiles.dataTable.getCellLinkByName(randomFolderName)).toHaveAttribute(
'title',
randomFolderTitle + `\n` + randomFolderDescription
);

await personalFiles.dataTable.performActionInExpandableMenu(randomFolderName, 'Delete');
});

test('[C216345] Create new folder dialog check', async ({ personalFiles }) => {
Expand Down Expand Up @@ -152,7 +150,7 @@ test.describe('Create actions', () => {
await expect(personalFiles.snackBar.getByMessageLocator(folderErrors.thereIsAlreadyAFolderWithThisName)).toBeVisible();

await personalFiles.folderDialog.cancelButton.click();
await personalFiles.dataTable.performActionFromExpandableMenu(randomFolderName, 'Delete');
await personalFiles.dataTable.performActionInExpandableMenu(randomFolderName, 'Delete');
});

test('[C216351] Folder created after trimmed ending spaces from a folder name', async ({ personalFiles }) => {
Expand All @@ -164,6 +162,6 @@ test.describe('Create actions', () => {
await personalFiles.dataTable.goThroughPagesLookingForRowWithName(randomFolderName);
await expect(personalFiles.dataTable.getRowByName(randomFolderName)).toBeVisible();

await personalFiles.dataTable.performActionFromExpandableMenu(randomFolderName, 'Delete');
await personalFiles.dataTable.performActionInExpandableMenu(randomFolderName, 'Delete');
});
});
263 changes: 263 additions & 0 deletions e2e/playwright/actions/src/tests/create-library.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,263 @@
/*!
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Alfresco Example Content Application
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/

import { expect } from '@playwright/test';
import { Utils, ApiClientFactory, getUserState, test, libraryErrors } from '@alfresco/playwright-shared';
import { SiteBodyCreate } from '@alfresco/js-api';

test.use({ storageState: getUserState('hruser') });
test.describe('Create Libraries ', () => {
const apiClientFactory = new ApiClientFactory();
let randomLibraryName: string;
let randomLibraryId: string;
let randomLibraryDescription: string;
const libraryDialogTitle = 'Create Library';
const libraryNameLabel = 'Name *';
const libraryIdLabel = 'Library ID *';
const libraryDescriptionLabel = 'Description';
const publicVisibility = 'Public';
const moderatedVisibility = 'Moderated';
const privateVisibility = 'Private';
const deleteAction = 'Delete';
const errorMessageNotPresent = 'Error message is not displayed';

const commonLibraryName = `playwright-library-${Utils.random()}`;
const commonLibraryId = `libraryId-${Utils.random()}`;
const commonTrashLibraryName = `playwright-library-${Utils.random()}`;
const commonTrashLibraryId = `libraryId-${Utils.random()}`;

test.beforeAll(async () => {
await apiClientFactory.setUpAcaBackend('hruser');
await apiClientFactory.sites.createSite({ id: commonLibraryId, title: commonLibraryName, visibility: SiteBodyCreate.VisibilityEnum.PUBLIC });
await apiClientFactory.sites.createSite({
id: commonTrashLibraryId,
title: commonTrashLibraryName,
visibility: SiteBodyCreate.VisibilityEnum.PUBLIC
});
await apiClientFactory.sites.deleteSite(commonTrashLibraryId);
});

test.beforeEach(async ({ myLibrariesPage }) => {
randomLibraryName = `playwright-library-${Utils.random()}`;
randomLibraryId = `libraryId-${Utils.random()}`;
randomLibraryDescription = `libraryDescription-${Utils.random()}`;
await myLibrariesPage.navigate();
});

test.afterAll(async () => {
await apiClientFactory.sites.deleteSite(commonLibraryId, { permanent: true });
});

test('[C280024] Create Library dialog UI', async ({ myLibrariesPage }) => {
const libraryDialog = myLibrariesPage.libraryDialog;

await myLibrariesPage.selectCreateLibrary();

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.getLabelText(publicVisibility)).toBeVisible();
await expect(libraryDialog.getLabelText(publicVisibility)).toBeChecked();
await expect(libraryDialog.getLabelText(privateVisibility)).toBeVisible();
await expect(libraryDialog.getLabelText(moderatedVisibility)).toBeVisible();
await expect(libraryDialog.cancelButton).toBeEnabled();
await expect(libraryDialog.createButton).toBeDisabled();
});

test('[C280025] Create a public library', async ({ myLibrariesPage }) => {
const libraryDialog = myLibrariesPage.libraryDialog;
const libraryTable = myLibrariesPage.dataTable;
const libraryBreadcrumb = myLibrariesPage.breadcrumb;

await myLibrariesPage.selectCreateLibrary();
await libraryDialog.getLabelText(libraryNameLabel).fill(randomLibraryName);
await expect(libraryDialog.getLabelText(libraryNameLabel)).toHaveValue(randomLibraryName);
await expect(libraryDialog.getLabelText(libraryIdLabel)).toHaveValue(randomLibraryName);
await libraryDialog.createButton.click();
await expect(libraryBreadcrumb.getBreadcrumbItem(randomLibraryName)).toBeVisible();

await myLibrariesPage.navigate();
await libraryTable.goThroughPagesLookingForRowWithName(randomLibraryName);
await expect(libraryTable.getCellByColumnNameAndRowItem(randomLibraryName, publicVisibility)).toBeVisible();

await libraryTable.performActionInExpandableMenu(randomLibraryName, deleteAction);
});

test('[C289880] Create a moderated library', async ({ myLibrariesPage }) => {
const libraryDialog = myLibrariesPage.libraryDialog;
const libraryTable = myLibrariesPage.dataTable;
const libraryBreadcrumb = myLibrariesPage.breadcrumb;

await myLibrariesPage.selectCreateLibrary();
await libraryDialog.createLibraryWithNameAndId(randomLibraryName, randomLibraryId, null, moderatedVisibility);
await expect(libraryBreadcrumb.getBreadcrumbItem(randomLibraryName)).toBeVisible();

await myLibrariesPage.navigate();
await libraryTable.goThroughPagesLookingForRowWithName(randomLibraryName);
await expect(libraryTable.getCellByColumnNameAndRowItem(randomLibraryName, moderatedVisibility)).toBeVisible();

await libraryTable.performActionInExpandableMenu(randomLibraryName, deleteAction);
});

test('[C289881] Create a private library', async ({ myLibrariesPage }) => {
const libraryDialog = myLibrariesPage.libraryDialog;
const libraryTable = myLibrariesPage.dataTable;
const libraryBreadcrumb = myLibrariesPage.breadcrumb;

await myLibrariesPage.selectCreateLibrary();
await libraryDialog.createLibraryWithNameAndId(randomLibraryName, randomLibraryId, null, privateVisibility);
await expect(libraryBreadcrumb.getBreadcrumbItem(randomLibraryName)).toBeVisible();

await myLibrariesPage.navigate();
await libraryTable.goThroughPagesLookingForRowWithName(randomLibraryName);
await expect(libraryTable.getCellByColumnNameAndRowItem(randomLibraryName, privateVisibility)).toBeVisible();

await libraryTable.performActionInExpandableMenu(randomLibraryName, deleteAction);
});

test('[C289882] Create a library with a given ID and description', async ({ myLibrariesPage }) => {
const libraryDialog = myLibrariesPage.libraryDialog;
const libraryTable = myLibrariesPage.dataTable;
const libraryBreadcrumb = myLibrariesPage.breadcrumb;
const libraryViewDetails = myLibrariesPage.acaHeader.viewDetails;
const libraryDetails = myLibrariesPage.libraryDetails;

await myLibrariesPage.selectCreateLibrary();
await libraryDialog.createLibraryWithNameAndId(randomLibraryName, randomLibraryId, randomLibraryDescription);
await expect(libraryBreadcrumb.getBreadcrumbItem(randomLibraryName)).toBeVisible();

await myLibrariesPage.navigate();
await libraryTable.goThroughPagesLookingForRowWithName(randomLibraryName);
await expect(libraryTable.getCellLinkByName(randomLibraryName).and(myLibrariesPage.page.getByTitle(randomLibraryDescription))).toBeVisible();
await libraryTable.getRowByName(randomLibraryName).click();
await libraryViewDetails.click();
await expect(libraryDetails.getNameField('Name').getByText(randomLibraryName)).toBeVisible();
await expect(libraryDetails.getIdField('Library ID').getByText(randomLibraryId)).toBeVisible();
await expect(libraryDetails.getVisibilityField('Visibility').getByText(publicVisibility)).toBeVisible();
await expect(libraryDetails.getDescriptionField(libraryDescriptionLabel).getByText(randomLibraryDescription)).toBeVisible();

await apiClientFactory.sites.deleteSite(randomLibraryId, { permanent: true });
});

test('[C280027] Duplicate library ID', async ({ myLibrariesPage }) => {
const libraryDialog = myLibrariesPage.libraryDialog;

await myLibrariesPage.selectCreateLibrary();
await libraryDialog.getLabelText(libraryNameLabel).fill(randomLibraryName);
await libraryDialog.getLabelText(libraryIdLabel).clear();
await libraryDialog.getLabelText(libraryIdLabel).fill(commonLibraryId);
await libraryDialog.page.keyboard.press('Tab');
await expect(libraryDialog.getLabelText(libraryIdLabel)).toHaveValue(commonLibraryId);

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 ({ myLibrariesPage }) => {
const libraryDialog = myLibrariesPage.libraryDialog;

await myLibrariesPage.selectCreateLibrary();
await libraryDialog.getLabelText(libraryNameLabel).fill(randomLibraryName);
await libraryDialog.getLabelText(libraryIdLabel).clear();
await libraryDialog.getLabelText(libraryIdLabel).fill(commonTrashLibraryId);
await libraryDialog.page.keyboard.press('Tab');

await expect(libraryDialog.createButton).toBeEnabled();
await libraryDialog.createButton.click();
await expect(libraryDialog.createButton).toBeDisabled();
expect(await libraryDialog.isErrorMessageDisplayed(libraryErrors.libraryIdIsAlreadyUsed), errorMessageNotPresent).toBe(true);
});

test('[C280029] Cancel button', async ({ myLibrariesPage }) => {
const libraryDialog = myLibrariesPage.libraryDialog;
const libraryTable = myLibrariesPage.dataTable;
const libraryBreadcrumb = myLibrariesPage.breadcrumb;

await myLibrariesPage.selectCreateLibrary();
await expect(libraryDialog.getDialogTitle(libraryDialogTitle)).toBeVisible();
await libraryDialog.getLabelText(libraryNameLabel).fill(randomLibraryName);
await libraryDialog.cancelButton.click();

await expect(libraryDialog.getDialogTitle(libraryDialogTitle)).toBeHidden();
await expect(libraryBreadcrumb.getBreadcrumbItem(randomLibraryName)).toHaveCount(0);
await expect(libraryTable.getRowByName(randomLibraryName)).toHaveCount(0);
});

test('[C280026] Library ID cannot contain special characters', async ({ myLibrariesPage }) => {
const libraryDialog = myLibrariesPage.libraryDialog;
const idsWithSpecialChars = [
'a!a',
'a@a',
'a#a',
'a%a',
'a^a',
'a&a',
'a*a',
'a(a',
'a)a',
'a"a',
'a<a',
'a>a',
`a\\a`,
'a/a',
'a?a',
'a:a',
'a|a'
];

await myLibrariesPage.selectCreateLibrary();
await libraryDialog.getLabelText(libraryNameLabel).fill(randomLibraryName);

for (const specialLibraryId of idsWithSpecialChars) {
await libraryDialog.getLabelText(libraryIdLabel).clear();
await libraryDialog.getLabelText(libraryIdLabel).fill(specialLibraryId);
await libraryDialog.page.keyboard.press('Tab');
await expect(libraryDialog.getLabelText(libraryIdLabel)).toHaveValue(specialLibraryId);
expect(await libraryDialog.isErrorMessageDisplayed(libraryErrors.useNumbersAndLettersOnly), errorMessageNotPresent).toBe(true);
await expect(libraryDialog.createButton).toBeDisabled();
}
});

test('[C280030] Create 2 libraries with same name but different IDs', async ({ myLibrariesPage }) => {
const libraryDialog = myLibrariesPage.libraryDialog;
const libraryTable = myLibrariesPage.dataTable;
const libraryBreadcrumb = myLibrariesPage.breadcrumb;
const libraryName = commonLibraryName + ' (' + commonLibraryId + ')';
const libraryName2 = commonLibraryName + ' (' + randomLibraryId + ')';

await myLibrariesPage.selectCreateLibrary();
await libraryDialog.createLibraryWithNameAndId(commonLibraryName, randomLibraryId);

await expect(libraryBreadcrumb.getBreadcrumbItem(commonLibraryName)).toBeVisible();

await myLibrariesPage.navigate();
await libraryTable.goThroughPagesLookingForRowWithName(libraryName);
await expect(libraryTable.getRowByName(libraryName)).toBeVisible();
await libraryTable.goThroughPagesLookingForRowWithName(libraryName2);
await expect(libraryTable.getRowByName(libraryName2)).toBeVisible();

await apiClientFactory.sites.deleteSite(randomLibraryId, { permanent: true });
});
});
Loading