-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* ACS-8063 Migrate editActions * Removed protractor edit folder tests and protractor e2e run from github
- Loading branch information
1 parent
131e02a
commit ab8fc9e
Showing
16 changed files
with
469 additions
and
6 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/edit-actions/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,42 @@ | ||
/*! | ||
* Copyright © 2005-2024 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, 'Edit Actions'), | ||
projects: [ | ||
{ | ||
name: 'Edit Actions', | ||
testDir: './src/tests', | ||
use: {} | ||
} | ||
] | ||
}; | ||
|
||
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": "edit-actions-e2e", | ||
"$schema": "../../../node_modules/nx/schemas/project-schema.json", | ||
"sourceRoot": "e2e/playwright/edit-actions", | ||
"projectType": "application", | ||
"targets": { | ||
"e2e": { | ||
"executor": "nx:run-commands", | ||
"options": { | ||
"commands": ["npx playwright test --config=e2e/playwright/edit-actions/playwright.config.ts"] | ||
}, | ||
"configurations": { | ||
"production": { | ||
"devServerTarget": "content-ce:serve:production" | ||
} | ||
} | ||
}, | ||
"lint": { | ||
"executor": "@angular-eslint/builder:lint" | ||
} | ||
} | ||
} |
165 changes: 165 additions & 0 deletions
165
e2e/playwright/edit-actions/src/tests/edit-folder.e2e.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,165 @@ | ||
/*! | ||
* Copyright © 2005-2024 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, NodesApi, Utils, test, TrashcanApi } from '@alfresco/playwright-shared'; | ||
|
||
test.describe('Edit folder', () => { | ||
const apiClientFactory = new ApiClientFactory(); | ||
let nodesApi: NodesApi; | ||
let trashcanApi: TrashcanApi; | ||
|
||
let parentId: string; | ||
let folderNameToEditId: string; | ||
|
||
const username = `user-${Utils.random()}`; | ||
const parent = `parent-${Utils.random()}`; | ||
const folderName = `folder-${Utils.random()}`; | ||
const folderDescription = 'my folder description'; | ||
|
||
const folderNameToEdit = `folder-${Utils.random()}`; | ||
const duplicateFolderName = `folder-${Utils.random()}`; | ||
|
||
const folderNameEdited = `folder-renamed-${Utils.random()}`; | ||
const folderDescriptionEdited = 'description edited'; | ||
|
||
test.beforeAll(async () => { | ||
try { | ||
await apiClientFactory.setUpAcaBackend('admin'); | ||
await apiClientFactory.createUser({ username }); | ||
nodesApi = await NodesApi.initialize(username, username); | ||
trashcanApi = await TrashcanApi.initialize(username, username); | ||
|
||
parentId = (await nodesApi.createFolder(parent)).entry.id; | ||
await nodesApi.createFolder(folderName, parentId, '', folderDescription); | ||
folderNameToEditId = (await nodesApi.createFolder(folderNameToEdit, parentId)).entry.id; | ||
await nodesApi.createFolder(duplicateFolderName, parentId); | ||
} catch (error) { | ||
console.error(`beforeAll failed : ${error}`); | ||
} | ||
}); | ||
|
||
test.beforeEach(async ({ loginPage, personalFiles }) => { | ||
await Utils.tryLoginUser(loginPage, username, username, 'beforeEach failed'); | ||
await personalFiles.dataTable.performClickFolderOrFileToOpen(parent); | ||
}); | ||
|
||
test.afterAll(async () => { | ||
await Utils.deleteNodesSitesEmptyTrashcan(nodesApi, trashcanApi, 'afterAll failed'); | ||
}); | ||
|
||
test.describe('on Personal Files', () => { | ||
test('[XAT-5089] "Edit folder" dialog UI', async ({ personalFiles }) => { | ||
await personalFiles.dataTable.selectItem(folderName); | ||
await personalFiles.acaHeader.clickMoreActions(); | ||
await personalFiles.matMenu.clickMenuItemFromHeaderMenu('Edit'); | ||
|
||
await expect(personalFiles.editDialog.editDialog).toBeVisible(); | ||
await expect(personalFiles.editDialog.titleInput).toHaveText('Edit folder'); | ||
await expect(personalFiles.editDialog.nameInput).toHaveValue(folderName); | ||
await expect(personalFiles.editDialog.descriptionInput).toHaveValue(folderDescription); | ||
await expect(personalFiles.editDialog.cancelButton).toBeEnabled(); | ||
await expect(personalFiles.editDialog.updateButton).toBeEnabled(); | ||
}); | ||
|
||
test('[XAT-5093] Properties are modified when clicking Update button', async ({ personalFiles }) => { | ||
await personalFiles.dataTable.selectItem(folderNameToEdit); | ||
await personalFiles.acaHeader.clickMoreActions(); | ||
await personalFiles.matMenu.clickMenuItemFromHeaderMenu('Edit'); | ||
await personalFiles.editDialog.descriptionInput.fill(folderDescriptionEdited); | ||
await personalFiles.editDialog.nameInput.fill(folderNameEdited); | ||
await personalFiles.editDialog.updateButton.click(); | ||
|
||
await expect(personalFiles.editDialog.editDialog).toBeHidden(); | ||
expect(await personalFiles.dataTable.isItemPresent(folderNameEdited)).toBeTruthy(); | ||
const description = await nodesApi.getNodeProperty(folderNameToEditId, 'cm:description'); | ||
expect(description).toEqual(folderDescriptionEdited); | ||
}); | ||
|
||
test('[XAT-5090] Empty folder name', async ({ personalFiles }) => { | ||
await personalFiles.dataTable.selectItem(folderName); | ||
await personalFiles.acaHeader.clickMoreActions(); | ||
await personalFiles.matMenu.clickMenuItemFromHeaderMenu('Edit'); | ||
await personalFiles.editDialog.nameInput.fill(''); | ||
|
||
await expect(personalFiles.editDialog.updateButton).toBeDisabled(); | ||
await expect(personalFiles.editDialog.fieldHint).toHaveText('Folder name is required'); | ||
}); | ||
|
||
test('[XAT-5091] Folder name with special characters', async ({ personalFiles }) => { | ||
const namesWithSpecialChars = ['a*a', 'a"a', 'a<a', 'a>a', `a\\a`, 'a/a', 'a?a', 'a:a', 'a|a']; | ||
|
||
await personalFiles.dataTable.selectItem(folderName); | ||
await personalFiles.acaHeader.clickMoreActions(); | ||
await personalFiles.matMenu.clickMenuItemFromHeaderMenu('Edit'); | ||
|
||
for (const name of namesWithSpecialChars) { | ||
await personalFiles.editDialog.nameInput.fill(name); | ||
await expect(personalFiles.editDialog.updateButton).toBeDisabled(); | ||
expect(await personalFiles.editDialog.fieldHint.innerText()).toContain(`Folder name can't contain these characters`); | ||
} | ||
}); | ||
|
||
test('[XAT-5092] Folder name ending with a dot', async ({ personalFiles }) => { | ||
await personalFiles.dataTable.selectItem(folderName); | ||
await personalFiles.acaHeader.clickMoreActions(); | ||
await personalFiles.matMenu.clickMenuItemFromHeaderMenu('Edit'); | ||
await personalFiles.editDialog.nameInput.fill(`${folderName}.`); | ||
|
||
await expect(personalFiles.editDialog.updateButton).toBeDisabled(); | ||
expect(await personalFiles.editDialog.fieldHint.innerText()).toContain(`Folder name can't end with a period`); | ||
}); | ||
|
||
test('[XAT-5094] Cancel editing properties', async ({ personalFiles }) => { | ||
await personalFiles.dataTable.selectItem(folderName); | ||
await personalFiles.acaHeader.clickMoreActions(); | ||
await personalFiles.matMenu.clickMenuItemFromHeaderMenu('Edit'); | ||
await personalFiles.editDialog.cancelButton.click(); | ||
|
||
await expect(personalFiles.editDialog.editDialog).toBeHidden(); | ||
}); | ||
|
||
test('[XAT-5095] Duplicated folder name', async ({ personalFiles }) => { | ||
await personalFiles.dataTable.selectItem(folderName); | ||
await personalFiles.acaHeader.clickMoreActions(); | ||
await personalFiles.matMenu.clickMenuItemFromHeaderMenu('Edit'); | ||
await personalFiles.editDialog.nameInput.fill(duplicateFolderName); | ||
await personalFiles.editDialog.updateButton.click(); | ||
|
||
await expect(personalFiles.editDialog.editDialog).toBeVisible(); | ||
expect(await personalFiles.snackBar.getSnackBarMessage()).toEqual(`There's already a folder with this name. Try a different name.`); | ||
}); | ||
|
||
test('[XAT-5096] Trim ending spaces', async ({ personalFiles }) => { | ||
await personalFiles.dataTable.selectItem(folderName); | ||
await personalFiles.acaHeader.clickMoreActions(); | ||
await personalFiles.matMenu.clickMenuItemFromHeaderMenu('Edit'); | ||
await personalFiles.editDialog.nameInput.fill(`${folderName} `); | ||
await personalFiles.editDialog.updateButton.click(); | ||
|
||
await expect(personalFiles.editDialog.editDialog).toBeHidden(); | ||
expect(await personalFiles.dataTable.isItemPresent(folderName)).toBeTruthy(); | ||
}); | ||
}); | ||
}); |
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,94 @@ | ||
/*! | ||
* Copyright © 2005-2024 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, NodesApi, Utils, test, TrashcanApi, FileActionsApi, TEST_FILES } from '@alfresco/playwright-shared'; | ||
|
||
test.describe('Edit offline - on Personal Files', () => { | ||
const apiClientFactory = new ApiClientFactory(); | ||
let nodesApi: NodesApi; | ||
let trashcanApi: TrashcanApi; | ||
let fileActionsApi: FileActionsApi; | ||
|
||
let parentPFId: string; | ||
let fileLockedId: string; | ||
let fileLocked2Id: string; | ||
|
||
const username = `user-${Utils.random()}`; | ||
|
||
const file1 = `file1-${Utils.random()}.docx`; | ||
const fileLocked = `file-locked-${Utils.random()}.docx`; | ||
const fileLocked2 = `file-locked2-${Utils.random()}.docx`; | ||
const parentPF = `parentPersonal-${Utils.random()}`; | ||
|
||
test.beforeAll(async () => { | ||
try { | ||
await apiClientFactory.setUpAcaBackend('admin'); | ||
await apiClientFactory.createUser({ username }); | ||
nodesApi = await NodesApi.initialize(username, username); | ||
trashcanApi = await TrashcanApi.initialize(username, username); | ||
fileActionsApi = await FileActionsApi.initialize(username, username); | ||
|
||
parentPFId = (await nodesApi.createFolder(parentPF)).entry.id; | ||
fileLockedId = (await fileActionsApi.uploadFileWithRename(TEST_FILES.DOCX.path, fileLocked, parentPFId)).entry.id; | ||
fileLocked2Id = (await fileActionsApi.uploadFileWithRename(TEST_FILES.DOCX.path, fileLocked2, parentPFId)).entry.id; | ||
await fileActionsApi.uploadFileWithRename(TEST_FILES.DOCX.path, file1, parentPFId); | ||
|
||
await nodesApi.lockNodes([fileLockedId, fileLocked2Id]); | ||
} catch (error) { | ||
console.error(`beforeAll failed : ${error}`); | ||
} | ||
}); | ||
|
||
test.beforeEach(async ({ loginPage, personalFiles }) => { | ||
await Utils.tryLoginUser(loginPage, username, username, 'beforeEach failed'); | ||
await personalFiles.dataTable.performClickFolderOrFileToOpen(parentPF); | ||
}); | ||
|
||
test.afterAll(async () => { | ||
await Utils.deleteNodesSitesEmptyTrashcan(nodesApi, trashcanApi, 'afterAll failed'); | ||
}); | ||
|
||
test('[XAT-5304] File is locked and downloaded when clicking Edit offline', async ({ personalFiles }) => { | ||
await personalFiles.dataTable.selectItem(file1); | ||
await personalFiles.acaHeader.clickMoreActions(); | ||
await personalFiles.matMenu.clickMenuItem('Edit Offline'); | ||
const [download] = await Promise.all([personalFiles.page.waitForEvent('download')]); | ||
expect(download.suggestedFilename()).toBe(file1); | ||
}); | ||
|
||
test('XAT-5305] Lock information is displayed', async ({ personalFiles }) => { | ||
expect(await personalFiles.dataTable.isItemPresent(fileLocked2)).toBe(true); | ||
expect(await personalFiles.dataTable.getLockOwner(fileLocked2)).toContain(username); | ||
}); | ||
|
||
test('[XAT-5306] Cancel Editing unlocks the file', async ({ personalFiles }) => { | ||
await personalFiles.dataTable.selectItem(fileLocked); | ||
await personalFiles.acaHeader.clickMoreActions(); | ||
await personalFiles.matMenu.clickMenuItemFromHeaderMenu('Cancel Editing'); | ||
await personalFiles.dataTable.selectItem(fileLocked); | ||
|
||
expect(await nodesApi.isFileLockedWrite(fileLockedId), `${fileLocked} is still locked`).not.toEqual('WRITE_LOCK'); | ||
}); | ||
}); |
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.