-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ACS-6435] playwright e2e for list views personal files
- Loading branch information
1 parent
8aaca5f
commit c225891
Showing
13 changed files
with
407 additions
and
273 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"extends": "../../../.eslintrc.json", | ||
"ignorePatterns": [ | ||
"!**/*" | ||
], | ||
"overrides": [ | ||
{ | ||
"files": [ | ||
"*.ts" | ||
], | ||
"parserOptions": { | ||
"project": [ | ||
"e2e/playwright/list-views/tsconfig.e2e.json" | ||
], | ||
"createDefaultProgram": true | ||
}, | ||
"plugins": [ | ||
"rxjs", | ||
"unicorn" | ||
], | ||
"rules": { | ||
"@typescript-eslint/no-floating-promises": "off" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/*! | ||
* 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 { PlaywrightTestConfig } from '@playwright/test'; | ||
import { CustomConfig, getGlobalConfig, getExcludedTestsRegExpArray } from '@alfresco/playwright-shared'; | ||
import EXCLUDED_JSON from './exclude.tests.json'; | ||
|
||
const config: PlaywrightTestConfig<CustomConfig> = { | ||
...getGlobalConfig, | ||
|
||
grepInvert: getExcludedTestsRegExpArray(EXCLUDED_JSON, 'List Views'), | ||
projects: [ | ||
{ | ||
name: 'List Views', | ||
testDir: './src/tests', | ||
use: { | ||
users: ['hruser', 'admin'] | ||
} | ||
} | ||
] | ||
}; | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"name": "list-views-e2e", | ||
"$schema": "../../../node_modules/nx/schemas/project-schema.json", | ||
"sourceRoot": "e2e/playwright/list-views", | ||
"projectType": "application", | ||
"targets": { | ||
"e2e": { | ||
"executor": "nx:run-commands", | ||
"options": { | ||
"commands": ["npx playwright test --config=e2e/playwright/list-views/playwright.config.ts"] | ||
}, | ||
"configurations": { | ||
"production": { | ||
"devServerTarget": "content-ce:serve:production" | ||
} | ||
} | ||
}, | ||
"lint": { | ||
"executor": "@angular-eslint/builder:lint" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
/*! | ||
* 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 { ApiClientFactory, LoginPage, NodesApi, Utils, test, SitesApi, FavoritesPageApi, timeouts } from '@alfresco/playwright-shared'; | ||
import { Site } from '@alfresco/js-api'; | ||
|
||
test.describe('Favorites Files', () => { | ||
const apiClientFactory = new ApiClientFactory(); | ||
let nodesApi: NodesApi; | ||
let nodesApiAdmin: NodesApi; | ||
let siteActionsAdmin: SitesApi; | ||
let favoritesActions: FavoritesPageApi; | ||
const username = `user-${Utils.random()}`; | ||
const siteName = `site-${Utils.random()}`; | ||
const favFolderName = `favFolder-${Utils.random()}`; | ||
const parentFolder = `parent-${Utils.random()}`; | ||
const fileName1 = `file1-${Utils.random()}.txt`; | ||
const fileName2 = `file2-${Utils.random()}.txt`; | ||
const fileName3 = `file3-${Utils.random()}.txt`; | ||
const fileName4 = `file4-${Utils.random()}.txt`; | ||
|
||
test.beforeAll(async () => { | ||
try { | ||
test.setTimeout(timeouts.extendedTest); | ||
await apiClientFactory.setUpAcaBackend('admin'); | ||
await apiClientFactory.createUser({ username }); | ||
nodesApi = await NodesApi.initialize(username, username); | ||
nodesApiAdmin = await NodesApi.initialize('admin'); | ||
siteActionsAdmin = await SitesApi.initialize('admin'); | ||
favoritesActions = await FavoritesPageApi.initialize(username, username); | ||
const consumerFavoritesTotalItems = await favoritesActions.getFavoritesTotalItems(username); | ||
const folderFavId = (await nodesApi.createFolder(favFolderName)).entry.id; | ||
const parentId = (await nodesApi.createFolder(parentFolder)).entry.id; | ||
await siteActionsAdmin.createSite(siteName, Site.VisibilityEnum.PUBLIC); | ||
const docLibId = await siteActionsAdmin.getDocLibId(siteName); | ||
await siteActionsAdmin.addSiteMember(siteName, username, Site.RoleEnum.SiteManager); | ||
await favoritesActions.addFavoritesByIds('folder', [folderFavId]); | ||
const file1Id = (await nodesApiAdmin.createFile(fileName1, docLibId)).entry.id; | ||
const file2Id = (await nodesApi.createFile(fileName2, parentId)).entry.id; | ||
const file3Id = (await nodesApi.createFile(fileName3, parentId)).entry.id; | ||
const file4Id = (await nodesApi.createFile(fileName4, parentId)).entry.id; | ||
|
||
await favoritesActions.addFavoritesByIds('file', [file1Id]); | ||
await favoritesActions.addFavoriteById('file', file2Id); | ||
await favoritesActions.addFavoriteById('file', file3Id); | ||
await favoritesActions.addFavoriteById('file', file4Id); | ||
await nodesApi.deleteNodes([file3Id, file4Id], false); | ||
await apiClientFactory.trashCan.restoreDeletedNode(file4Id); | ||
await Promise.all([ | ||
favoritesActions.isFavoriteWithRetry(username, folderFavId, { expect: true }), | ||
favoritesActions.waitForApi(username, { expect: consumerFavoritesTotalItems + 4 }) | ||
]); | ||
} catch (error) { | ||
console.error(`beforeAll failed : ${error}`); | ||
} | ||
}); | ||
|
||
test.beforeEach(async ({ page }) => { | ||
const loginPage = new LoginPage(page); | ||
try { | ||
await loginPage.loginUser( | ||
{ username, password: username }, | ||
{ | ||
withNavigation: true, | ||
waitForLoading: true | ||
} | ||
); | ||
} catch (error) { | ||
console.error(`beforeEach failed : ${error}`); | ||
} | ||
}); | ||
|
||
test.afterAll(async () => { | ||
try { | ||
await nodesApi.deleteCurrentUserNodes(); | ||
} catch (error) { | ||
console.error(`afterAll failed : ${error}`); | ||
} | ||
}); | ||
|
||
test.describe(`Regular user's Favorites files`, () => { | ||
test.beforeEach(async ({ favoritePage }) => { | ||
favoritePage.navigate(); | ||
}); | ||
|
||
test('[C280482] has the correct columns', async ({ favoritePage }) => { | ||
const expectedColumns = ['Name', 'Location', 'Size', 'Modified', 'Modified by', 'Tags']; | ||
const actualColumns = await favoritePage.dataTable.getColumnHeaders(); | ||
expect(actualColumns).toEqual(expectedColumns); | ||
Check failure on line 111 in e2e/playwright/list-views/src/tests/favorites.spec.ts GitHub Actions / E2e test suites: Playwright (list-views, 8)[List Views] › src/tests/favorites.spec.ts:108:9 › Favorites Files › Regular user's Favorites files › [C280482] has the correct columns
Check failure on line 111 in e2e/playwright/list-views/src/tests/favorites.spec.ts GitHub Actions / E2e test suites: Playwright (list-views, 8)[List Views] › src/tests/favorites.spec.ts:108:9 › Favorites Files › Regular user's Favorites files › [C280482] has the correct columns
|
||
}); | ||
|
||
test(`[C213228] deleted favorite file does not appear`, async ({ favoritePage }) => { | ||
expect(await favoritePage.dataTable.isItemPresent(fileName3), `${fileName3} is displayed`).not.toBe(true); | ||
}); | ||
|
||
test(`[C213229] file is displayed after it is restored from Trashcan`, async ({ favoritePage }) => { | ||
expect(await favoritePage.dataTable.isItemPresent(fileName4), `${fileName4} not displayed`).toBe(true); | ||
}); | ||
|
||
test('[C213231] Location column displays the parent folder of the files', async ({ favoritePage }) => { | ||
expect(await favoritePage.dataTable.getItemLocationText(fileName2)).toEqual(parentFolder); | ||
expect(await favoritePage.dataTable.getItemLocationText(favFolderName)).toEqual('Personal Files'); | ||
expect(await favoritePage.dataTable.getItemLocationTooltip(fileName2)).toEqual(`Personal Files/${parentFolder}`); | ||
expect(await favoritePage.dataTable.getItemLocationTooltip(favFolderName)).toEqual('Personal Files'); | ||
expect(await favoritePage.dataTable.getItemLocationText(fileName1)).toEqual(siteName); | ||
expect(await favoritePage.dataTable.getItemLocationTooltip(fileName1)).toContain(`${siteName}`); | ||
}); | ||
|
||
test('[C213650] Location column redirect - item in user Home', async ({ favoritePage }) => { | ||
await favoritePage.dataTable.clickItemLocation(favFolderName); | ||
await favoritePage.dataTable.spinnerWaitForReload(); | ||
expect(await favoritePage.breadcrumb.getAllItems()).toEqual(['Personal Files']); | ||
}); | ||
|
||
test('[C280484] Location column redirect - file in folder', async ({ favoritePage }) => { | ||
await favoritePage.dataTable.clickItemLocation(fileName2); | ||
await favoritePage.dataTable.spinnerWaitForReload(); | ||
expect(await favoritePage.breadcrumb.getAllItems()).toEqual(['Personal Files', parentFolder]); | ||
}); | ||
|
||
test('[C280485] Location column redirect - file in site', async ({ favoritePage }) => { | ||
await favoritePage.dataTable.clickItemLocation(fileName1); | ||
await favoritePage.dataTable.spinnerWaitForReload(); | ||
expect(await favoritePage.breadcrumb.getAllItems()).toEqual(['My Libraries', siteName]); | ||
}); | ||
|
||
test('[C213230] Navigate into folder from Favorites', async ({ favoritePage }) => { | ||
await favoritePage.dataTable.performClickFolderOrFileToOpen(favFolderName); | ||
await favoritePage.dataTable.spinnerWaitForReload(); | ||
expect(await favoritePage.breadcrumb.currentItem.innerText()).toBe(favFolderName); | ||
}); | ||
}); | ||
}); |
92 changes: 92 additions & 0 deletions
92
e2e/playwright/list-views/src/tests/personal-files.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
/*! | ||
* 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 { APP_ROUTES, ApiClientFactory, LoginPage, NodesApi, SIDEBAR_LABELS, Utils, test } from '@alfresco/playwright-shared'; | ||
|
||
test.describe('Personal Files', () => { | ||
const apiClientFactory = new ApiClientFactory(); | ||
let nodesApi: NodesApi; | ||
const username = `user-${Utils.random()}`; | ||
const userFolder = `user-folder-${Utils.random()}`; | ||
|
||
test.beforeAll(async () => { | ||
try { | ||
await apiClientFactory.setUpAcaBackend('admin'); | ||
await apiClientFactory.createUser({ username }); | ||
nodesApi = await NodesApi.initialize(username, username); | ||
await nodesApi.createFolder(userFolder); | ||
} catch (error) { | ||
console.error(`beforeAll failed : ${error}`); | ||
} | ||
}); | ||
|
||
test.afterAll(async () => { | ||
try { | ||
await nodesApi.deleteCurrentUserNodes(); | ||
} catch (error) { | ||
console.error(`afterAll failed : ${error}`); | ||
} | ||
}); | ||
|
||
test.describe(`Regular user's personal files`, () => { | ||
test.beforeEach(async ({ page }) => { | ||
const loginPage = new LoginPage(page); | ||
try { | ||
await loginPage.loginUser( | ||
{ username, password: username }, | ||
{ | ||
withNavigation: true, | ||
waitForLoading: true | ||
} | ||
); | ||
} catch (error) { | ||
console.error(`beforeEach failed : ${error}`); | ||
} | ||
}); | ||
|
||
test('[C217142] has the correct columns', async ({ personalFiles }) => { | ||
const expectedColumns = ['Name', 'Size', 'Modified', 'Modified by', 'Tags']; | ||
const actualColumns = await personalFiles.dataTable.getColumnHeaders(); | ||
expect(actualColumns).toEqual(expectedColumns); | ||
}); | ||
|
||
test('[C217143] has default sorted column', async ({ personalFiles }) => { | ||
expect(await personalFiles.dataTable.getSortedColumnHeaderText()).toBe('Name'); | ||
}); | ||
|
||
test('[C213245] redirects to Personal Files on clicking the link from sidebar', async ({ personalFiles }) => { | ||
await personalFiles.dataTable.performClickFolderOrFileToOpen(userFolder); | ||
await personalFiles.sidenav.openPanel(SIDEBAR_LABELS.PERSONAL_FILES); | ||
await personalFiles.dataTable.spinnerWaitForReload(); | ||
expect(personalFiles.page.url()).toContain(APP_ROUTES.PERSONAL_FILES); | ||
expect(await personalFiles.sidenav.isActive(SIDEBAR_LABELS.PERSONAL_FILES), 'My Libraries link not active').toBe(true); | ||
}); | ||
|
||
test('[C213246] page loads correctly after browser refresh', async ({ personalFiles }) => { | ||
await personalFiles.reload(); | ||
expect(personalFiles.page.url()).toContain(APP_ROUTES.PERSONAL_FILES); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"extends": "../../../tsconfig.adf.json", | ||
"compilerOptions": { | ||
"outDir": "../../out-tsc/e2e", | ||
"baseUrl": "./", | ||
"module": "commonjs", | ||
"target": "es2017", | ||
"types": ["jasmine", "jasminewd2", "node"], | ||
"skipLibCheck": true, | ||
"paths": { | ||
"@alfresco/playwright-shared": ["../../../projects/aca-playwright-shared/src/index.ts"] | ||
} | ||
}, | ||
"exclude": ["node_modules"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"extends": "../../../tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "../../out-tsc/e2e", | ||
"baseUrl": "./", | ||
"module": "commonjs", | ||
"target": "es2017", | ||
"types": ["jasmine", "jasminewd2", "node", "@playwright/test"], | ||
"skipLibCheck": true, | ||
"paths": { | ||
"@alfresco/playwright-shared": ["../../../projects/aca-playwright-shared/src/index.ts"] | ||
} | ||
}, | ||
"exclude": ["node_modules"] | ||
} |
Oops, something went wrong.