From 0e0c59ed68f6a4d708164965d3fb74e9922cf489 Mon Sep 17 00:00:00 2001 From: kritagya09 Date: Wed, 27 Dec 2023 17:07:14 +0530 Subject: [PATCH] Created a separate test suit for share-actions --- .github/workflows/pull-request.yml | 4 +- e2e/playwright/share-action/.eslintrc.json | 26 +++++++++++ .../share-action/exclude.tests.json | 1 + .../share-action/playwright.config.ts | 44 +++++++++++++++++++ e2e/playwright/share-action/project.json | 22 ++++++++++ .../src/tests/share/share-file.spec.ts | 0 .../share/unshare-file-search-results.spec.ts | 5 +-- .../share-action/tsconfig.e2e.adf.json | 15 +++++++ e2e/playwright/share-action/tsconfig.e2e.json | 15 +++++++ .../src/utils/timeouts.ts | 2 +- 10 files changed, 128 insertions(+), 6 deletions(-) create mode 100644 e2e/playwright/share-action/.eslintrc.json create mode 100644 e2e/playwright/share-action/exclude.tests.json create mode 100644 e2e/playwright/share-action/playwright.config.ts create mode 100644 e2e/playwright/share-action/project.json rename e2e/playwright/{actions => share-action}/src/tests/share/share-file.spec.ts (100%) rename e2e/playwright/{actions => share-action}/src/tests/share/unshare-file-search-results.spec.ts (98%) create mode 100644 e2e/playwright/share-action/tsconfig.e2e.adf.json create mode 100755 e2e/playwright/share-action/tsconfig.e2e.json diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index c19fad2a31..86d0e8afaf 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -115,8 +115,6 @@ jobs: id: 2 - name: "viewer,infoDrawer,extensions" id: 3 - - name: "shareActions" - id: 4 - name: "copyMoveActions" id: 6 - name: "deleteActions" @@ -176,6 +174,8 @@ jobs: id: 7 - name: "list-views" id: 8 + - name: "share-action" + id: 9 steps: - name: Checkout uses: actions/checkout@v3 diff --git a/e2e/playwright/share-action/.eslintrc.json b/e2e/playwright/share-action/.eslintrc.json new file mode 100644 index 0000000000..48440bfc38 --- /dev/null +++ b/e2e/playwright/share-action/.eslintrc.json @@ -0,0 +1,26 @@ +{ + "extends": "../../../.eslintrc.json", + "ignorePatterns": [ + "!**/*" + ], + "overrides": [ + { + "files": [ + "*.ts" + ], + "parserOptions": { + "project": [ + "e2e/playwright/share-action/tsconfig.e2e.json" + ], + "createDefaultProgram": true + }, + "plugins": [ + "rxjs", + "unicorn" + ], + "rules": { + "@typescript-eslint/no-floating-promises": "off" + } + } + ] +} diff --git a/e2e/playwright/share-action/exclude.tests.json b/e2e/playwright/share-action/exclude.tests.json new file mode 100644 index 0000000000..0967ef424b --- /dev/null +++ b/e2e/playwright/share-action/exclude.tests.json @@ -0,0 +1 @@ +{} diff --git a/e2e/playwright/share-action/playwright.config.ts b/e2e/playwright/share-action/playwright.config.ts new file mode 100644 index 0000000000..5b20171bab --- /dev/null +++ b/e2e/playwright/share-action/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, 'Share Action'), + projects: [ + { + name: 'Share Action', + testDir: './src/tests', + use: { + users: ['hruser'] + } + } + ] +}; + +export default config; diff --git a/e2e/playwright/share-action/project.json b/e2e/playwright/share-action/project.json new file mode 100644 index 0000000000..2dd16e9b54 --- /dev/null +++ b/e2e/playwright/share-action/project.json @@ -0,0 +1,22 @@ +{ + "name": "share-action-e2e", + "$schema": "../../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "e2e/playwright/share-action/src", + "projectType": "application", + "targets": { + "e2e": { + "executor": "nx:run-commands", + "options": { + "commands": ["npx playwright test --config=e2e/playwright/share-action/playwright.config.ts"] + }, + "configurations": { + "production": { + "devServerTarget": "content-ce:serve:production" + } + } + }, + "lint": { + "executor": "@angular-eslint/builder:lint" + } + } +} diff --git a/e2e/playwright/actions/src/tests/share/share-file.spec.ts b/e2e/playwright/share-action/src/tests/share/share-file.spec.ts similarity index 100% rename from e2e/playwright/actions/src/tests/share/share-file.spec.ts rename to e2e/playwright/share-action/src/tests/share/share-file.spec.ts diff --git a/e2e/playwright/actions/src/tests/share/unshare-file-search-results.spec.ts b/e2e/playwright/share-action/src/tests/share/unshare-file-search-results.spec.ts similarity index 98% rename from e2e/playwright/actions/src/tests/share/unshare-file-search-results.spec.ts rename to e2e/playwright/share-action/src/tests/share/unshare-file-search-results.spec.ts index 3dcc626281..ac665aac42 100755 --- a/e2e/playwright/actions/src/tests/share/unshare-file-search-results.spec.ts +++ b/e2e/playwright/share-action/src/tests/share/unshare-file-search-results.spec.ts @@ -26,7 +26,7 @@ import { Site } from '@alfresco/js-api'; import { ApiClientFactory, FileActionsApi, NodesApi, SharedLinksApi, SitesApi, Utils, test, timeouts } from '@alfresco/playwright-shared'; import { expect } from '@playwright/test'; -test.describe('Unshare a file from Search Results', () => { +test.describe.only('Unshare a file from Search Results', () => { const random = Utils.random(); const username = `user-${random}`; @@ -46,7 +46,6 @@ test.describe('Unshare a file from Search Results', () => { const sitePrivate = `site-private-${random}`; - let fileSite1Id: string; let fileSite2Id: string; const fileSite1 = `search-file-${searchRandom}-Site1.txt`; const fileSite2 = `search-file-${searchRandom}-Site2.txt`; @@ -72,7 +71,7 @@ test.describe('Unshare a file from Search Results', () => { await sitesApi.createSite(sitePrivate, Site.VisibilityEnum.PRIVATE); const docLibId = await sitesApi.getDocLibId(sitePrivate); - fileSite1Id = (await nodesApi.createFile(fileSite1, docLibId)).entry.id; + const fileSite1Id = (await nodesApi.createFile(fileSite1, docLibId)).entry.id; fileSite2Id = (await nodesApi.createFile(fileSite2, docLibId)).entry.id; await sitesApi.addSiteMember(sitePrivate, username, Site.RoleEnum.SiteConsumer); diff --git a/e2e/playwright/share-action/tsconfig.e2e.adf.json b/e2e/playwright/share-action/tsconfig.e2e.adf.json new file mode 100644 index 0000000000..87cbcf775a --- /dev/null +++ b/e2e/playwright/share-action/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/share-action/tsconfig.e2e.json b/e2e/playwright/share-action/tsconfig.e2e.json new file mode 100755 index 0000000000..c317985239 --- /dev/null +++ b/e2e/playwright/share-action/tsconfig.e2e.json @@ -0,0 +1,15 @@ +{ + "extends": "../../../tsconfig.json", + "compilerOptions": { + "outDir": "../../out-tsc/e2e", + "baseUrl": "./", + "module": "commonjs", + "target": "es2017", + "types": ["jasmine", "jasminewd2", "node", "@playwright/test"], + "skipLibCheck": true, + "paths": { + "@alfresco/playwright-shared": ["../../../projects/aca-playwright-shared/src/index.ts"] + } + }, + "exclude": ["node_modules"] +} diff --git a/projects/aca-playwright-shared/src/utils/timeouts.ts b/projects/aca-playwright-shared/src/utils/timeouts.ts index aa6768be1e..62a5b16be4 100644 --- a/projects/aca-playwright-shared/src/utils/timeouts.ts +++ b/projects/aca-playwright-shared/src/utils/timeouts.ts @@ -34,5 +34,5 @@ export const timeouts = { globalTest: 45 * 1000, extendedTest: 150 * 1000, webServer: 240 * 1000, - globalSpec: 60 * 20 * 1000 + globalSpec: 60 * 10 * 1000 };