diff --git a/.github/actions/run-e2e-playwright/action.yml b/.github/actions/run-e2e-playwright/action.yml new file mode 100644 index 000000000..b0364c946 --- /dev/null +++ b/.github/actions/run-e2e-playwright/action.yml @@ -0,0 +1,57 @@ +name: "Run e2e Playwright" +description: "Run e2e Playwright" + +inputs: + options: + description: 'Options' + required: true + type: string + test-runner: + description: 'Test runner' + required: false + type: string + default: 'Playwright' + artifact-name: + description: Name of the artifact cache + required: true + type: string + +runs: + using: "composite" + steps: + - name: Setup and run with options + shell: bash + run: | + # npx http-server -c-1 $CONTENT_CE_DIST_PATH -p 4200 > /dev/null &\ + + { + echo "APP_CONFIG_ECM_HOST={protocol}//{hostname}{:port}" + echo "APP_CONFIG_PLUGIN_FOLDER_RULES=true" + echo "APP_CONFIG_PLUGIN_AOS=true" + echo "APP_CONFIG_PLUGIN_CONTENT_SERVICE=true" + echo "APP_CONFIG_ENABLE_MOBILE_APP_SWITCH=false" + echo "APP_CONFIG_PROVIDER=ECM" + echo "APP_CONFIG_AUTH_TYPE=BASIC" + echo "APP_CONFIG_OAUTH2_HOST=http://localhost:4200/auth/realms/alfresco" + echo "APP_CONFIG_OAUTH2_CLIENTID=alfresco" + echo "APP_CONFIG_SESSION_TIME_FOR_OPEN_APP_DIALOG_DISPLAY_IN_HOURS=12" + echo "APP_CONFIG_OAUTH2_IMPLICIT_FLOW=true" + echo "APP_CONFIG_OAUTH2_SILENT_LOGIN=true" + echo "APP_CONFIG_OAUTH2_REDIRECT_LOGOUT=/" + echo "APP_CONFIG_OAUTH2_REDIRECT_LOGIN=/" + echo "APP_CONFIG_OAUTH2_REDIRECT_SILENT_IFRAME_URI={protocol}//{hostname}{:port}/assets/silent-refresh.html" + } >> .env + + npm start > /dev/null &\ + + echo "Running playwright tests with options ${{ inputs.options }}" + sleep 90 + npx nx run ${{ inputs.options }}-e2e:e2e + + + - name: Upload E2Es results + if: ${{ always() }} + uses: actions/upload-artifact@v3 + with: + name: ${{ inputs.artifact-name }} + path: test-results/ diff --git a/.github/actions/run-e2e/action.yml b/.github/actions/run-e2e/action.yml index 4725b49ab..5e52b0669 100644 --- a/.github/actions/run-e2e/action.yml +++ b/.github/actions/run-e2e/action.yml @@ -22,7 +22,7 @@ runs: - name: Setup and run with options shell: bash run: | - ./node_modules/.bin/tsc -p "./e2e/$E2E_TSCONFIG" || exit 1; + ./node_modules/.bin/tsc -p "./e2e/protractor/$E2E_TSCONFIG" || exit 1; # npx http-server -c-1 $CONTENT_CE_DIST_PATH -p 4200 > /dev/null &\ { @@ -48,7 +48,7 @@ runs: if [ ${{ inputs.test-runner }} == "playwright" ]; then echo "Running playwright tests with options ${{ inputs.options }}" sleep 90 - npx playwright test --config ${{ inputs.options }} + npx nx run ${{ inputs.options }}-e2e:e2e else echo "Running protractor tests with options ${{ inputs.options }}" echo "./node_modules/.bin/protractor \"./protractor.conf.js\" ${{ inputs.options }} || exit 1" diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 5a81c3415..82846abc7 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -13,6 +13,14 @@ env: APP_CONFIG_ECM_HOST: ${{ secrets.PIPELINE_ENV_URL }} ADMIN_EMAIL: ${{ secrets.PIPELINE_ADMIN_USERNAME }} ADMIN_PASSWORD: ${{ secrets.PIPELINE_ADMIN_PASSWORD }} + HR_USER: ${{ secrets.HR_USER }} + HR_USER_PASSWORD: ${{ secrets.HR_USER_PASSWORD }} + SUPERADMIN_EMAIL: ${{ secrets.SUPERADMIN_EMAIL }} + SUPERADMIN_PASSWORD: ${{ secrets.SUPERADMIN_PASSWORD }} + IDENTITY_USER_EMAIL: ${{ secrets.IDENTITY_USER_EMAIL }} + IDENTITY_USER_PASSWORD: ${{ secrets.IDENTITY_USER_PASSWORD }} + CONTENT_IDENTITY_USERNAME: ${{ secrets.CONTENT_IDENTITY_USERNAME }} + CONTENT_IDENTITY_PASSWORD: ${{ secrets.CONTENT_IDENTITY_PASSWORD }} SCREENSHOT_USERNAME: ${{ secrets.SCREENSHOT_USERNAME }} SCREENSHOT_PASSWORD: ${{ secrets.SCREENSHOT_PASSWORD}} AWS_REGION: "eu-west-2" @@ -177,8 +185,16 @@ jobs: e2es-playwright: needs: [lint, build, unit-tests] - name: 'E2e test suites: Folder Rules - Playwright' + name: 'E2e test suites: Playwright' runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + e2e-suites: + - name: "actions" + id: 1 + - name: "folder-rules" + id: 2 steps: - name: Checkout uses: actions/checkout@v3 @@ -203,10 +219,10 @@ jobs: - name: before playwright shell: bash run: npx playwright install chromium - - uses: ./.github/actions/run-e2e + - uses: ./.github/actions/run-e2e-playwright with: - options: "e2e/playwright/tests/folder-rules/playwright.config.ts" - artifact-name: folder-rules + options: "${{ matrix.e2e-suites.name }}" + artifact-name: ${{ matrix.e2e-suites.name }} test-runner: playwright - uses: ./.github/actions/after-e2e diff --git a/e2e/playwright/actions/.eslintrc.json b/e2e/playwright/actions/.eslintrc.json new file mode 100644 index 000000000..67b7dbf29 --- /dev/null +++ b/e2e/playwright/actions/.eslintrc.json @@ -0,0 +1,26 @@ +{ + "extends": "../../../.eslintrc.json", + "ignorePatterns": [ + "!**/*" + ], + "overrides": [ + { + "files": [ + "*.ts" + ], + "parserOptions": { + "project": [ + "e2e/playwright/actions/tsconfig.e2e.json" + ], + "createDefaultProgram": true + }, + "plugins": [ + "rxjs", + "unicorn" + ], + "rules": { + "@typescript-eslint/no-floating-promises": "off" + } + } + ] +} diff --git a/e2e/playwright/actions/exclude.tests.json b/e2e/playwright/actions/exclude.tests.json new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/e2e/playwright/actions/exclude.tests.json @@ -0,0 +1 @@ +{} diff --git a/e2e/playwright/shared/page-objects/components/dataTable/mat-menu.component.ts b/e2e/playwright/actions/playwright.config.ts similarity index 68% rename from e2e/playwright/shared/page-objects/components/dataTable/mat-menu.component.ts rename to e2e/playwright/actions/playwright.config.ts index 92953f751..9b921ce47 100644 --- a/e2e/playwright/shared/page-objects/components/dataTable/mat-menu.component.ts +++ b/e2e/playwright/actions/playwright.config.ts @@ -22,17 +22,23 @@ * from Hyland Software. If not, see . */ -import { Page } from '@playwright/test'; -import { BaseComponent } from '../base.component'; +import { PlaywrightTestConfig } from '@playwright/test'; +import { CustomConfig, getGlobalConfig, getExcludedTestsRegExpArray } from '@alfresco/playwright-shared'; +import EXCLUDED_JSON from './exclude.tests.json'; -export class MatMenuComponent extends BaseComponent { - private static rootElement = '.mat-menu-content'; +const config: PlaywrightTestConfig = { + ...getGlobalConfig, - constructor(page: Page) { - super(page, MatMenuComponent.rootElement); - } + grepInvert: getExcludedTestsRegExpArray(EXCLUDED_JSON, 'Actions'), + projects: [ + { + name: 'Actions', + testDir: './src/tests', + use: { + users: ['hruser'] + } + } + ] +}; - public getMenuItemsLocator = this.getChild('button'); - - public getButtonByText = (text: string) => this.getChild('button', { hasText: text }); -} +export default config; diff --git a/e2e/playwright/actions/project.json b/e2e/playwright/actions/project.json new file mode 100644 index 000000000..c7228bfa0 --- /dev/null +++ b/e2e/playwright/actions/project.json @@ -0,0 +1,34 @@ +{ + "$schema": "../../../node_modules/nx/schemas/project-schema.json", + "name": "actions-e2e", + "sourceRoot": "e2e/playwright/actions/src", + "projectType": "application", + "targets": { + "e2e": { + "executor": "nx:run-commands", + "options": { + "commands": [ + "npx playwright test --config=e2e/playwright/actions/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}"] + } + } +} diff --git a/e2e/playwright/actions/src/tests/create-folder.spec.ts b/e2e/playwright/actions/src/tests/create-folder.spec.ts new file mode 100644 index 000000000..585a66d07 --- /dev/null +++ b/e2e/playwright/actions/src/tests/create-folder.spec.ts @@ -0,0 +1,50 @@ +/*! + * 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 . + */ + +import { expect } from '@playwright/test'; +import { getUserState, test } from '@alfresco/playwright-shared'; + +test.use({ storageState: getUserState('hruser') }); +test.describe('Create actions', () => { + let randomFolderName: string; + + test.beforeEach(async ({ personalFiles }) => { + randomFolderName = `playwright-folder-${(Math.random() + 1).toString(36).substring(6)}`; + await personalFiles.navigate(); + }); + + test.afterEach(async ({ personalFiles }) => { + await personalFiles.dataTable.performActionFromExpandableMenu(randomFolderName, 'Delete'); + }); + + test('[C216341] Create a folder with name only', async ({ personalFiles }) => { + await personalFiles.acaHeader.createButton.click(); + await personalFiles.matMenu.createFolder.click(); + await personalFiles.folderDialog.folderNameInputLocator.fill(randomFolderName); + await personalFiles.folderDialog.createButton.click(); + + await personalFiles.dataTable.goThroughPagesLookingForRowWithName(randomFolderName); + await expect(personalFiles.dataTable.getRowByName(randomFolderName)).toBeVisible(); + }); +}); diff --git a/e2e/playwright/actions/tsconfig.e2e.adf.json b/e2e/playwright/actions/tsconfig.e2e.adf.json new file mode 100644 index 000000000..87cbcf775 --- /dev/null +++ b/e2e/playwright/actions/tsconfig.e2e.adf.json @@ -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"] +} diff --git a/e2e/playwright/actions/tsconfig.e2e.json b/e2e/playwright/actions/tsconfig.e2e.json new file mode 100755 index 000000000..d1d140fba --- /dev/null +++ b/e2e/playwright/actions/tsconfig.e2e.json @@ -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"] +} diff --git a/e2e/playwright/folder-rules/.eslintrc.json b/e2e/playwright/folder-rules/.eslintrc.json new file mode 100644 index 000000000..d241111e1 --- /dev/null +++ b/e2e/playwright/folder-rules/.eslintrc.json @@ -0,0 +1,26 @@ +{ + "extends": "../../../.eslintrc.json", + "ignorePatterns": [ + "!**/*" + ], + "overrides": [ + { + "files": [ + "*.ts" + ], + "parserOptions": { + "project": [ + "e2e/playwright/folder-rules/tsconfig.e2e.json" + ], + "createDefaultProgram": true + }, + "plugins": [ + "rxjs", + "unicorn" + ], + "rules": { + "@typescript-eslint/no-floating-promises": "off" + } + } + ] +} diff --git a/e2e/playwright/folder-rules/exclude.tests.json b/e2e/playwright/folder-rules/exclude.tests.json new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/e2e/playwright/folder-rules/exclude.tests.json @@ -0,0 +1 @@ +{} diff --git a/e2e/playwright/folder-rules/playwright.config.ts b/e2e/playwright/folder-rules/playwright.config.ts new file mode 100644 index 000000000..8a4f25ecb --- /dev/null +++ b/e2e/playwright/folder-rules/playwright.config.ts @@ -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 . + */ + +import { PlaywrightTestConfig } from '@playwright/test'; +import { CustomConfig, getGlobalConfig, getExcludedTestsRegExpArray } from '@alfresco/playwright-shared'; +import EXCLUDED_JSON from './exclude.tests.json'; + +const config: PlaywrightTestConfig = { + ...getGlobalConfig, + + grepInvert: getExcludedTestsRegExpArray(EXCLUDED_JSON, 'Folder Rules'), + projects: [ + { + name: 'Folder Rules', + testDir: './src/tests', + use: { + users: ['admin'] + } + } + ] +}; + +export default config; diff --git a/e2e/playwright/folder-rules/project.json b/e2e/playwright/folder-rules/project.json new file mode 100644 index 000000000..f279a4ba6 --- /dev/null +++ b/e2e/playwright/folder-rules/project.json @@ -0,0 +1,34 @@ +{ + "$schema": "../../../node_modules/nx/schemas/project-schema.json", + "name": "folder-rules-e2e", + "sourceRoot": "e2e/playwright/folder-rules/src", + "projectType": "application", + "targets": { + "e2e": { + "executor": "nx:run-commands", + "options": { + "commands": [ + "npx playwright test --config=e2e/playwright/folder-rules/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}"] + } + } +} diff --git a/e2e/playwright/tests/folder-rules/tests/actions.spec.ts b/e2e/playwright/folder-rules/src/tests/actions.spec.ts similarity index 83% rename from e2e/playwright/tests/folder-rules/tests/actions.spec.ts rename to e2e/playwright/folder-rules/src/tests/actions.spec.ts index 860b8354b..2bbcf9542 100644 --- a/e2e/playwright/tests/folder-rules/tests/actions.spec.ts +++ b/e2e/playwright/folder-rules/src/tests/actions.spec.ts @@ -22,10 +22,10 @@ * from Hyland Software. If not, see . */ -import { test } from '../fixtures/page-initialization'; -import { ActionType } from '../page-objects/components/actions-dropdown.component'; import { expect } from '@playwright/test'; +import { ActionType, getUserState, test } from '@alfresco/playwright-shared'; +test.use({ storageState: getUserState('admin') }); test.describe('Folder Rules Actions', () => { const randomFolderName = `playwright-folder-${(Math.random() + 1).toString(36).substring(6)}`; const randomRuleName = `playwright-rule-${(Math.random() + 1).toString(36).substring(6)}`; @@ -36,8 +36,8 @@ test.describe('Folder Rules Actions', () => { let folderId: string; - test.beforeAll(async ({ apiClient }) => { - const node = await apiClient.nodes.createNode('-my-', { name: randomFolderName, nodeType: 'cm:folder', relativePath: '/' }); + test.beforeAll(async ({ superAdminApiClient }) => { + const node = await superAdminApiClient.nodes.createNode('-my-', { name: randomFolderName, nodeType: 'cm:folder', relativePath: '/' }); folderId = node.entry.id; }); @@ -45,15 +45,15 @@ test.describe('Folder Rules Actions', () => { await personalFiles.navigate({ waitUntil: 'domcontentloaded' }); }); - test.afterAll(async ({ apiClient }) => { - await apiClient.nodes.deleteNode(folderId); + test.afterAll(async ({ superAdminApiClient }) => { + await superAdminApiClient.nodes.deleteNode(folderId); }); - test('Create a rule with actions', async ({ personalFiles, nodesPage }) => { + test('[C691637] Create a rule with actions', async ({ personalFiles, nodesPage }) => { await personalFiles.dataTable.performActionFromExpandableMenu(randomFolderName, 'Manage rules'); await nodesPage.toolbar.clickCreateRuleButton(); - await nodesPage.manageRulesDialog.typeRuleName(randomRuleName); + await nodesPage.manageRulesDialog.ruleNameInputLocator.type(randomRuleName); await nodesPage.actionsDropdown.selectAction(ActionType.HideRecord, 0); await nodesPage.actionsDropdown.selectAction(ActionType.IncrementCounter, 1); diff --git a/e2e/playwright/tests/folder-rules/tests/conditions.spec.ts b/e2e/playwright/folder-rules/src/tests/conditions.spec.ts similarity index 77% rename from e2e/playwright/tests/folder-rules/tests/conditions.spec.ts rename to e2e/playwright/folder-rules/src/tests/conditions.spec.ts index ce5136d4e..283ddd5fe 100644 --- a/e2e/playwright/tests/folder-rules/tests/conditions.spec.ts +++ b/e2e/playwright/folder-rules/src/tests/conditions.spec.ts @@ -22,11 +22,10 @@ * from Hyland Software. If not, see . */ -import { test } from '../fixtures/page-initialization'; -import { ActionType } from '../page-objects/components/actions-dropdown.component'; -import { Comparator, Field } from '../page-objects/components/conditions.component'; import { expect } from '@playwright/test'; +import { ActionType, Comparator, Field, getUserState, test } from '@alfresco/playwright-shared'; +test.use({ storageState: getUserState('admin') }); test.describe('Folder Rules Conditions', () => { const randomFolderName = `playwright-folder-${(Math.random() + 1).toString(36).substring(6)}`; const randomRuleName = `playwright-rule-${(Math.random() + 1).toString(36).substring(6)}`; @@ -34,8 +33,8 @@ test.describe('Folder Rules Conditions', () => { let folderId: string; - test.beforeAll(async ({ apiClient }) => { - const node = await apiClient.nodes.createNode('-my-', { name: randomFolderName, nodeType: 'cm:folder', relativePath: '/' }); + test.beforeAll(async ({ superAdminApiClient }) => { + const node = await superAdminApiClient.nodes.createNode('-my-', { name: randomFolderName, nodeType: 'cm:folder', relativePath: '/' }); folderId = node.entry.id; }); @@ -43,18 +42,18 @@ test.describe('Folder Rules Conditions', () => { await personalFiles.navigate(); }); - test.afterAll(async ({ apiClient }) => { - await apiClient.nodes.deleteNode(folderId); + test.afterAll(async ({ superAdminApiClient }) => { + await superAdminApiClient.nodes.deleteNode(folderId); }); - test('Create a rule with condition', async ({ personalFiles, nodesPage }) => { + test('[C691638] Create a rule with condition', async ({ personalFiles, nodesPage }) => { await personalFiles.dataTable.performActionFromExpandableMenu(randomFolderName, 'Manage rules'); await nodesPage.toolbar.clickCreateRuleButton(); - await nodesPage.manageRulesDialog.typeRuleName(randomRuleName); + await nodesPage.manageRulesDialog.ruleNameInputLocator.type(randomRuleName); await nodesPage.conditionsDropdown.addCondition(Field.Size, Comparator.Equals, specialChars, 0); await nodesPage.conditionsDropdown.addCondition(Field.Size, Comparator.Equals, specialChars, 1); - await nodesPage.conditionsDropdown.createConditionGroup(); + await nodesPage.conditionsDropdown.addConditionGroupButton.click(); await nodesPage.conditionsDropdown.addConditionGroup(Field.Size, Comparator.Equals, specialChars, 0); await nodesPage.conditionsDropdown.addConditionGroup(Field.Size, Comparator.Equals, specialChars, 1); await nodesPage.actionsDropdown.selectAction(ActionType.IncrementCounter, 0); diff --git a/e2e/playwright/tests/folder-rules/tests/manage-rules.spec.ts b/e2e/playwright/folder-rules/src/tests/manage-rules.spec.ts similarity index 74% rename from e2e/playwright/tests/folder-rules/tests/manage-rules.spec.ts rename to e2e/playwright/folder-rules/src/tests/manage-rules.spec.ts index 0c18c6106..6683de63e 100644 --- a/e2e/playwright/tests/folder-rules/tests/manage-rules.spec.ts +++ b/e2e/playwright/folder-rules/src/tests/manage-rules.spec.ts @@ -22,29 +22,30 @@ * from Hyland Software. If not, see . */ -import { test } from '../fixtures/page-initialization'; +import { getUserState, test } from '@alfresco/playwright-shared'; +test.use({ storageState: getUserState('admin') }); test.describe('Rules - Manage Rules', () => { const randomName = `playwright-folder-${(Math.random() + 1).toString(36).substring(6)}`; const randomRuleName = `playwright-rule-${(Math.random() + 1).toString(36).substring(6)}`; let folderId: string; - test.beforeAll(async ({ apiClient }) => { - const node = await apiClient.nodes.createNode('-my-', { name: randomName, nodeType: 'cm:folder', relativePath: '/' }); + test.beforeAll(async ({ superAdminApiClient }) => { + const node = await superAdminApiClient.nodes.createNode('-my-', { name: randomName, nodeType: 'cm:folder', relativePath: '/' }); folderId = node.entry.id; - await apiClient.createRandomRule(folderId, randomRuleName); + await superAdminApiClient.createRandomRule(folderId, randomRuleName); }); test.beforeEach(async ({ personalFiles }) => { await personalFiles.navigate(); }); - test.afterAll(async ({ apiClient }) => { - await apiClient.nodes.deleteNode(folderId); + test.afterAll(async ({ superAdminApiClient }) => { + await superAdminApiClient.nodes.deleteNode(folderId); }); - test('Disable an existing rule', async ({ personalFiles, nodesPage }) => { + test('[C691651] Disable an existing rule', async ({ personalFiles, nodesPage }) => { await personalFiles.dataTable.performActionFromExpandableMenu(randomName, 'Manage rules'); await nodesPage.manageRules.disableRuleToggle.click(); }); diff --git a/e2e/playwright/folder-rules/tsconfig.e2e.adf.json b/e2e/playwright/folder-rules/tsconfig.e2e.adf.json new file mode 100644 index 000000000..87cbcf775 --- /dev/null +++ b/e2e/playwright/folder-rules/tsconfig.e2e.adf.json @@ -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"] +} diff --git a/e2e/playwright/folder-rules/tsconfig.e2e.json b/e2e/playwright/folder-rules/tsconfig.e2e.json new file mode 100755 index 000000000..d1d140fba --- /dev/null +++ b/e2e/playwright/folder-rules/tsconfig.e2e.json @@ -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"] +} diff --git a/e2e/playwright/shared/package.json b/e2e/playwright/shared/package.json deleted file mode 100644 index c7bc52fd2..000000000 --- a/e2e/playwright/shared/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "playwright-shared", - "version": "3.0.0", - "main": "index.ts", - "dependencies": { - "tslib": "^2.0.0" - } -} diff --git a/e2e/playwright/shared/page-objects/index.ts b/e2e/playwright/shared/page-objects/index.ts deleted file mode 100644 index 7d4708465..000000000 --- a/e2e/playwright/shared/page-objects/index.ts +++ /dev/null @@ -1,29 +0,0 @@ -/*! - * 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 . - */ - -export * from './global-variables'; -export * from './playwright-base'; -export * from './components'; -export * from './components/dataTable'; -export * from './pages'; diff --git a/e2e/.eslintrc.json b/e2e/protractor/.eslintrc.json similarity index 81% rename from e2e/.eslintrc.json rename to e2e/protractor/.eslintrc.json index 700775812..6ae84700d 100644 --- a/e2e/.eslintrc.json +++ b/e2e/protractor/.eslintrc.json @@ -1,5 +1,5 @@ { - "extends": "../.eslintrc.json", + "extends": "../../.eslintrc.json", "ignorePatterns": [ "!**/*" ], @@ -10,7 +10,7 @@ ], "parserOptions": { "project": [ - "e2e/tsconfig.e2e.json" + "e2e/protractor/tsconfig.e2e.json" ], "createDefaultProgram": true }, diff --git a/e2e/e2e-config/utils/build-number.js b/e2e/protractor/e2e-config/utils/build-number.js similarity index 100% rename from e2e/e2e-config/utils/build-number.js rename to e2e/protractor/e2e-config/utils/build-number.js diff --git a/e2e/e2e-config/utils/upload-output.js b/e2e/protractor/e2e-config/utils/upload-output.js similarity index 100% rename from e2e/e2e-config/utils/upload-output.js rename to e2e/protractor/e2e-config/utils/upload-output.js diff --git a/e2e/project.json b/e2e/protractor/project.json similarity index 92% rename from e2e/project.json rename to e2e/protractor/project.json index db7613fd9..ca6a4c653 100644 --- a/e2e/project.json +++ b/e2e/protractor/project.json @@ -1,5 +1,5 @@ { - "$schema": "../node_modules/nx/schemas/project-schema.json", + "$schema": "../../node_modules/nx/schemas/project-schema.json", "name": "app-e2e", "sourceRoot": "e2e", "projectType": "application", diff --git a/e2e/protractor.excludes.json b/e2e/protractor/protractor.excludes.json similarity index 100% rename from e2e/protractor.excludes.json rename to e2e/protractor/protractor.excludes.json diff --git a/e2e/resources/extensibility-configs/context-submenus-ext.json b/e2e/protractor/resources/extensibility-configs/context-submenus-ext.json similarity index 99% rename from e2e/resources/extensibility-configs/context-submenus-ext.json rename to e2e/protractor/resources/extensibility-configs/context-submenus-ext.json index 94bb45d02..336f324a7 100644 --- a/e2e/resources/extensibility-configs/context-submenus-ext.json +++ b/e2e/protractor/resources/extensibility-configs/context-submenus-ext.json @@ -1,5 +1,5 @@ { - "$schema": "../../extension.schema.json", + "$schema": "../../../../extension.schema.json", "$id": "app.core", "$name": "app.core", "$version": "1.0.0", diff --git a/e2e/resources/extensibility-configs/document-presets-ext.json b/e2e/protractor/resources/extensibility-configs/document-presets-ext.json similarity index 99% rename from e2e/resources/extensibility-configs/document-presets-ext.json rename to e2e/protractor/resources/extensibility-configs/document-presets-ext.json index fc3ab4bbc..84229b582 100644 --- a/e2e/resources/extensibility-configs/document-presets-ext.json +++ b/e2e/protractor/resources/extensibility-configs/document-presets-ext.json @@ -1,5 +1,5 @@ { - "$schema": "../../extension.schema.json", + "$schema": "../../../../extension.schema.json", "$id": "app.core", "$name": "app.core", "$version": "1.0.0", diff --git a/e2e/resources/extensibility-configs/header-ext.json b/e2e/protractor/resources/extensibility-configs/header-ext.json similarity index 99% rename from e2e/resources/extensibility-configs/header-ext.json rename to e2e/protractor/resources/extensibility-configs/header-ext.json index 5b5ea0efa..7d265f828 100644 --- a/e2e/resources/extensibility-configs/header-ext.json +++ b/e2e/protractor/resources/extensibility-configs/header-ext.json @@ -1,5 +1,5 @@ { - "$schema": "../../extension.schema.json", + "$schema": "../../../../extension.schema.json", "$id": "app.core", "$name": "app.core", "$version": "1.0.0", diff --git a/e2e/resources/extensibility-configs/info-drawer-ext.json b/e2e/protractor/resources/extensibility-configs/info-drawer-ext.json similarity index 99% rename from e2e/resources/extensibility-configs/info-drawer-ext.json rename to e2e/protractor/resources/extensibility-configs/info-drawer-ext.json index f03205721..333933877 100644 --- a/e2e/resources/extensibility-configs/info-drawer-ext.json +++ b/e2e/protractor/resources/extensibility-configs/info-drawer-ext.json @@ -1,5 +1,5 @@ { - "$schema": "../../extension.schema.json", + "$schema": "../../../../extension.schema.json", "$id": "app.core", "$name": "app.core", "$version": "1.0.0", diff --git a/e2e/resources/extensibility-configs/info-drawer-no-tabs-ext.json b/e2e/protractor/resources/extensibility-configs/info-drawer-no-tabs-ext.json similarity index 99% rename from e2e/resources/extensibility-configs/info-drawer-no-tabs-ext.json rename to e2e/protractor/resources/extensibility-configs/info-drawer-no-tabs-ext.json index d50b8d784..531c134f5 100644 --- a/e2e/resources/extensibility-configs/info-drawer-no-tabs-ext.json +++ b/e2e/protractor/resources/extensibility-configs/info-drawer-no-tabs-ext.json @@ -1,5 +1,5 @@ { - "$schema": "../../extension.schema.json", + "$schema": "../../../../extension.schema.json", "$id": "app.core", "$name": "app.core", "$version": "1.0.0", diff --git a/e2e/resources/extensibility-configs/metadata-ext.json b/e2e/protractor/resources/extensibility-configs/metadata-ext.json similarity index 99% rename from e2e/resources/extensibility-configs/metadata-ext.json rename to e2e/protractor/resources/extensibility-configs/metadata-ext.json index ea508fdd5..3fc4312a9 100644 --- a/e2e/resources/extensibility-configs/metadata-ext.json +++ b/e2e/protractor/resources/extensibility-configs/metadata-ext.json @@ -1,5 +1,5 @@ { - "$schema": "../../extension.schema.json", + "$schema": "../../../../extension.schema.json", "$id": "app.core", "$name": "app.core", "$version": "1.0.0", diff --git a/e2e/resources/extensibility-configs/viewer-ext.json b/e2e/protractor/resources/extensibility-configs/viewer-ext.json similarity index 99% rename from e2e/resources/extensibility-configs/viewer-ext.json rename to e2e/protractor/resources/extensibility-configs/viewer-ext.json index be6702d8e..141e1c8c3 100644 --- a/e2e/resources/extensibility-configs/viewer-ext.json +++ b/e2e/protractor/resources/extensibility-configs/viewer-ext.json @@ -1,5 +1,5 @@ { - "$schema": "../../extension.schema.json", + "$schema": "../../../../extension.schema.json", "$id": "app.core", "$name": "app.core", "$version": "1.0.0", diff --git a/e2e/resources/test-files/file-docx.docx b/e2e/protractor/resources/test-files/file-docx.docx similarity index 100% rename from e2e/resources/test-files/file-docx.docx rename to e2e/protractor/resources/test-files/file-docx.docx diff --git a/e2e/resources/test-files/file-jpg.jpg b/e2e/protractor/resources/test-files/file-jpg.jpg similarity index 100% rename from e2e/resources/test-files/file-jpg.jpg rename to e2e/protractor/resources/test-files/file-jpg.jpg diff --git a/e2e/resources/test-files/file-pdf.pdf b/e2e/protractor/resources/test-files/file-pdf.pdf similarity index 100% rename from e2e/resources/test-files/file-pdf.pdf rename to e2e/protractor/resources/test-files/file-pdf.pdf diff --git a/e2e/resources/test-files/file-xlsx.xlsx b/e2e/protractor/resources/test-files/file-xlsx.xlsx similarity index 100% rename from e2e/resources/test-files/file-xlsx.xlsx rename to e2e/protractor/resources/test-files/file-xlsx.xlsx diff --git a/e2e/resources/test-files/file2-docx.docx b/e2e/protractor/resources/test-files/file2-docx.docx similarity index 100% rename from e2e/resources/test-files/file2-docx.docx rename to e2e/protractor/resources/test-files/file2-docx.docx diff --git a/e2e/resources/test-files/file2-xlsx.xlsx b/e2e/protractor/resources/test-files/file2-xlsx.xlsx similarity index 100% rename from e2e/resources/test-files/file2-xlsx.xlsx rename to e2e/protractor/resources/test-files/file2-xlsx.xlsx diff --git a/e2e/resources/test-files/file_unsupported.3DS b/e2e/protractor/resources/test-files/file_unsupported.3DS similarity index 100% rename from e2e/resources/test-files/file_unsupported.3DS rename to e2e/protractor/resources/test-files/file_unsupported.3DS diff --git a/e2e/resources/test-files/protected.pdf b/e2e/protractor/resources/test-files/protected.pdf similarity index 100% rename from e2e/resources/test-files/protected.pdf rename to e2e/protractor/resources/test-files/protected.pdf diff --git a/e2e/smartrunner-factory.js b/e2e/protractor/smartrunner-factory.js similarity index 100% rename from e2e/smartrunner-factory.js rename to e2e/protractor/smartrunner-factory.js diff --git a/e2e/suites/actions-available/files-folders/folders-actions.test.ts b/e2e/protractor/suites/actions-available/files-folders/folders-actions.test.ts similarity index 100% rename from e2e/suites/actions-available/files-folders/folders-actions.test.ts rename to e2e/protractor/suites/actions-available/files-folders/folders-actions.test.ts diff --git a/e2e/suites/actions-available/files-folders/generic.test.ts b/e2e/protractor/suites/actions-available/files-folders/generic.test.ts similarity index 100% rename from e2e/suites/actions-available/files-folders/generic.test.ts rename to e2e/protractor/suites/actions-available/files-folders/generic.test.ts diff --git a/e2e/suites/actions-available/files-folders/locked-files-actions.test.ts b/e2e/protractor/suites/actions-available/files-folders/locked-files-actions.test.ts similarity index 100% rename from e2e/suites/actions-available/files-folders/locked-files-actions.test.ts rename to e2e/protractor/suites/actions-available/files-folders/locked-files-actions.test.ts diff --git a/e2e/suites/actions-available/files-folders/multiple-files-actions.test.ts b/e2e/protractor/suites/actions-available/files-folders/multiple-files-actions.test.ts similarity index 100% rename from e2e/suites/actions-available/files-folders/multiple-files-actions.test.ts rename to e2e/protractor/suites/actions-available/files-folders/multiple-files-actions.test.ts diff --git a/e2e/suites/actions-available/files-folders/office-files-actions.test.ts b/e2e/protractor/suites/actions-available/files-folders/office-files-actions.test.ts similarity index 100% rename from e2e/suites/actions-available/files-folders/office-files-actions.test.ts rename to e2e/protractor/suites/actions-available/files-folders/office-files-actions.test.ts diff --git a/e2e/suites/actions-available/files-folders/single-file-actions.test.ts b/e2e/protractor/suites/actions-available/files-folders/single-file-actions.test.ts similarity index 100% rename from e2e/suites/actions-available/files-folders/single-file-actions.test.ts rename to e2e/protractor/suites/actions-available/files-folders/single-file-actions.test.ts diff --git a/e2e/suites/actions-available/files-folders/test-data.ts b/e2e/protractor/suites/actions-available/files-folders/test-data.ts similarity index 100% rename from e2e/suites/actions-available/files-folders/test-data.ts rename to e2e/protractor/suites/actions-available/files-folders/test-data.ts diff --git a/e2e/suites/actions-available/files-folders/trash.test.ts b/e2e/protractor/suites/actions-available/files-folders/trash.test.ts similarity index 100% rename from e2e/suites/actions-available/files-folders/trash.test.ts rename to e2e/protractor/suites/actions-available/files-folders/trash.test.ts diff --git a/e2e/suites/actions-available/libraries/library-trash.test.ts b/e2e/protractor/suites/actions-available/libraries/library-trash.test.ts similarity index 100% rename from e2e/suites/actions-available/libraries/library-trash.test.ts rename to e2e/protractor/suites/actions-available/libraries/library-trash.test.ts diff --git a/e2e/suites/actions-available/libraries/library.test.ts b/e2e/protractor/suites/actions-available/libraries/library.test.ts similarity index 100% rename from e2e/suites/actions-available/libraries/library.test.ts rename to e2e/protractor/suites/actions-available/libraries/library.test.ts diff --git a/e2e/suites/actions-available/libraries/test-data-libraries.ts b/e2e/protractor/suites/actions-available/libraries/test-data-libraries.ts similarity index 100% rename from e2e/suites/actions-available/libraries/test-data-libraries.ts rename to e2e/protractor/suites/actions-available/libraries/test-data-libraries.ts diff --git a/e2e/suites/actions-available/new-menu/new-menu.test.ts b/e2e/protractor/suites/actions-available/new-menu/new-menu.test.ts similarity index 100% rename from e2e/suites/actions-available/new-menu/new-menu.test.ts rename to e2e/protractor/suites/actions-available/new-menu/new-menu.test.ts diff --git a/e2e/suites/actions-available/special-permissions/favorites.ts b/e2e/protractor/suites/actions-available/special-permissions/favorites.ts similarity index 100% rename from e2e/suites/actions-available/special-permissions/favorites.ts rename to e2e/protractor/suites/actions-available/special-permissions/favorites.ts diff --git a/e2e/suites/actions-available/special-permissions/my-libraries.ts b/e2e/protractor/suites/actions-available/special-permissions/my-libraries.ts similarity index 100% rename from e2e/suites/actions-available/special-permissions/my-libraries.ts rename to e2e/protractor/suites/actions-available/special-permissions/my-libraries.ts diff --git a/e2e/suites/actions-available/special-permissions/other-permissions.ts b/e2e/protractor/suites/actions-available/special-permissions/other-permissions.ts similarity index 100% rename from e2e/suites/actions-available/special-permissions/other-permissions.ts rename to e2e/protractor/suites/actions-available/special-permissions/other-permissions.ts diff --git a/e2e/suites/actions-available/special-permissions/search-results.ts b/e2e/protractor/suites/actions-available/special-permissions/search-results.ts similarity index 100% rename from e2e/suites/actions-available/special-permissions/search-results.ts rename to e2e/protractor/suites/actions-available/special-permissions/search-results.ts diff --git a/e2e/suites/actions-available/special-permissions/shared-files.ts b/e2e/protractor/suites/actions-available/special-permissions/shared-files.ts similarity index 100% rename from e2e/suites/actions-available/special-permissions/shared-files.ts rename to e2e/protractor/suites/actions-available/special-permissions/shared-files.ts diff --git a/e2e/suites/actions-available/special-permissions/special-permissions-actions.test.ts b/e2e/protractor/suites/actions-available/special-permissions/special-permissions-actions.test.ts similarity index 100% rename from e2e/suites/actions-available/special-permissions/special-permissions-actions.test.ts rename to e2e/protractor/suites/actions-available/special-permissions/special-permissions-actions.test.ts diff --git a/e2e/suites/actions-available/special-permissions/test-data-permissions.ts b/e2e/protractor/suites/actions-available/special-permissions/test-data-permissions.ts similarity index 100% rename from e2e/suites/actions-available/special-permissions/test-data-permissions.ts rename to e2e/protractor/suites/actions-available/special-permissions/test-data-permissions.ts diff --git a/e2e/suites/actions-available/special-permissions/viewer.ts b/e2e/protractor/suites/actions-available/special-permissions/viewer.ts similarity index 100% rename from e2e/suites/actions-available/special-permissions/viewer.ts rename to e2e/protractor/suites/actions-available/special-permissions/viewer.ts diff --git a/e2e/suites/actions-available/test-util.ts b/e2e/protractor/suites/actions-available/test-util.ts similarity index 100% rename from e2e/suites/actions-available/test-util.ts rename to e2e/protractor/suites/actions-available/test-util.ts diff --git a/e2e/suites/actions/copy-move/copy.test.ts b/e2e/protractor/suites/actions/copy-move/copy.test.ts similarity index 100% rename from e2e/suites/actions/copy-move/copy.test.ts rename to e2e/protractor/suites/actions/copy-move/copy.test.ts diff --git a/e2e/suites/actions/copy-move/destination-picker-dialog.test.ts b/e2e/protractor/suites/actions/copy-move/destination-picker-dialog.test.ts similarity index 100% rename from e2e/suites/actions/copy-move/destination-picker-dialog.test.ts rename to e2e/protractor/suites/actions/copy-move/destination-picker-dialog.test.ts diff --git a/e2e/suites/actions/copy-move/move.test.ts b/e2e/protractor/suites/actions/copy-move/move.test.ts similarity index 100% rename from e2e/suites/actions/copy-move/move.test.ts rename to e2e/protractor/suites/actions/copy-move/move.test.ts diff --git a/e2e/suites/actions/create/create-file-from-template.test.ts b/e2e/protractor/suites/actions/create/create-file-from-template.test.ts similarity index 100% rename from e2e/suites/actions/create/create-file-from-template.test.ts rename to e2e/protractor/suites/actions/create/create-file-from-template.test.ts diff --git a/e2e/suites/actions/create/create-folder-from-template.test.ts b/e2e/protractor/suites/actions/create/create-folder-from-template.test.ts similarity index 100% rename from e2e/suites/actions/create/create-folder-from-template.test.ts rename to e2e/protractor/suites/actions/create/create-folder-from-template.test.ts diff --git a/e2e/suites/actions/create/create-folder.test.ts b/e2e/protractor/suites/actions/create/create-folder.test.ts similarity index 100% rename from e2e/suites/actions/create/create-folder.test.ts rename to e2e/protractor/suites/actions/create/create-folder.test.ts diff --git a/e2e/suites/actions/create/create-library.test.ts b/e2e/protractor/suites/actions/create/create-library.test.ts similarity index 100% rename from e2e/suites/actions/create/create-library.test.ts rename to e2e/protractor/suites/actions/create/create-library.test.ts diff --git a/e2e/suites/actions/delete/delete-undo-delete.test.ts b/e2e/protractor/suites/actions/delete/delete-undo-delete.test.ts similarity index 100% rename from e2e/suites/actions/delete/delete-undo-delete.test.ts rename to e2e/protractor/suites/actions/delete/delete-undo-delete.test.ts diff --git a/e2e/suites/actions/delete/permanently-delete.test.ts b/e2e/protractor/suites/actions/delete/permanently-delete.test.ts similarity index 100% rename from e2e/suites/actions/delete/permanently-delete.test.ts rename to e2e/protractor/suites/actions/delete/permanently-delete.test.ts diff --git a/e2e/suites/actions/delete/restore.test.ts b/e2e/protractor/suites/actions/delete/restore.test.ts similarity index 100% rename from e2e/suites/actions/delete/restore.test.ts rename to e2e/protractor/suites/actions/delete/restore.test.ts diff --git a/e2e/suites/actions/edit/edit-folder.test.ts b/e2e/protractor/suites/actions/edit/edit-folder.test.ts similarity index 100% rename from e2e/suites/actions/edit/edit-folder.test.ts rename to e2e/protractor/suites/actions/edit/edit-folder.test.ts diff --git a/e2e/suites/actions/edit/edit-offline.test.ts b/e2e/protractor/suites/actions/edit/edit-offline.test.ts similarity index 100% rename from e2e/suites/actions/edit/edit-offline.test.ts rename to e2e/protractor/suites/actions/edit/edit-offline.test.ts diff --git a/e2e/suites/actions/favorite/mark-favorite.test.ts b/e2e/protractor/suites/actions/favorite/mark-favorite.test.ts similarity index 100% rename from e2e/suites/actions/favorite/mark-favorite.test.ts rename to e2e/protractor/suites/actions/favorite/mark-favorite.test.ts diff --git a/e2e/suites/actions/library/library-actions.test.ts b/e2e/protractor/suites/actions/library/library-actions.test.ts similarity index 100% rename from e2e/suites/actions/library/library-actions.test.ts rename to e2e/protractor/suites/actions/library/library-actions.test.ts diff --git a/e2e/suites/actions/share/share-file.test.ts b/e2e/protractor/suites/actions/share/share-file.test.ts similarity index 100% rename from e2e/suites/actions/share/share-file.test.ts rename to e2e/protractor/suites/actions/share/share-file.test.ts diff --git a/e2e/suites/actions/share/unshare-file-search-results.test.ts b/e2e/protractor/suites/actions/share/unshare-file-search-results.test.ts similarity index 100% rename from e2e/suites/actions/share/unshare-file-search-results.test.ts rename to e2e/protractor/suites/actions/share/unshare-file-search-results.test.ts diff --git a/e2e/suites/actions/upload-download/download.test.ts b/e2e/protractor/suites/actions/upload-download/download.test.ts similarity index 100% rename from e2e/suites/actions/upload-download/download.test.ts rename to e2e/protractor/suites/actions/upload-download/download.test.ts diff --git a/e2e/suites/actions/upload-download/upload-file.test.ts b/e2e/protractor/suites/actions/upload-download/upload-file.test.ts similarity index 100% rename from e2e/suites/actions/upload-download/upload-file.test.ts rename to e2e/protractor/suites/actions/upload-download/upload-file.test.ts diff --git a/e2e/suites/actions/upload-download/upload-new-version.test.ts b/e2e/protractor/suites/actions/upload-download/upload-new-version.test.ts similarity index 100% rename from e2e/suites/actions/upload-download/upload-new-version.test.ts rename to e2e/protractor/suites/actions/upload-download/upload-new-version.test.ts diff --git a/e2e/suites/actions/upload-download/version-actions.test.ts b/e2e/protractor/suites/actions/upload-download/version-actions.test.ts similarity index 100% rename from e2e/suites/actions/upload-download/version-actions.test.ts rename to e2e/protractor/suites/actions/upload-download/version-actions.test.ts diff --git a/e2e/suites/application/general.test.ts b/e2e/protractor/suites/application/general.test.ts similarity index 100% rename from e2e/suites/application/general.test.ts rename to e2e/protractor/suites/application/general.test.ts diff --git a/e2e/suites/application/page-titles.test.ts b/e2e/protractor/suites/application/page-titles.test.ts similarity index 100% rename from e2e/suites/application/page-titles.test.ts rename to e2e/protractor/suites/application/page-titles.test.ts diff --git a/e2e/suites/authentication/login.test.ts b/e2e/protractor/suites/authentication/login.test.ts similarity index 100% rename from e2e/suites/authentication/login.test.ts rename to e2e/protractor/suites/authentication/login.test.ts diff --git a/e2e/suites/authentication/logout.test.ts b/e2e/protractor/suites/authentication/logout.test.ts similarity index 100% rename from e2e/suites/authentication/logout.test.ts rename to e2e/protractor/suites/authentication/logout.test.ts diff --git a/e2e/suites/extensions/ext-context-submenus.test.ts b/e2e/protractor/suites/extensions/ext-context-submenus.test.ts similarity index 100% rename from e2e/suites/extensions/ext-context-submenus.test.ts rename to e2e/protractor/suites/extensions/ext-context-submenus.test.ts diff --git a/e2e/suites/extensions/ext-document-list.test.ts b/e2e/protractor/suites/extensions/ext-document-list.test.ts similarity index 100% rename from e2e/suites/extensions/ext-document-list.test.ts rename to e2e/protractor/suites/extensions/ext-document-list.test.ts diff --git a/e2e/suites/extensions/ext-header.test.ts b/e2e/protractor/suites/extensions/ext-header.test.ts similarity index 100% rename from e2e/suites/extensions/ext-header.test.ts rename to e2e/protractor/suites/extensions/ext-header.test.ts diff --git a/e2e/suites/extensions/ext-info-drawer.test.ts b/e2e/protractor/suites/extensions/ext-info-drawer.test.ts similarity index 100% rename from e2e/suites/extensions/ext-info-drawer.test.ts rename to e2e/protractor/suites/extensions/ext-info-drawer.test.ts diff --git a/e2e/suites/extensions/ext-metadata.test.ts b/e2e/protractor/suites/extensions/ext-metadata.test.ts similarity index 100% rename from e2e/suites/extensions/ext-metadata.test.ts rename to e2e/protractor/suites/extensions/ext-metadata.test.ts diff --git a/e2e/suites/extensions/ext-viewer.test.ts b/e2e/protractor/suites/extensions/ext-viewer.test.ts similarity index 100% rename from e2e/suites/extensions/ext-viewer.test.ts rename to e2e/protractor/suites/extensions/ext-viewer.test.ts diff --git a/e2e/suites/info-drawer/comments.test.ts b/e2e/protractor/suites/info-drawer/comments.test.ts similarity index 100% rename from e2e/suites/info-drawer/comments.test.ts rename to e2e/protractor/suites/info-drawer/comments.test.ts diff --git a/e2e/suites/info-drawer/file-folder-properties.test.ts b/e2e/protractor/suites/info-drawer/file-folder-properties.test.ts similarity index 100% rename from e2e/suites/info-drawer/file-folder-properties.test.ts rename to e2e/protractor/suites/info-drawer/file-folder-properties.test.ts diff --git a/e2e/suites/info-drawer/file-preview.test.ts b/e2e/protractor/suites/info-drawer/file-preview.test.ts similarity index 100% rename from e2e/suites/info-drawer/file-preview.test.ts rename to e2e/protractor/suites/info-drawer/file-preview.test.ts diff --git a/e2e/suites/info-drawer/general.test.ts b/e2e/protractor/suites/info-drawer/general.test.ts similarity index 100% rename from e2e/suites/info-drawer/general.test.ts rename to e2e/protractor/suites/info-drawer/general.test.ts diff --git a/e2e/suites/info-drawer/library-properties.test.ts b/e2e/protractor/suites/info-drawer/library-properties.test.ts similarity index 100% rename from e2e/suites/info-drawer/library-properties.test.ts rename to e2e/protractor/suites/info-drawer/library-properties.test.ts diff --git a/e2e/suites/list-views/empty-list.test.ts b/e2e/protractor/suites/list-views/empty-list.test.ts similarity index 100% rename from e2e/suites/list-views/empty-list.test.ts rename to e2e/protractor/suites/list-views/empty-list.test.ts diff --git a/e2e/suites/list-views/favorites.test.ts b/e2e/protractor/suites/list-views/favorites.test.ts similarity index 100% rename from e2e/suites/list-views/favorites.test.ts rename to e2e/protractor/suites/list-views/favorites.test.ts diff --git a/e2e/suites/list-views/file-libraries.test.ts b/e2e/protractor/suites/list-views/file-libraries.test.ts similarity index 100% rename from e2e/suites/list-views/file-libraries.test.ts rename to e2e/protractor/suites/list-views/file-libraries.test.ts diff --git a/e2e/suites/list-views/generic-errors.test.ts b/e2e/protractor/suites/list-views/generic-errors.test.ts similarity index 100% rename from e2e/suites/list-views/generic-errors.test.ts rename to e2e/protractor/suites/list-views/generic-errors.test.ts diff --git a/e2e/suites/list-views/permissions.test.ts b/e2e/protractor/suites/list-views/permissions.test.ts similarity index 100% rename from e2e/suites/list-views/permissions.test.ts rename to e2e/protractor/suites/list-views/permissions.test.ts diff --git a/e2e/suites/list-views/personal-files.test.ts b/e2e/protractor/suites/list-views/personal-files.test.ts similarity index 100% rename from e2e/suites/list-views/personal-files.test.ts rename to e2e/protractor/suites/list-views/personal-files.test.ts diff --git a/e2e/suites/list-views/recent-files.test.ts b/e2e/protractor/suites/list-views/recent-files.test.ts similarity index 100% rename from e2e/suites/list-views/recent-files.test.ts rename to e2e/protractor/suites/list-views/recent-files.test.ts diff --git a/e2e/suites/list-views/shared-files.test.ts b/e2e/protractor/suites/list-views/shared-files.test.ts similarity index 100% rename from e2e/suites/list-views/shared-files.test.ts rename to e2e/protractor/suites/list-views/shared-files.test.ts diff --git a/e2e/suites/list-views/sort-list.test.ts b/e2e/protractor/suites/list-views/sort-list.test.ts similarity index 100% rename from e2e/suites/list-views/sort-list.test.ts rename to e2e/protractor/suites/list-views/sort-list.test.ts diff --git a/e2e/suites/list-views/tooltips.test.ts b/e2e/protractor/suites/list-views/tooltips.test.ts similarity index 100% rename from e2e/suites/list-views/tooltips.test.ts rename to e2e/protractor/suites/list-views/tooltips.test.ts diff --git a/e2e/suites/list-views/trash.test.ts b/e2e/protractor/suites/list-views/trash.test.ts similarity index 100% rename from e2e/suites/list-views/trash.test.ts rename to e2e/protractor/suites/list-views/trash.test.ts diff --git a/e2e/suites/navigation/breadcrumb.test.ts b/e2e/protractor/suites/navigation/breadcrumb.test.ts similarity index 100% rename from e2e/suites/navigation/breadcrumb.test.ts rename to e2e/protractor/suites/navigation/breadcrumb.test.ts diff --git a/e2e/suites/navigation/sidebar.test.ts b/e2e/protractor/suites/navigation/sidebar.test.ts similarity index 100% rename from e2e/suites/navigation/sidebar.test.ts rename to e2e/protractor/suites/navigation/sidebar.test.ts diff --git a/e2e/suites/navigation/single-click.test.ts b/e2e/protractor/suites/navigation/single-click.test.ts similarity index 100% rename from e2e/suites/navigation/single-click.test.ts rename to e2e/protractor/suites/navigation/single-click.test.ts diff --git a/e2e/suites/pagination/favorites.ts b/e2e/protractor/suites/pagination/favorites.ts similarity index 100% rename from e2e/suites/pagination/favorites.ts rename to e2e/protractor/suites/pagination/favorites.ts diff --git a/e2e/suites/pagination/multiple-pages-files.test.ts b/e2e/protractor/suites/pagination/multiple-pages-files.test.ts similarity index 100% rename from e2e/suites/pagination/multiple-pages-files.test.ts rename to e2e/protractor/suites/pagination/multiple-pages-files.test.ts diff --git a/e2e/suites/pagination/multiple-pages-libraries.test.ts b/e2e/protractor/suites/pagination/multiple-pages-libraries.test.ts similarity index 100% rename from e2e/suites/pagination/multiple-pages-libraries.test.ts rename to e2e/protractor/suites/pagination/multiple-pages-libraries.test.ts diff --git a/e2e/suites/pagination/multiple-pages-trash.test.ts b/e2e/protractor/suites/pagination/multiple-pages-trash.test.ts similarity index 100% rename from e2e/suites/pagination/multiple-pages-trash.test.ts rename to e2e/protractor/suites/pagination/multiple-pages-trash.test.ts diff --git a/e2e/suites/pagination/personal-files.ts b/e2e/protractor/suites/pagination/personal-files.ts similarity index 100% rename from e2e/suites/pagination/personal-files.ts rename to e2e/protractor/suites/pagination/personal-files.ts diff --git a/e2e/suites/pagination/recent-files.ts b/e2e/protractor/suites/pagination/recent-files.ts similarity index 100% rename from e2e/suites/pagination/recent-files.ts rename to e2e/protractor/suites/pagination/recent-files.ts diff --git a/e2e/suites/pagination/search-results.ts b/e2e/protractor/suites/pagination/search-results.ts similarity index 100% rename from e2e/suites/pagination/search-results.ts rename to e2e/protractor/suites/pagination/search-results.ts diff --git a/e2e/suites/pagination/shared-files.ts b/e2e/protractor/suites/pagination/shared-files.ts similarity index 100% rename from e2e/suites/pagination/shared-files.ts rename to e2e/protractor/suites/pagination/shared-files.ts diff --git a/e2e/suites/pagination/single-page.test.ts b/e2e/protractor/suites/pagination/single-page.test.ts similarity index 100% rename from e2e/suites/pagination/single-page.test.ts rename to e2e/protractor/suites/pagination/single-page.test.ts diff --git a/e2e/suites/search/search-filters.test.ts b/e2e/protractor/suites/search/search-filters.test.ts similarity index 100% rename from e2e/suites/search/search-filters.test.ts rename to e2e/protractor/suites/search/search-filters.test.ts diff --git a/e2e/suites/search/search-input.test.ts b/e2e/protractor/suites/search/search-input.test.ts similarity index 100% rename from e2e/suites/search/search-input.test.ts rename to e2e/protractor/suites/search/search-input.test.ts diff --git a/e2e/suites/search/search-results-files-folders.test.ts b/e2e/protractor/suites/search/search-results-files-folders.test.ts similarity index 100% rename from e2e/suites/search/search-results-files-folders.test.ts rename to e2e/protractor/suites/search/search-results-files-folders.test.ts diff --git a/e2e/suites/search/search-results-general.test.ts b/e2e/protractor/suites/search/search-results-general.test.ts similarity index 100% rename from e2e/suites/search/search-results-general.test.ts rename to e2e/protractor/suites/search/search-results-general.test.ts diff --git a/e2e/suites/search/search-results-libraries.test.ts b/e2e/protractor/suites/search/search-results-libraries.test.ts similarity index 100% rename from e2e/suites/search/search-results-libraries.test.ts rename to e2e/protractor/suites/search/search-results-libraries.test.ts diff --git a/e2e/suites/search/search-sorting.test.ts b/e2e/protractor/suites/search/search-sorting.test.ts similarity index 100% rename from e2e/suites/search/search-sorting.test.ts rename to e2e/protractor/suites/search/search-sorting.test.ts diff --git a/e2e/suites/viewer/viewer-actions.test.ts b/e2e/protractor/suites/viewer/viewer-actions.test.ts similarity index 100% rename from e2e/suites/viewer/viewer-actions.test.ts rename to e2e/protractor/suites/viewer/viewer-actions.test.ts diff --git a/e2e/suites/viewer/viewer-general.test.ts b/e2e/protractor/suites/viewer/viewer-general.test.ts similarity index 100% rename from e2e/suites/viewer/viewer-general.test.ts rename to e2e/protractor/suites/viewer/viewer-general.test.ts diff --git a/e2e/suites/viewer/viewer-protected-file.test.ts b/e2e/protractor/suites/viewer/viewer-protected-file.test.ts similarity index 100% rename from e2e/suites/viewer/viewer-protected-file.test.ts rename to e2e/protractor/suites/viewer/viewer-protected-file.test.ts diff --git a/e2e/tsconfig.e2e.adf.json b/e2e/protractor/tsconfig.e2e.adf.json similarity index 58% rename from e2e/tsconfig.e2e.adf.json rename to e2e/protractor/tsconfig.e2e.adf.json index 7ce2a4a8e..1b1fa99bb 100644 --- a/e2e/tsconfig.e2e.adf.json +++ b/e2e/protractor/tsconfig.e2e.adf.json @@ -1,14 +1,14 @@ { - "extends": "../tsconfig.adf.json", + "extends": "../../tsconfig.adf.json", "compilerOptions": { - "outDir": "../out-tsc/e2e", + "outDir": "../../out-tsc/e2e", "baseUrl": "./", "module": "commonjs", "target": "es2017", "types": ["jasmine", "jasminewd2", "node"], "skipLibCheck": true, "paths": { - "@alfresco/aca-testing-shared": ["../projects/aca-testing-shared/src/index.ts"] + "@alfresco/aca-testing-shared": ["../../projects/aca-testing-shared/src/index.ts"] } }, "exclude": ["node_modules"] diff --git a/e2e/protractor/tsconfig.e2e.json b/e2e/protractor/tsconfig.e2e.json new file mode 100755 index 000000000..14c0002b0 --- /dev/null +++ b/e2e/protractor/tsconfig.e2e.json @@ -0,0 +1,16 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "../../out-tsc/e2e", + "baseUrl": "./", + "module": "commonjs", + "target": "es2017", + "types": ["jasmine", "jasminewd2", "node", "@playwright/test"], + "skipLibCheck": true, + "paths": { + "@alfresco/aca-testing-shared": ["../../projects/aca-testing-shared/src/index.ts"], + "@alfresco/playwright-shared": ["../../projects/aca-playwright-shared/src/index.ts"] + } + }, + "exclude": ["node_modules"] +} diff --git a/e2e/tsconfig.e2e.json b/e2e/tsconfig.e2e.json deleted file mode 100755 index 1a23ff5b8..000000000 --- a/e2e/tsconfig.e2e.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions": { - "outDir": "../out-tsc/e2e", - "baseUrl": "./", - "module": "commonjs", - "target": "es2017", - "types": ["jasmine", "jasminewd2", "node", "@playwright/test"], - "skipLibCheck": true, - "paths": { - "@alfresco/aca-testing-shared": ["../projects/aca-testing-shared/src/index.ts"], - "@alfresco/playwright-shared": ["./playwright/shared/index.ts"] - } - }, - "exclude": ["node_modules"] -} diff --git a/projects/aca-playwright-shared/package.json b/projects/aca-playwright-shared/package.json new file mode 100644 index 000000000..75014efa3 --- /dev/null +++ b/projects/aca-playwright-shared/package.json @@ -0,0 +1,13 @@ +{ + "name": "aca-playwright-shared", + "version": "3.0.0", + "license": "LGPL-3.0", + "main": "src/index.ts", + "dependencies": { + "tslib": "^2.0.0" + }, + "repository": { + "type": "git", + "url": "https://github.com/Alfresco/alfresco-content-app.git" + } +} diff --git a/projects/aca-playwright-shared/project.json b/projects/aca-playwright-shared/project.json new file mode 100644 index 000000000..fc840b198 --- /dev/null +++ b/projects/aca-playwright-shared/project.json @@ -0,0 +1,7 @@ +{ + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "name": "playwright-shared", + "sourceRoot": "projects/aca-playwright-shared/src", + "projectType": "library", + "prefix": "lib" +} diff --git a/e2e/playwright/shared/api/api-client-factory.ts b/projects/aca-playwright-shared/src/api/api-client-factory.ts similarity index 99% rename from e2e/playwright/shared/api/api-client-factory.ts rename to projects/aca-playwright-shared/src/api/api-client-factory.ts index e02cb1b4e..907635b9d 100644 --- a/e2e/playwright/shared/api/api-client-factory.ts +++ b/projects/aca-playwright-shared/src/api/api-client-factory.ts @@ -37,9 +37,9 @@ import { SitesApi, UploadApi } from '@alfresco/js-api'; -import { users } from '../page-objects'; import { logger } from '@alfresco/adf-cli/scripts/logger'; import { ActionTypes, Rule } from './rules-api'; +import { users } from '../base-config'; export interface AcaBackend { sites: SitesApi; diff --git a/e2e/playwright/shared/api/index.ts b/projects/aca-playwright-shared/src/api/index.ts similarity index 100% rename from e2e/playwright/shared/api/index.ts rename to projects/aca-playwright-shared/src/api/index.ts diff --git a/e2e/playwright/shared/api/rules-api.ts b/projects/aca-playwright-shared/src/api/rules-api.ts similarity index 100% rename from e2e/playwright/shared/api/rules-api.ts rename to projects/aca-playwright-shared/src/api/rules-api.ts diff --git a/e2e/playwright/shared/page-objects/global-variables.ts b/projects/aca-playwright-shared/src/base-config/global-variables.ts similarity index 100% rename from e2e/playwright/shared/page-objects/global-variables.ts rename to projects/aca-playwright-shared/src/base-config/global-variables.ts diff --git a/e2e/playwright/shared/base-config/global.setup.ts b/projects/aca-playwright-shared/src/base-config/global.setup.ts similarity index 51% rename from e2e/playwright/shared/base-config/global.setup.ts rename to projects/aca-playwright-shared/src/base-config/global.setup.ts index 678969a2c..8d1ce5d9b 100644 --- a/e2e/playwright/shared/base-config/global.setup.ts +++ b/projects/aca-playwright-shared/src/base-config/global.setup.ts @@ -24,39 +24,49 @@ import { chromium, FullConfig } from '@playwright/test'; import { LoginPage } from '../page-objects'; +import { CustomConfig } from '../models'; +import { users } from './global-variables'; import fs from 'fs'; +import { paths } from '../utils/paths'; -const E2E_HOST = process.env.PLAYWRIGHT_E2E_HOST; -const E2E_PORT = process.env.PLAYWRIGHT_E2E_PORT; -const acsAdminUser = process.env.ADMIN_EMAIL; -const acsAdminUserPassword = process.env.ADMIN_PASSWORD; - -async function globalSetup(config: FullConfig) { +async function globalSetup(config: FullConfig) { const { use } = config.projects[0]; - let baseUrl: string; + await removeOutputFolders(); + await createOutputFolders(); - if (use.baseURL) { - baseUrl = use.baseURL; - } else { - if (E2E_HOST?.match(/localhost/)) { - baseUrl = `${E2E_HOST}:${E2E_PORT}`; - } else { - baseUrl = E2E_HOST; + if (use.users) { + for (const user of use.users) { + if (users[user].username) { + const browser = await chromium.launch(); + const page = await browser.newPage(); + const loginPage = new LoginPage(page); + await page.goto(use.baseURL); + await loginPage.loginUser({ username: users[user].username, password: users[user].password }, { + withNavigation: false, + waitForLoading: true + }); + await page.context().storageState({ path: `${paths.userStates}/${user}UserState.json` }); + await browser.close(); + } else { + throw new Error(`Add credentials for ${user} to you .env file!`); + } } } +} - const browser = await chromium.launch({ - args: ['--disable-web-security'] - }); - const page = await browser.newPage(); - const loginPage = new LoginPage(page); +async function createOutputFolders() { + for (const path in paths) { + if (!fs.existsSync(paths[path])) { + fs.mkdirSync(paths[path], { recursive: true }); + } + } +} - fs.mkdirSync(`./storage-state`, { recursive: true }); - await page.goto(baseUrl); - await loginPage.loginUser({ username: acsAdminUser, password: acsAdminUserPassword }, { withNavigation: false, waitForLoading: true }); - await page.context().storageState({ path: `./storage-state/AdminUserState.json` }); - await browser.close(); +async function removeOutputFolders() { + if (fs.existsSync(paths.rootFolder)) { + fs.rmdirSync(paths.rootFolder, { recursive: true }); + } } export default globalSetup; diff --git a/projects/aca-playwright-shared/src/base-config/index.ts b/projects/aca-playwright-shared/src/base-config/index.ts new file mode 100644 index 000000000..0944bc93d --- /dev/null +++ b/projects/aca-playwright-shared/src/base-config/index.ts @@ -0,0 +1,27 @@ +/*! + * 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 . + */ + +export * from './global.setup'; +export * from './playwright.config'; +export * from './global-variables'; diff --git a/e2e/playwright/tests/folder-rules/playwright.config.ts b/projects/aca-playwright-shared/src/base-config/playwright.config.ts similarity index 70% rename from e2e/playwright/tests/folder-rules/playwright.config.ts rename to projects/aca-playwright-shared/src/base-config/playwright.config.ts index 0ec69eeea..928870680 100644 --- a/e2e/playwright/tests/folder-rules/playwright.config.ts +++ b/projects/aca-playwright-shared/src/base-config/playwright.config.ts @@ -22,43 +22,49 @@ * from Hyland Software. If not, see . */ -import { PlaywrightTestConfig, devices } from '@playwright/test'; +import { PlaywrightTestConfig, ReporterDescription, devices } from '@playwright/test'; +import { timeouts } from '../utils'; -require('dotenv').config(); +require('@alfresco/adf-cli/tooling').dotenvConfig(); +const { env } = process; -export const config: PlaywrightTestConfig = { - testDir: './', +const report: ReporterDescription[] = (env.CI) ? [['github']] : [['html']]; + +export const getGlobalConfig: PlaywrightTestConfig = { + timeout: timeouts.globalTest, + globalTimeout: timeouts.globalSpec, expect: { /** * Maximum time expect() should wait for the condition to be met. * For example in `await expect(locator).toHaveText();` */ - timeout: 10000 + timeout: timeouts.medium }, /* Run tests in files in parallel */ fullyParallel: true, /* Fail the build on CI if you accidentally left test.only in the source code. */ - forbidOnly: !!process.env.CI, + forbidOnly: !!env.CI, /* Retry on CI only */ - retries: process.env.CI ? 2 : 0, + retries: env.CI ? 2 : 0, /* Opt out of parallel tests on CI. */ - workers: 5, - timeout: 40000, - - globalSetup: require.resolve('../../shared/base-config/global.setup'), + workers: 3, + reporter: [['list'], ...report], + globalSetup: require.resolve('./global.setup'), use: { /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ - storageState: './storage-state/AdminUserState.json', actionTimeout: 0, /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL: process.env.PLAYWRIGHT_E2E_HOST, + baseURL: env.PLAYWRIGHT_E2E_HOST, + headless: !!env.PLAYWRIGHT_HEADLESS ? (env.PLAYWRIGHT_HEADLESS === 'true') : !!env.CI, ignoreHTTPSErrors: true, bypassCSP: true, /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ - trace: 'on-first-retry', + trace: 'retain-on-failure', + video: 'retain-on-failure', + screenshot: 'only-on-failure', launchOptions: { devtools: false, - args: ['--disable-web-security', '--no-sandbox', '--disable-site-isolation-trials'] + args: ['--no-sandbox', '--disable-site-isolation-trials'] } }, @@ -70,7 +76,5 @@ export const config: PlaywrightTestConfig = { ...devices['Desktop Chrome'] } } - ] + ], }; - -export default config; diff --git a/e2e/playwright/tests/folder-rules/fixtures/page-initialization.ts b/projects/aca-playwright-shared/src/fixtures/page-initialization.ts similarity index 89% rename from e2e/playwright/tests/folder-rules/fixtures/page-initialization.ts rename to projects/aca-playwright-shared/src/fixtures/page-initialization.ts index 84ef9e860..b9a701c7c 100644 --- a/e2e/playwright/tests/folder-rules/fixtures/page-initialization.ts +++ b/projects/aca-playwright-shared/src/fixtures/page-initialization.ts @@ -22,9 +22,9 @@ * from Hyland Software. If not, see . */ -import { PersonalFilesPage, NodesPage } from '../page-objects'; + import { test as base } from '@playwright/test'; -import { ApiClientFactory } from '@alfresco/playwright-shared'; +import { ApiClientFactory, NodesPage, PersonalFilesPage } from '../'; interface Pages { personalFiles: PersonalFilesPage; @@ -32,7 +32,7 @@ interface Pages { } interface Api { - apiClient: ApiClientFactory; + superAdminApiClient: ApiClientFactory; } export const test = base.extend({ @@ -43,7 +43,7 @@ export const test = base.extend({ await use(new NodesPage(page)); }, // eslint-disable-next-line no-empty-pattern - apiClient: async ({}, use) => { + superAdminApiClient: async ({ }, use) => { const apiClient = new ApiClientFactory(); await apiClient.setUpAcaBackend('admin'); await use(apiClient); diff --git a/e2e/playwright/shared/index.ts b/projects/aca-playwright-shared/src/index.ts similarity index 94% rename from e2e/playwright/shared/index.ts rename to projects/aca-playwright-shared/src/index.ts index 41459a82d..24b44026e 100644 --- a/e2e/playwright/shared/index.ts +++ b/projects/aca-playwright-shared/src/index.ts @@ -26,3 +26,5 @@ export * from './api'; export * from './base-config'; export * from './models'; export * from './page-objects'; +export * from './fixtures/page-initialization'; +export * from './utils'; diff --git a/e2e/playwright/shared/page-objects/components/index.ts b/projects/aca-playwright-shared/src/models/custom-config.ts similarity index 91% rename from e2e/playwright/shared/page-objects/components/index.ts rename to projects/aca-playwright-shared/src/models/custom-config.ts index 9b5e828c2..64f83e05b 100644 --- a/e2e/playwright/shared/page-objects/components/index.ts +++ b/projects/aca-playwright-shared/src/models/custom-config.ts @@ -22,6 +22,8 @@ * from Hyland Software. If not, see . */ -export * from './base.component'; -export * from './snack-bar.component'; -export * from './spinner.component'; +import { users } from '../base-config'; + +export interface CustomConfig { + users: Array; +} diff --git a/e2e/playwright/shared/models/index.ts b/projects/aca-playwright-shared/src/models/index.ts similarity index 97% rename from e2e/playwright/shared/models/index.ts rename to projects/aca-playwright-shared/src/models/index.ts index 728baa1f3..57b33edbd 100644 --- a/e2e/playwright/shared/models/index.ts +++ b/projects/aca-playwright-shared/src/models/index.ts @@ -23,3 +23,4 @@ */ export * from './user-model'; +export * from './custom-config'; diff --git a/e2e/playwright/shared/models/user-model.ts b/projects/aca-playwright-shared/src/models/user-model.ts similarity index 100% rename from e2e/playwright/shared/models/user-model.ts rename to projects/aca-playwright-shared/src/models/user-model.ts diff --git a/projects/aca-playwright-shared/src/page-objects/components/aca-header.component.ts b/projects/aca-playwright-shared/src/page-objects/components/aca-header.component.ts new file mode 100644 index 000000000..dc8c10ee4 --- /dev/null +++ b/projects/aca-playwright-shared/src/page-objects/components/aca-header.component.ts @@ -0,0 +1,35 @@ +/*! + * 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 . + */ + + import { BaseComponent } from './base.component'; + import { Page } from '@playwright/test'; + + export class AcaHeader extends BaseComponent { + private static rootElement = 'adf-toolbar'; + public createButton = this.getChild('[id="app.toolbar.create"]'); + + constructor(page: Page) { + super(page, AcaHeader.rootElement); + } + } diff --git a/e2e/playwright/tests/folder-rules/page-objects/components/actions-dropdown.component.ts b/projects/aca-playwright-shared/src/page-objects/components/actions-dropdown.component.ts similarity index 98% rename from e2e/playwright/tests/folder-rules/page-objects/components/actions-dropdown.component.ts rename to projects/aca-playwright-shared/src/page-objects/components/actions-dropdown.component.ts index 640bf0ff1..d6d5d57c2 100644 --- a/e2e/playwright/tests/folder-rules/page-objects/components/actions-dropdown.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/actions-dropdown.component.ts @@ -23,7 +23,7 @@ */ import { Locator, Page } from '@playwright/test'; -import { BaseComponent } from '@alfresco/playwright-shared'; +import { BaseComponent } from './base.component'; export enum ActionType { AddAspect = 'Add aspect', @@ -76,7 +76,7 @@ export class ActionsDropdownComponent extends BaseComponent { } await this.actionDropdownLocator.nth(index).click(); const option = this.getOptionLocator(action); - await option.nth(0).click(); + await option.click(); } async dropdownSelection(selectValue: string, locator: string, index: number): Promise { diff --git a/e2e/playwright/shared/page-objects/components/base.component.ts b/projects/aca-playwright-shared/src/page-objects/components/base.component.ts similarity index 100% rename from e2e/playwright/shared/page-objects/components/base.component.ts rename to projects/aca-playwright-shared/src/page-objects/components/base.component.ts diff --git a/e2e/playwright/tests/folder-rules/page-objects/components/conditions.component.ts b/projects/aca-playwright-shared/src/page-objects/components/conditions.component.ts similarity index 90% rename from e2e/playwright/tests/folder-rules/page-objects/components/conditions.component.ts rename to projects/aca-playwright-shared/src/page-objects/components/conditions.component.ts index f54bedf19..a3bb86c5a 100644 --- a/e2e/playwright/tests/folder-rules/page-objects/components/conditions.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/conditions.component.ts @@ -23,7 +23,7 @@ */ import { Locator, Page } from '@playwright/test'; -import { ManageRulesDialogComponent } from './manage-rules-dialog.component'; +import { ManageRulesDialogComponent } from './manageRules/manage-rules-dialog.component'; export enum Field { Name = 'Name', @@ -61,17 +61,13 @@ export class ConditionComponent extends ManageRulesDialogComponent { await this.addConditionButton.click(); await this.selectField(fields, index); await this.selectComparator(comparators, index); - await this.typeConditionValue(value, index); - } - - async createConditionGroup(): Promise { - await this.addConditionGroupButton.click(); + await this.valueField.nth(index).type(value); } async addConditionGroup(fields: Partial, comparators: Partial, value: string, index: number): Promise { await this.addConditionButton.nth(0).click(); await this.selectField(fields, index); await this.selectComparator(comparators, index); - await this.typeConditionValue(value, index); + await this.valueField.nth(index).type(value); } } diff --git a/e2e/playwright/shared/page-objects/components/dataTable/data-table.component.ts b/projects/aca-playwright-shared/src/page-objects/components/dataTable/data-table.component.ts similarity index 100% rename from e2e/playwright/shared/page-objects/components/dataTable/data-table.component.ts rename to projects/aca-playwright-shared/src/page-objects/components/dataTable/data-table.component.ts diff --git a/e2e/playwright/shared/page-objects/components/dataTable/index.ts b/projects/aca-playwright-shared/src/page-objects/components/dataTable/index.ts similarity index 100% rename from e2e/playwright/shared/page-objects/components/dataTable/index.ts rename to projects/aca-playwright-shared/src/page-objects/components/dataTable/index.ts diff --git a/e2e/playwright/shared/page-objects/components/mat-menu.component.ts b/projects/aca-playwright-shared/src/page-objects/components/dataTable/mat-menu.component.ts similarity index 93% rename from e2e/playwright/shared/page-objects/components/mat-menu.component.ts rename to projects/aca-playwright-shared/src/page-objects/components/dataTable/mat-menu.component.ts index f25c0a7ad..82c466906 100644 --- a/e2e/playwright/shared/page-objects/components/mat-menu.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/dataTable/mat-menu.component.ts @@ -23,7 +23,7 @@ */ import { Page } from '@playwright/test'; -import { BaseComponent } from './base.component'; +import { BaseComponent } from '../base.component'; export class MatMenuComponent extends BaseComponent { private static rootElement = '.mat-menu-content'; @@ -34,6 +34,6 @@ export class MatMenuComponent extends BaseComponent { public getMenuItemsLocator = this.getChild('button'); public getMenuItemTextLocator = this.getChild('[data-automation-id="menu-item-title"]'); - + public createFolder = this.getChild('[id="app.create.folder"]'); public getButtonByText = (text: string) => this.getChild('button', { hasText: text }); } diff --git a/e2e/playwright/shared/page-objects/components/dataTable/toolbar.component.ts b/projects/aca-playwright-shared/src/page-objects/components/dataTable/toolbar.component.ts similarity index 100% rename from e2e/playwright/shared/page-objects/components/dataTable/toolbar.component.ts rename to projects/aca-playwright-shared/src/page-objects/components/dataTable/toolbar.component.ts diff --git a/projects/aca-playwright-shared/src/page-objects/components/dialogs/adf-folder-dialog.component.ts b/projects/aca-playwright-shared/src/page-objects/components/dialogs/adf-folder-dialog.component.ts new file mode 100644 index 000000000..bc3a97d22 --- /dev/null +++ b/projects/aca-playwright-shared/src/page-objects/components/dialogs/adf-folder-dialog.component.ts @@ -0,0 +1,37 @@ +/*! + * 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 . + */ + +import { BaseComponent } from '../base.component'; +import { Page } from '@playwright/test'; + +export class AdfFolderDialogComponent extends BaseComponent { + private static rootElement = 'adf-folder-dialog'; + + public folderNameInputLocator = this.getChild('[id="adf-folder-name-input"]'); + public createButton = this.getChild('[id="adf-folder-create-button"]'); + + constructor(page: Page) { + super(page, AdfFolderDialogComponent.rootElement); + } +} diff --git a/e2e/playwright/shared/base-config/index.ts b/projects/aca-playwright-shared/src/page-objects/components/dialogs/index.ts similarity index 96% rename from e2e/playwright/shared/base-config/index.ts rename to projects/aca-playwright-shared/src/page-objects/components/dialogs/index.ts index 8740deab6..f659ffb7d 100644 --- a/e2e/playwright/shared/base-config/index.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/dialogs/index.ts @@ -22,4 +22,4 @@ * from Hyland Software. If not, see . */ -export * from './global.setup'; +export * from './adf-folder-dialog.component'; diff --git a/projects/aca-playwright-shared/src/page-objects/components/index.ts b/projects/aca-playwright-shared/src/page-objects/components/index.ts new file mode 100644 index 000000000..2286fc706 --- /dev/null +++ b/projects/aca-playwright-shared/src/page-objects/components/index.ts @@ -0,0 +1,34 @@ +/*! + * 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 . + */ + +export * from './snackBar/snack-bar.component'; +export * from './dataTable'; +export * from './dialogs'; +export * from './manageRules'; +export * from './base.component'; +export * from './spinner.component'; +export * from './actions-dropdown.component'; +export * from './conditions.component'; +export * from './pagination.component'; + diff --git a/e2e/playwright/tests/folder-rules/page-objects/index.ts b/projects/aca-playwright-shared/src/page-objects/components/manageRules/index.ts similarity index 92% rename from e2e/playwright/tests/folder-rules/page-objects/index.ts rename to projects/aca-playwright-shared/src/page-objects/components/manageRules/index.ts index f237a20b8..78bb1806b 100644 --- a/e2e/playwright/tests/folder-rules/page-objects/index.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/manageRules/index.ts @@ -22,5 +22,5 @@ * from Hyland Software. If not, see . */ -export * from './pages/personal-files.page'; -export * from './pages/nodes.page'; +export * from './manage-rules-dialog.component'; +export * from './manage-rules.component'; diff --git a/e2e/playwright/tests/folder-rules/page-objects/components/manage-rules-dialog.component.ts b/projects/aca-playwright-shared/src/page-objects/components/manageRules/manage-rules-dialog.component.ts similarity index 78% rename from e2e/playwright/tests/folder-rules/page-objects/components/manage-rules-dialog.component.ts rename to projects/aca-playwright-shared/src/page-objects/components/manageRules/manage-rules-dialog.component.ts index a4575d982..7b463cfdb 100644 --- a/e2e/playwright/tests/folder-rules/page-objects/components/manage-rules-dialog.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/manageRules/manage-rules-dialog.component.ts @@ -22,29 +22,22 @@ * from Hyland Software. If not, see . */ -import { BaseComponent } from '@alfresco/playwright-shared'; +import { BaseComponent } from '../base.component'; import { Page } from '@playwright/test'; export class ManageRulesDialogComponent extends BaseComponent { private static rootElement = 'aca-edit-rule-dialog'; public createRuleButton = this.getChild('[data-automation-id="edit-rule-dialog-submit"]'); - private ruleNameInputLocator = this.getChild('[id="rule-details-name-input"]'); + public ruleNameInputLocator = this.getChild('[id="rule-details-name-input"]'); public addConditionButton = this.getChild('[data-automation-id="add-condition-button"]'); public addConditionGroupButton = this.getChild('[data-automation-id="add-group-button"]'); public fieldDropDown = this.getChild('[data-automation-id="field-select"]'); public comparatorDropDown = this.getChild('[data-automation-id="comparator-select"]'); - private valueField = this.getChild('[data-automation-id="value-input"]'); + public valueField = this.getChild('[data-automation-id="value-input"]'); constructor(page: Page) { super(page, ManageRulesDialogComponent.rootElement); } - async typeRuleName(ruleName: string): Promise { - await this.ruleNameInputLocator.type(ruleName, { delay: 50 }); - } - - async typeConditionValue(ruleName: string, index: number): Promise { - await this.valueField.nth(index).type(ruleName, { delay: 50 }); - } } diff --git a/e2e/playwright/tests/folder-rules/page-objects/components/manage-rules.component.ts b/projects/aca-playwright-shared/src/page-objects/components/manageRules/manage-rules.component.ts similarity index 96% rename from e2e/playwright/tests/folder-rules/page-objects/components/manage-rules.component.ts rename to projects/aca-playwright-shared/src/page-objects/components/manageRules/manage-rules.component.ts index a2fdecc0e..b805c4fc7 100644 --- a/e2e/playwright/tests/folder-rules/page-objects/components/manage-rules.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/manageRules/manage-rules.component.ts @@ -23,7 +23,7 @@ */ import { Locator, Page } from '@playwright/test'; -import { BaseComponent } from '@alfresco/playwright-shared'; +import { BaseComponent } from '../base.component'; export class ManageRules extends BaseComponent { private static rootElement = '.aca-manage-rules'; diff --git a/e2e/playwright/shared/page-objects/components/pagination.component.ts b/projects/aca-playwright-shared/src/page-objects/components/pagination.component.ts similarity index 97% rename from e2e/playwright/shared/page-objects/components/pagination.component.ts rename to projects/aca-playwright-shared/src/page-objects/components/pagination.component.ts index dee316d47..e964929f3 100644 --- a/e2e/playwright/shared/page-objects/components/pagination.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/pagination.component.ts @@ -24,7 +24,7 @@ import { BaseComponent } from './base.component'; import { Page } from '@playwright/test'; -import { MatMenuComponent } from './mat-menu.component'; +import { MatMenuComponent } from './dataTable/mat-menu.component'; export enum PaginationActionsType { PageSizeSelector = 'Page size selector', diff --git a/e2e/playwright/shared/page-objects/components/snack-bar.component.ts b/projects/aca-playwright-shared/src/page-objects/components/snackBar/snack-bar.component.ts similarity index 96% rename from e2e/playwright/shared/page-objects/components/snack-bar.component.ts rename to projects/aca-playwright-shared/src/page-objects/components/snackBar/snack-bar.component.ts index 877c1a49d..0c160a03c 100644 --- a/e2e/playwright/shared/page-objects/components/snack-bar.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/snackBar/snack-bar.component.ts @@ -23,7 +23,7 @@ */ import { Page } from '@playwright/test'; -import { BaseComponent } from './base.component'; +import { BaseComponent } from '../base.component'; export class SnackBarComponent extends BaseComponent { private static rootElement = 'simple-snack-bar'; diff --git a/e2e/playwright/shared/page-objects/components/spinner.component.ts b/projects/aca-playwright-shared/src/page-objects/components/spinner.component.ts similarity index 100% rename from e2e/playwright/shared/page-objects/components/spinner.component.ts rename to projects/aca-playwright-shared/src/page-objects/components/spinner.component.ts diff --git a/e2e/playwright/shared/page-objects/pages/index.ts b/projects/aca-playwright-shared/src/page-objects/index.ts similarity index 95% rename from e2e/playwright/shared/page-objects/pages/index.ts rename to projects/aca-playwright-shared/src/page-objects/index.ts index 95963574e..b26b36a44 100644 --- a/e2e/playwright/shared/page-objects/pages/index.ts +++ b/projects/aca-playwright-shared/src/page-objects/index.ts @@ -22,5 +22,5 @@ * from Hyland Software. If not, see . */ -export * from './base.page'; -export * from './login.page'; +export * from './components'; +export * from './pages'; diff --git a/e2e/playwright/shared/page-objects/pages/base.page.ts b/projects/aca-playwright-shared/src/page-objects/pages/base.page.ts similarity index 100% rename from e2e/playwright/shared/page-objects/pages/base.page.ts rename to projects/aca-playwright-shared/src/page-objects/pages/base.page.ts diff --git a/projects/aca-playwright-shared/src/page-objects/pages/index.ts b/projects/aca-playwright-shared/src/page-objects/pages/index.ts new file mode 100644 index 000000000..c1d1ae1c1 --- /dev/null +++ b/projects/aca-playwright-shared/src/page-objects/pages/index.ts @@ -0,0 +1,28 @@ +/*! + * 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 . + */ + +export * from './base.page'; +export * from './login.page'; +export * from './nodes.page'; +export * from './personal-files.page'; diff --git a/e2e/playwright/shared/page-objects/pages/login.page.ts b/projects/aca-playwright-shared/src/page-objects/pages/login.page.ts similarity index 100% rename from e2e/playwright/shared/page-objects/pages/login.page.ts rename to projects/aca-playwright-shared/src/page-objects/pages/login.page.ts diff --git a/e2e/playwright/tests/folder-rules/page-objects/pages/nodes.page.ts b/projects/aca-playwright-shared/src/page-objects/pages/nodes.page.ts similarity index 80% rename from e2e/playwright/tests/folder-rules/page-objects/pages/nodes.page.ts rename to projects/aca-playwright-shared/src/page-objects/pages/nodes.page.ts index 34f170b0d..4e8756955 100644 --- a/e2e/playwright/tests/folder-rules/page-objects/pages/nodes.page.ts +++ b/projects/aca-playwright-shared/src/page-objects/pages/nodes.page.ts @@ -22,12 +22,10 @@ * from Hyland Software. If not, see . */ -import { BasePage, ToolbarComponent } from '@alfresco/playwright-shared'; import { Page } from '@playwright/test'; -import { ManageRulesDialogComponent } from '../components/manage-rules-dialog.component'; -import { ActionsDropdownComponent } from '../components/actions-dropdown.component'; -import { ConditionComponent } from '../components/conditions.component'; -import { ManageRules } from '../components/manage-rules.component'; +import { ConditionComponent, ManageRules, ManageRulesDialogComponent, ToolbarComponent, ActionsDropdownComponent } from '../components'; +import { BasePage } from './base.page'; + export class NodesPage extends BasePage { private static pageUrl = 'nodes'; diff --git a/e2e/playwright/tests/folder-rules/page-objects/pages/personal-files.page.ts b/projects/aca-playwright-shared/src/page-objects/pages/personal-files.page.ts similarity index 77% rename from e2e/playwright/tests/folder-rules/page-objects/pages/personal-files.page.ts rename to projects/aca-playwright-shared/src/page-objects/pages/personal-files.page.ts index 58efd392b..7845ee51b 100644 --- a/e2e/playwright/tests/folder-rules/page-objects/pages/personal-files.page.ts +++ b/projects/aca-playwright-shared/src/page-objects/pages/personal-files.page.ts @@ -22,8 +22,12 @@ * from Hyland Software. If not, see . */ -import { BasePage, DataTableComponent } from '@alfresco/playwright-shared'; + import { Page } from '@playwright/test'; +import { BasePage } from './base.page'; +import { DataTableComponent, MatMenuComponent } from '../components'; +import { AcaHeader } from '../components/aca-header.component'; +import { AdfFolderDialogComponent } from '../components/dialogs'; export class PersonalFilesPage extends BasePage { private static pageUrl = 'personal-files'; @@ -32,5 +36,8 @@ export class PersonalFilesPage extends BasePage { super(page, PersonalFilesPage.pageUrl); } + public acaHeader = new AcaHeader(this.page); + public matMenu = new MatMenuComponent(this.page); + public folderDialog = new AdfFolderDialogComponent(this.page); public dataTable = new DataTableComponent(this.page); } diff --git a/e2e/playwright/shared/page-objects/playwright-base.ts b/projects/aca-playwright-shared/src/page-objects/playwright-base.ts similarity index 100% rename from e2e/playwright/shared/page-objects/playwright-base.ts rename to projects/aca-playwright-shared/src/page-objects/playwright-base.ts diff --git a/projects/aca-playwright-shared/src/utils/exclude-tests.ts b/projects/aca-playwright-shared/src/utils/exclude-tests.ts new file mode 100644 index 000000000..aa89a8a29 --- /dev/null +++ b/projects/aca-playwright-shared/src/utils/exclude-tests.ts @@ -0,0 +1,22 @@ +/* + * Copyright © 2005 - 2021 Alfresco Software, Ltd. All rights reserved. + * + * License rights for this program may be obtained from Alfresco Software, Ltd. + * pursuant to a written agreement and any use of this program without such an + * agreement is prohibited. + */ + +import { logger } from '@alfresco/adf-cli/scripts/logger'; + +export const getExcludedTestsRegExpArray = (excludedJson: any, projectName: string) => { + const prefix = `[ 🎭 Playwright Excludes - ${projectName} ]`; + const objectKeys = Object.keys(excludedJson); + + if (!objectKeys.length) { + logger.info(`${prefix} ✅ No excluded tests 🎉 `); + } else { + logger.warn(`${prefix} ❌ Tests excluded because of 🐛 : ${objectKeys}`); + } + + return objectKeys.map((key) => new RegExp(key)); +}; diff --git a/projects/aca-playwright-shared/src/utils/index.ts b/projects/aca-playwright-shared/src/utils/index.ts new file mode 100644 index 000000000..984ce0272 --- /dev/null +++ b/projects/aca-playwright-shared/src/utils/index.ts @@ -0,0 +1,28 @@ +/*! + * 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 . + */ + +export * from './paths'; +export * from './timeouts'; +export * from './exclude-tests'; +export * from './state-helper'; diff --git a/projects/aca-playwright-shared/src/utils/paths.ts b/projects/aca-playwright-shared/src/utils/paths.ts new file mode 100644 index 000000000..e5055fe4a --- /dev/null +++ b/projects/aca-playwright-shared/src/utils/paths.ts @@ -0,0 +1,33 @@ +/*! + * 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 . + */ + +const rootFolder = 'e2e-output'; + +export const paths = { + rootFolder, + allData: `${rootFolder}/playwright-data`, + files: `${rootFolder}/playwright-data/downloads`, + report: `${rootFolder}/playwright-data/report`, + userStates: `${rootFolder}/playwright-data/user-states`, +}; diff --git a/projects/aca-playwright-shared/src/utils/state-helper.ts b/projects/aca-playwright-shared/src/utils/state-helper.ts new file mode 100644 index 000000000..b2def1b98 --- /dev/null +++ b/projects/aca-playwright-shared/src/utils/state-helper.ts @@ -0,0 +1,34 @@ +/*! + * 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 . + */ + + +import { resolve } from 'path'; +import { paths } from '.'; +import { users } from '../base-config'; + +export function getUserState(user: UserType) { + return resolve(process.cwd(), `${paths.userStates}/${user}UserState.json`); +} + +type UserType = keyof typeof users; diff --git a/projects/aca-playwright-shared/src/utils/timeouts.ts b/projects/aca-playwright-shared/src/utils/timeouts.ts new file mode 100644 index 000000000..31b43b13f --- /dev/null +++ b/projects/aca-playwright-shared/src/utils/timeouts.ts @@ -0,0 +1,37 @@ +/*! + * 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 . + */ + +export const timeouts = { + typingDelay: 50, + tiny: 500, + short: 1000, + normal: 2000, + medium: 5000, + large: 10000, + extraLarge: 20 * 1000, + globalTest: 45 * 1000, + extendedTest: 120 * 1000, + webServer: 240 * 1000, + globalSpec: 60 * 10 * 1000 +}; diff --git a/e2e/playwright/shared/tsconfig.lib.json b/projects/aca-playwright-shared/tsconfig.lib.json similarity index 75% rename from e2e/playwright/shared/tsconfig.lib.json rename to projects/aca-playwright-shared/tsconfig.lib.json index 281b7ca83..6db207fbc 100644 --- a/e2e/playwright/shared/tsconfig.lib.json +++ b/projects/aca-playwright-shared/tsconfig.lib.json @@ -1,7 +1,7 @@ { - "extends": "../../tsconfig.e2e.json", + "extends": "../../tsconfig.json", "compilerOptions": { - "outDir": "../../../out-tsc/playwright-testing", + "outDir": "../../out-tsc/aca-playwright-testing", "target": "es2015", "module": "es2015", "moduleResolution": "node", @@ -11,6 +11,7 @@ "emitDecoratorMetadata": true, "experimentalDecorators": true, "importHelpers": true, + "types": [], "lib": ["dom", "es2018"] }, "angularCompilerOptions": { @@ -20,5 +21,5 @@ "strictInjectionParameters": true, "enableResourceInlining": true }, - "exclude": ["node_modules"] + "exclude": ["node_modules", "src/test.ts", "**/*.spec.ts"] } diff --git a/protractor.conf.js b/protractor.conf.js index e7ef12248..5186a8932 100755 --- a/protractor.conf.js +++ b/protractor.conf.js @@ -5,14 +5,14 @@ require('dotenv').config({path: process.env.ENV_FILE}); const path = require('path'); const {SpecReporter} = require('jasmine-spec-reporter'); const retry = require('protractor-retry-angular-cli').retry; -const {saveScreenshots} = require('./e2e/e2e-config/utils/upload-output'); -const smartRunnerFactory = require('./e2e/smartrunner-factory'); +const {saveScreenshots} = require('./e2e/protractor/e2e-config/utils/upload-output'); +const smartRunnerFactory = require('./e2e/protractor/smartrunner-factory'); const argv = require('yargs').argv; const projectRoot = path.resolve(__dirname); const downloadFolder = path.join(__dirname, 'e2e-downloads'); const screenshotsFolder = path.resolve(__dirname, 'e2e-output'); -const e2eFolder = path.resolve(projectRoot, 'e2e'); +const e2eFolder = path.resolve(projectRoot, 'e2e/protractor'); const E2E_HOST = process.env.E2E_HOST || 'http://localhost:4200'; const BROWSER_RUN = !!process.env.BROWSER_RUN; const width = 1366; @@ -50,43 +50,43 @@ exports.config = { }, specs: [ - './e2e/suites/actions/**/**/*test.ts', - './e2e/suites/actions-available/**/**/*test.ts', - './e2e/suites/application/**/*test.ts', - './e2e/suites/authentication/**/*test.ts', - './e2e/suites/extensions/**/*test.ts', - './e2e/suites/info-drawer/**/*test.ts', - './e2e/suites/list-views/**/*test.ts', - './e2e/suites/navigation/**/*test.ts', - './e2e/suites/pagination/**/*test.ts', - './e2e/suites/search/**/*test.ts', - './e2e/suites/viewer/**/*test.ts' + './e2e/protractor/suites/actions/**/**/*test.ts', + './e2e/protractor/suites/actions-available/**/**/*test.ts', + './e2e/protractor/suites/application/**/*test.ts', + './e2e/protractor/suites/authentication/**/*test.ts', + './e2e/protractor/suites/extensions/**/*test.ts', + './e2e/protractor/suites/info-drawer/**/*test.ts', + './e2e/protractor/suites/list-views/**/*test.ts', + './e2e/protractor/suites/navigation/**/*test.ts', + './e2e/protractor/suites/pagination/**/*test.ts', + './e2e/protractor/suites/search/**/*test.ts', + './e2e/protractor/suites/viewer/**/*test.ts' ], suites: { - copyMoveActions: './e2e/suites/actions/copy-move/**/**/*test.ts', - createActions: './e2e/suites/actions/create/**/**/*test.ts', - deleteActions: './e2e/suites/actions/delete/**/**/*test.ts', - editActions: './e2e/suites/actions/edit/**/**/*test.ts', - favoriteActions: './e2e/suites/actions/favorite/**/**/*test.ts', - libraryActions: './e2e/suites/actions/library/**/**/*test.ts', - shareActions: './e2e/suites/actions/share/**/**/*test.ts', - uploadDownloadActions: './e2e/suites/actions/upload-download/**/**/*test.ts', + copyMoveActions: './e2e/protractor/suites/actions/copy-move/**/**/*test.ts', + createActions: './e2e/protractor/suites/actions/create/**/**/*test.ts', + deleteActions: './e2e/protractor/suites/actions/delete/**/**/*test.ts', + editActions: './e2e/protractor/suites/actions/edit/**/**/*test.ts', + favoriteActions: './e2e/protractor/suites/actions/favorite/**/**/*test.ts', + libraryActions: './e2e/protractor/suites/actions/library/**/**/*test.ts', + shareActions: './e2e/protractor/suites/actions/share/**/**/*test.ts', + uploadDownloadActions: './e2e/protractor/suites/actions/upload-download/**/**/*test.ts', - actionsAvailableFilesFolders: './e2e/suites/actions-available/files-folders/**/**/*test.ts', - actionsAvailableLibraries: './e2e/suites/actions-available/libraries/**/**/*test.ts', - actionsAvailableSpecialPermissions: './e2e/suites/actions-available/special-permissions/**/**/*test.ts', - actionsAvailableNewMenu: './e2e/suites/actions-available/new-menu/**/**/*test.ts', + actionsAvailableFilesFolders: './e2e/protractor/suites/actions-available/files-folders/**/**/*test.ts', + actionsAvailableLibraries: './e2e/protractor/suites/actions-available/libraries/**/**/*test.ts', + actionsAvailableSpecialPermissions: './e2e/protractor/suites/actions-available/special-permissions/**/**/*test.ts', + actionsAvailableNewMenu: './e2e/protractor/suites/actions-available/new-menu/**/**/*test.ts', - application: './e2e/suites/application/**/*test.ts', - authentication: './e2e/suites/authentication/**/*test.ts', - extensions: './e2e/suites/extensions/**/*test.ts', - infoDrawer: './e2e/suites/info-drawer/**/*test.ts', - listViews: './e2e/suites/list-views/**/*test.ts', - navigation: './e2e/suites/navigation/**/*test.ts', - pagination: './e2e/suites/pagination/**/*test.ts', - search: './e2e/suites/search/**/*test.ts', - viewer: './e2e/suites/viewer/**/*test.ts' + application: './e2e/protractor/suites/application/**/*test.ts', + authentication: './e2e/protractor/suites/authentication/**/*test.ts', + extensions: './e2e/protractor/suites/extensions/**/*test.ts', + infoDrawer: './e2e/protractor/suites/info-drawer/**/*test.ts', + listViews: './e2e/protractor/suites/list-views/**/*test.ts', + navigation: './e2e/protractor/suites/navigation/**/*test.ts', + pagination: './e2e/protractor/suites/pagination/**/*test.ts', + search: './e2e/protractor/suites/search/**/*test.ts', + viewer: './e2e/protractor/suites/viewer/**/*test.ts' }, SELENIUM_PROMISE_MANAGER: false, @@ -140,8 +140,6 @@ exports.config = { showColors: true, defaultTimeoutInterval: 200000, includeStackTrace: true, - print: function () { - }, ...(process.env.CI ? smartRunnerFactory.applyExclusionFilter() : {}) }, @@ -189,8 +187,10 @@ exports.config = { paths: tsConfig.compilerOptions.paths }); + // eslint-disable-next-line no-undef browser.manage().window().setSize(width, height); + // eslint-disable-next-line no-undef jasmine.getEnv().addReporter( new SpecReporter({ spec: { @@ -200,6 +200,7 @@ exports.config = { }) ); + // eslint-disable-next-line no-undef browser.driver.sendChromiumCommand('Page.setDownloadBehavior', { behavior: 'allow', downloadPath: downloadFolder diff --git a/tsconfig.adf.json b/tsconfig.adf.json index 0783af92d..66df13c0b 100644 --- a/tsconfig.adf.json +++ b/tsconfig.adf.json @@ -23,7 +23,7 @@ "paths": { "@alfresco/adf-testing": ["../alfresco-ng2-components/lib/testing"], "@alfresco/adf-testing/shared": ["../alfresco-ng2-components/lib/testing/src/lib/shared"], - "@alfresco/playwright-shared": ["e2e/playwright/shared/index.ts"], + "@alfresco/playwright-shared": ["projects/aca-playwright-shared/src/index.ts"], "@alfresco/adf-core": ["../alfresco-ng2-components/lib/core"], "@alfresco/adf-core/*": ["../alfresco-ng2-components/lib/core/*/public-api.ts"], "@alfresco/adf-core/shell": ["../alfresco-ng2-components/lib/core/shell/src/index.ts"], diff --git a/tsconfig.json b/tsconfig.json index 43062f18f..399e90fe4 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -31,7 +31,7 @@ "@alfresco/aca-content/about": ["projects/aca-content/about/src/public-api.ts"], "@alfresco/aca-viewer": ["projects/aca-viewer/src/public-api.ts"], "@alfresco/aca-preview": ["projects/aca-preview/src/public-api.ts"], - "@alfresco/playwright-shared": ["e2e/playwright/shared/index.ts"], + "@alfresco/playwright-shared": ["projects/aca-playwright-shared/src/index.ts"], "package.json": ["package.json"] } },