-
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
- Loading branch information
1 parent
b192c5f
commit 5abbda7
Showing
32 changed files
with
901 additions
and
101 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/viewer/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, 'Viewer'), | ||
projects: [ | ||
{ | ||
name: 'Viewer', | ||
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,34 @@ | ||
{ | ||
"$schema": "../../../node_modules/nx/schemas/project-schema.json", | ||
"name": "viewer-e2e", | ||
"sourceRoot": "e2e/playwright/viewer/src", | ||
"projectType": "application", | ||
"targets": { | ||
"e2e": { | ||
"executor": "nx:run-commands", | ||
"options": { | ||
"commands": [ | ||
"npx playwright test --config=e2e/playwright/viewer/playwright.config.ts" | ||
] | ||
}, | ||
"configurations": { | ||
"production": { | ||
"devServerTarget": "content-ce:serve:production" | ||
} | ||
} | ||
}, | ||
"lint": { | ||
"executor": "@angular-eslint/builder:lint", | ||
"options": { | ||
"lintFilePatterns": [ | ||
"e2e/**/*.ts", | ||
"e2e/**/*.html" | ||
], | ||
"cache": true, | ||
"cacheLocation": ".eslintcache", | ||
"ignorePath": ".eslintignore" | ||
}, | ||
"outputs": ["{options.outputFile}"] | ||
} | ||
} | ||
} |
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,135 @@ | ||
/*! | ||
* 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, getUserState, test, TEST_FILES } from '@alfresco/playwright-shared'; | ||
|
||
test.use({ storageState: getUserState('admin') }); | ||
test.describe('viewer file', () => { | ||
const apiClientFactory = new ApiClientFactory(); | ||
const randomFolderName = `playwright-folder-${(Math.random() + 1).toString(36).substring(6)}`; | ||
const randomDocxName = TEST_FILES.DOCX.name + (Math.random() + 1).toString(36).substring(6); | ||
let folderId: string; | ||
let fileDocxId: string; | ||
|
||
test.beforeAll(async ({ fileAction, shareAction, favoritesPageAction: favoritesPageAction }) => { | ||
await apiClientFactory.setUpAcaBackend('admin'); | ||
const node = await apiClientFactory.nodes.createNode('-my-', { name: randomFolderName, nodeType: 'cm:folder', relativePath: '/' }); | ||
folderId = await node.entry.id; | ||
const fileDoc = await fileAction.uploadFile(TEST_FILES.DOCX.path, randomDocxName, folderId); | ||
fileDocxId = await fileDoc.entry.id; | ||
await shareAction.shareFileById(fileDocxId); | ||
await favoritesPageAction.addFavoriteById('file', fileDocxId); | ||
}); | ||
|
||
test.beforeEach(async ({ personalFiles }) => { | ||
await personalFiles.navigate({ waitUntil: 'domcontentloaded' }); | ||
await personalFiles.dataTable.performClickFolderOrFileToOpen(randomFolderName); | ||
}); | ||
|
||
test.afterAll(async () => { | ||
await apiClientFactory.nodes.deleteNode(folderId); | ||
}); | ||
|
||
test('[C279269] Viewer opens on double clicking on a file from Personal Files', async ({ personalFiles }) => { | ||
await personalFiles.dataTable.performClickFolderOrFileToOpen(randomDocxName); | ||
expect(await personalFiles.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true); | ||
}); | ||
|
||
test('[C279270] Viewer opens when clicking the View action for a file', async ({ personalFiles }) => { | ||
await personalFiles.dataTable.selectItem(randomDocxName); | ||
await personalFiles.acaHeader.viewButton.click(); | ||
await personalFiles.dataTable.spinnerWaitForReload(); | ||
expect(await personalFiles.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true); | ||
}); | ||
|
||
test('[C279283] The viewer general elements are displayed', async ({ personalFiles }) => { | ||
await personalFiles.dataTable.performClickFolderOrFileToOpen(randomDocxName); | ||
expect(await personalFiles.viewer.isViewerOpened()).toBe(true); | ||
await personalFiles.dataTable.spinnerWaitForReload(); | ||
expect(await personalFiles.viewer.isCloseButtonDisplayed(), 'Close button is not displayed').toBe(true); | ||
expect(await personalFiles.viewer.isFileTitleDisplayed(), 'File title is not displayed').toBe(true); | ||
}); | ||
|
||
test('[C279271] Close the viewer', async ({ personalFiles }) => { | ||
await personalFiles.dataTable.performClickFolderOrFileToOpen(randomDocxName); | ||
expect(await personalFiles.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true); | ||
await personalFiles.viewer.closeButtonLocator.click(); | ||
expect(await personalFiles.viewer.isViewerOpened(), 'Viewer did not close').toBe(false); | ||
}); | ||
|
||
test('[C284632] Close button tooltip', async ({ personalFiles }) => { | ||
await personalFiles.dataTable.performClickFolderOrFileToOpen(randomDocxName); | ||
expect(await personalFiles.viewer.getCloseButtonTooltip()).toEqual('Close'); | ||
}); | ||
|
||
test('[C279285] Viewer opens when accessing the preview URL for a file', async ({ personalFiles }) => { | ||
const previewURL = `#/personal-files/${folderId}/(viewer:view/${fileDocxId})`; | ||
await personalFiles.navigate({ remoteUrl: previewURL }); | ||
await personalFiles.dataTable.spinnerWaitForReload(); | ||
expect(await personalFiles.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true); | ||
expect(await personalFiles.viewer.fileTitleButtonLocator.innerText()).toEqual(randomDocxName); | ||
}); | ||
|
||
test('[C284636] Viewer opens for a file from Recent Files', async ({ personalFiles, recentFilesPage }) => { | ||
await personalFiles.dataTable.performClickFolderOrFileToOpen(randomDocxName); | ||
expect(await personalFiles.viewer.getCloseButtonTooltip()).toEqual('Close'); | ||
await recentFilesPage.navigate(); | ||
await recentFilesPage.reload(); | ||
await recentFilesPage.dataTable.performClickFolderOrFileToOpen(randomDocxName); | ||
expect(await recentFilesPage.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true); | ||
expect(await recentFilesPage.viewer.isCloseButtonDisplayed(), 'Close button is not displayed').toBe(true); | ||
expect(await recentFilesPage.viewer.isFileTitleDisplayed(), 'File title is not displayed').toBe(true); | ||
}); | ||
|
||
test('[C284635] Viewer opens for a file from Shared Files', async ({ sharedPage }) => { | ||
await sharedPage.navigate(); | ||
await sharedPage.reload(); | ||
await sharedPage.dataTable.performClickFolderOrFileToOpen(randomDocxName); | ||
expect(await sharedPage.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true); | ||
expect(await sharedPage.viewer.isCloseButtonDisplayed(), 'Close button is not displayed').toBe(true); | ||
expect(await sharedPage.viewer.isFileTitleDisplayed(), 'File title is not displayed').toBe(true); | ||
}); | ||
|
||
test('[C284634] Viewer opens for a file from Favorites', async ({ favoritePage }) => { | ||
await favoritePage.navigate({ waitUntil: 'domcontentloaded' }); | ||
await favoritePage.dataTable.performClickFolderOrFileToOpen(randomDocxName); | ||
expect(await favoritePage.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true); | ||
expect(await favoritePage.viewer.isCloseButtonDisplayed(), 'Close button is not displayed').toBe(true); | ||
expect(await favoritePage.viewer.isFileTitleDisplayed(), 'File title is not displayed').toBe(true); | ||
}); | ||
|
||
test('[C279175] Viewer opens for a file from Search Results', async ({ personalFiles, searchPage }) => { | ||
await personalFiles.acaHeader.searchButton.click(); | ||
await searchPage.searchInput.searchButton.click(); | ||
await searchPage.searchOverlay.checkFilesAndFolders(); | ||
await searchPage.searchOverlay.searchFor(randomDocxName); | ||
await searchPage.reload({ waitUntil: 'domcontentloaded' }); | ||
|
||
await searchPage.searchInput.performDoubleClickFolderOrFileToOpen(randomDocxName); | ||
expect(await searchPage.viewer.isViewerOpened(), 'Viewer is not opened').toBe(true); | ||
expect(await searchPage.viewer.isCloseButtonDisplayed(), 'Close button is not displayed').toBe(true); | ||
expect(await searchPage.viewer.isFileTitleDisplayed(), 'File title is not displayed').toBe(true); | ||
}); | ||
}); |
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,12 @@ | ||
{ | ||
"extends": "../../../tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "../../out-tsc/e2e", | ||
"baseUrl": "./", | ||
"module": "commonjs", | ||
"target": "es2017", | ||
"types": ["jasmine", "jasminewd2", "node", "@playwright/test"], | ||
"skipLibCheck": true, | ||
}, | ||
"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
Oops, something went wrong.