From 41e9aa88f6a33eb424f591db4a3daabf6c3b820a Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Thu, 23 Mar 2023 10:20:30 +0000 Subject: [PATCH 01/11] use angular serve for e2e --- .github/actions/before-e2e/action.yml | 3 +-- .github/actions/run-e2e/action.yml | 3 ++- README.md | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/.github/actions/before-e2e/action.yml b/.github/actions/before-e2e/action.yml index 4c981efc04..d768f527fd 100644 --- a/.github/actions/before-e2e/action.yml +++ b/.github/actions/before-e2e/action.yml @@ -48,8 +48,7 @@ runs: run: | npm install -g envsub APP_CONFIG_FILE_PATH="${{ inputs.to }}/app.config.json" - EXTRA_ENV_SETTINGS="" - envsub $EXTRA_ENV_SETTINGS --all $APP_CONFIG_FILE_PATH $APP_CONFIG_FILE_PATH || exit 1 + envsub --all $APP_CONFIG_FILE_PATH $APP_CONFIG_FILE_PATH || exit 1 echo -n " \_ Validating replaced config file ... "; $(npm bin)/ajv validate -s ./node_modules/@alfresco/adf-core/app.config.schema.json -d $APP_CONFIG_FILE_PATH --errors=text --verbose || exit 4 if grep -E -q '\$\{[A-Z0-9_]*\}' $APP_CONFIG_FILE_PATH; then diff --git a/.github/actions/run-e2e/action.yml b/.github/actions/run-e2e/action.yml index 078d6eb297..1ef04bd623 100644 --- a/.github/actions/run-e2e/action.yml +++ b/.github/actions/run-e2e/action.yml @@ -19,7 +19,8 @@ runs: shell: bash run: | ./node_modules/.bin/tsc -p "./e2e/$E2E_TSCONFIG" || exit 1; - npx http-server -c-1 $CONTENT_CE_DIST_PATH -p 4200 > /dev/null &\ + # npx http-server -c-1 $CONTENT_CE_DIST_PATH -p 4200 > /dev/null &\ + npm start > /dev/null &\ if [ ${{ inputs.test-runner }} == "playwright" ]; then echo "Running playwright tests with options ${{ inputs.options }}" diff --git a/README.md b/README.md index 0eb42c83d0..5a6e818e05 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,21 @@ APP_CONFIG_ECM_HOST="" APP_CONFIG_PLUGIN_AOS=false APP_CONFIG_PLUGIN_CONTENT_SERVICE=true APP_CONFIG_PLUGIN_FOLDER_RULES=true +APP_CONFIG_ENABLE_MOBILE_APP_SWITCH=false +APP_CONFIG_PROVIDER=ECM +APP_CONFIG_AUTH_TYPE=BASIC +APP_CONFIG_OAUTH2_HOST=http://localhost:4200/auth/realms/alfresco +APP_CONFIG_OAUTH2_CLIENTID=alfresco +APP_CONFIG_PLUGIN_AOS=true +APP_CONFIG_PLUGIN_CONTENT_SERVICE=true +APP_CONFIG_PLUGIN_FOLDER_RULES=true +APP_CONFIG_ENABLE_MOBILE_APP_SWITCH=true +APP_CONFIG_SESSION_TIME_FOR_OPEN_APP_DIALOG_DISPLAY_IN_HOURS="12" +APP_CONFIG_OAUTH2_IMPLICIT_FLOW=true +APP_CONFIG_OAUTH2_SILENT_LOGIN=true +APP_CONFIG_OAUTH2_REDIRECT_LOGOUT=/ +APP_CONFIG_OAUTH2_REDIRECT_LOGIN=/ +APP_CONFIG_OAUTH2_REDIRECT_SILENT_IFRAME_URI="{protocol}//{hostname}{:port}/assets/silent-refresh.html" ``` Where `` is the address of the ACS. From 9c9c7dd08f8e5fd561cc80df1831fa220a7fa797 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Thu, 23 Mar 2023 10:53:06 +0000 Subject: [PATCH 02/11] generate default .env file --- .github/actions/run-e2e/action.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/actions/run-e2e/action.yml b/.github/actions/run-e2e/action.yml index 1ef04bd623..1e23b4bbad 100644 --- a/.github/actions/run-e2e/action.yml +++ b/.github/actions/run-e2e/action.yml @@ -20,6 +20,25 @@ runs: run: | ./node_modules/.bin/tsc -p "./e2e/$E2E_TSCONFIG" || exit 1; # 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 &\ if [ ${{ inputs.test-runner }} == "playwright" ]; then From 48f55c604df494a5f764805d7ff28044cc3239ce Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Thu, 23 Mar 2023 11:22:53 +0000 Subject: [PATCH 03/11] try to wait for base url --- e2e/playwright/shared/base-config/global.setup.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/playwright/shared/base-config/global.setup.ts b/e2e/playwright/shared/base-config/global.setup.ts index 6e82607355..15b4825486 100644 --- a/e2e/playwright/shared/base-config/global.setup.ts +++ b/e2e/playwright/shared/base-config/global.setup.ts @@ -37,7 +37,7 @@ async function globalSetup(config: FullConfig) { const loginPage = new LoginPage(page); fs.mkdirSync(`./storage-state`, { recursive: true }); - await page.goto(baseUrl); + await page.goto(baseUrl, { waitUntil: 'load' }); await loginPage.loginUser({ username: acsAdminUser, password: acsAdminUserPassword }, { withNavigation: false, waitForLoading: true }); await page.context().storageState({ path: `./storage-state/AdminUserState.json` }); await browser.close(); From a8aef3d31c748951617c3d2a3b9ece4bf3a53725 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Thu, 23 Mar 2023 11:59:04 +0000 Subject: [PATCH 04/11] Revert "try to wait for base url" This reverts commit 48f55c604df494a5f764805d7ff28044cc3239ce. --- e2e/playwright/shared/base-config/global.setup.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/playwright/shared/base-config/global.setup.ts b/e2e/playwright/shared/base-config/global.setup.ts index 15b4825486..6e82607355 100644 --- a/e2e/playwright/shared/base-config/global.setup.ts +++ b/e2e/playwright/shared/base-config/global.setup.ts @@ -37,7 +37,7 @@ async function globalSetup(config: FullConfig) { const loginPage = new LoginPage(page); fs.mkdirSync(`./storage-state`, { recursive: true }); - await page.goto(baseUrl, { waitUntil: 'load' }); + 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(); From f9840841e512bbdc4c0b013447d89abc7809cc11 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Thu, 23 Mar 2023 11:59:44 +0000 Subject: [PATCH 05/11] try to sleep a bit --- .github/actions/run-e2e/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/run-e2e/action.yml b/.github/actions/run-e2e/action.yml index 1e23b4bbad..4a2d0ba230 100644 --- a/.github/actions/run-e2e/action.yml +++ b/.github/actions/run-e2e/action.yml @@ -43,6 +43,7 @@ runs: if [ ${{ inputs.test-runner }} == "playwright" ]; then echo "Running playwright tests with options ${{ inputs.options }}" + sleep 60 npx playwright test --config ${{ inputs.options }} else echo "Running protractor tests with options ${{ inputs.options }}" From c2cfc587bc315bf33fb3adc6020cd39a097a68c3 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Thu, 23 Mar 2023 12:23:41 +0000 Subject: [PATCH 06/11] try waiting for url --- .github/actions/run-e2e/action.yml | 2 +- e2e/playwright/shared/base-config/global.setup.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/actions/run-e2e/action.yml b/.github/actions/run-e2e/action.yml index 4a2d0ba230..6578edcdc1 100644 --- a/.github/actions/run-e2e/action.yml +++ b/.github/actions/run-e2e/action.yml @@ -43,7 +43,7 @@ runs: if [ ${{ inputs.test-runner }} == "playwright" ]; then echo "Running playwright tests with options ${{ inputs.options }}" - sleep 60 + # sleep 60 npx playwright test --config ${{ inputs.options }} else echo "Running protractor tests with options ${{ inputs.options }}" diff --git a/e2e/playwright/shared/base-config/global.setup.ts b/e2e/playwright/shared/base-config/global.setup.ts index 6e82607355..8ca569eb0f 100644 --- a/e2e/playwright/shared/base-config/global.setup.ts +++ b/e2e/playwright/shared/base-config/global.setup.ts @@ -37,6 +37,7 @@ async function globalSetup(config: FullConfig) { const loginPage = new LoginPage(page); fs.mkdirSync(`./storage-state`, { recursive: true }); + await page.waitForURL(baseUrl); await page.goto(baseUrl); await loginPage.loginUser({ username: acsAdminUser, password: acsAdminUserPassword }, { withNavigation: false, waitForLoading: true }); await page.context().storageState({ path: `./storage-state/AdminUserState.json` }); From 1ac9bc1fb6c8e8a5f4db6019862b854be5fb604f Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Thu, 23 Mar 2023 12:36:06 +0000 Subject: [PATCH 07/11] bump timeout --- e2e/playwright/shared/base-config/global.setup.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/playwright/shared/base-config/global.setup.ts b/e2e/playwright/shared/base-config/global.setup.ts index 8ca569eb0f..2169e3ed06 100644 --- a/e2e/playwright/shared/base-config/global.setup.ts +++ b/e2e/playwright/shared/base-config/global.setup.ts @@ -37,7 +37,7 @@ async function globalSetup(config: FullConfig) { const loginPage = new LoginPage(page); fs.mkdirSync(`./storage-state`, { recursive: true }); - await page.waitForURL(baseUrl); + await page.waitForURL(baseUrl, { timeout: 60000 }); await page.goto(baseUrl); await loginPage.loginUser({ username: acsAdminUser, password: acsAdminUserPassword }, { withNavigation: false, waitForLoading: true }); await page.context().storageState({ path: `./storage-state/AdminUserState.json` }); From 1bc94cb0ba33abaab3dea7f9364002449670243a Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Thu, 23 Mar 2023 12:49:52 +0000 Subject: [PATCH 08/11] try different approach --- e2e/playwright/shared/base-config/global.setup.ts | 2 +- e2e/playwright/tests/folder-rules/playwright.config.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/e2e/playwright/shared/base-config/global.setup.ts b/e2e/playwright/shared/base-config/global.setup.ts index 2169e3ed06..eca806df34 100644 --- a/e2e/playwright/shared/base-config/global.setup.ts +++ b/e2e/playwright/shared/base-config/global.setup.ts @@ -37,7 +37,7 @@ async function globalSetup(config: FullConfig) { const loginPage = new LoginPage(page); fs.mkdirSync(`./storage-state`, { recursive: true }); - await page.waitForURL(baseUrl, { timeout: 60000 }); + await page.waitForURL(baseUrl, { waitUntil: 'domcontentloaded' }); await page.goto(baseUrl); await loginPage.loginUser({ username: acsAdminUser, password: acsAdminUserPassword }, { withNavigation: false, waitForLoading: true }); await page.context().storageState({ path: `./storage-state/AdminUserState.json` }); diff --git a/e2e/playwright/tests/folder-rules/playwright.config.ts b/e2e/playwright/tests/folder-rules/playwright.config.ts index d6a1c9d272..de9221ed52 100644 --- a/e2e/playwright/tests/folder-rules/playwright.config.ts +++ b/e2e/playwright/tests/folder-rules/playwright.config.ts @@ -26,6 +26,7 @@ export const config: PlaywrightTestConfig = { /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ storageState: './storage-state/AdminUserState.json', actionTimeout: 0, + navigationTimeout: 60000, /* Base URL to use in actions like `await page.goto('/')`. */ baseURL: process.env.PLAYWRIGHT_E2E_HOST, ignoreHTTPSErrors: true, From 84c1c134e76b31481963a3387f16fdca684e5cc2 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Thu, 23 Mar 2023 13:22:28 +0000 Subject: [PATCH 09/11] different timeout attempt --- e2e/playwright/shared/base-config/global.setup.ts | 2 +- e2e/playwright/tests/folder-rules/playwright.config.ts | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/e2e/playwright/shared/base-config/global.setup.ts b/e2e/playwright/shared/base-config/global.setup.ts index eca806df34..3198bc4ff2 100644 --- a/e2e/playwright/shared/base-config/global.setup.ts +++ b/e2e/playwright/shared/base-config/global.setup.ts @@ -37,7 +37,7 @@ async function globalSetup(config: FullConfig) { const loginPage = new LoginPage(page); fs.mkdirSync(`./storage-state`, { recursive: true }); - await page.waitForURL(baseUrl, { waitUntil: 'domcontentloaded' }); + await page.waitForURL(baseUrl, { waitUntil: 'domcontentloaded', timeout: 60000 }); await page.goto(baseUrl); await loginPage.loginUser({ username: acsAdminUser, password: acsAdminUserPassword }, { withNavigation: false, waitForLoading: true }); await page.context().storageState({ path: `./storage-state/AdminUserState.json` }); diff --git a/e2e/playwright/tests/folder-rules/playwright.config.ts b/e2e/playwright/tests/folder-rules/playwright.config.ts index de9221ed52..d6a1c9d272 100644 --- a/e2e/playwright/tests/folder-rules/playwright.config.ts +++ b/e2e/playwright/tests/folder-rules/playwright.config.ts @@ -26,7 +26,6 @@ export const config: PlaywrightTestConfig = { /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ storageState: './storage-state/AdminUserState.json', actionTimeout: 0, - navigationTimeout: 60000, /* Base URL to use in actions like `await page.goto('/')`. */ baseURL: process.env.PLAYWRIGHT_E2E_HOST, ignoreHTTPSErrors: true, From a6616350cfcb77b0947730b95e8efd409cefb572 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Thu, 23 Mar 2023 13:35:09 +0000 Subject: [PATCH 10/11] restore sleep --- .github/actions/run-e2e/action.yml | 2 +- e2e/playwright/shared/base-config/global.setup.ts | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/actions/run-e2e/action.yml b/.github/actions/run-e2e/action.yml index 6578edcdc1..4a2d0ba230 100644 --- a/.github/actions/run-e2e/action.yml +++ b/.github/actions/run-e2e/action.yml @@ -43,7 +43,7 @@ runs: if [ ${{ inputs.test-runner }} == "playwright" ]; then echo "Running playwright tests with options ${{ inputs.options }}" - # sleep 60 + sleep 60 npx playwright test --config ${{ inputs.options }} else echo "Running protractor tests with options ${{ inputs.options }}" diff --git a/e2e/playwright/shared/base-config/global.setup.ts b/e2e/playwright/shared/base-config/global.setup.ts index 3198bc4ff2..6e82607355 100644 --- a/e2e/playwright/shared/base-config/global.setup.ts +++ b/e2e/playwright/shared/base-config/global.setup.ts @@ -37,7 +37,6 @@ async function globalSetup(config: FullConfig) { const loginPage = new LoginPage(page); fs.mkdirSync(`./storage-state`, { recursive: true }); - await page.waitForURL(baseUrl, { waitUntil: 'domcontentloaded', timeout: 60000 }); await page.goto(baseUrl); await loginPage.loginUser({ username: acsAdminUser, password: acsAdminUserPassword }, { withNavigation: false, waitForLoading: true }); await page.context().storageState({ path: `./storage-state/AdminUserState.json` }); From 38b67a74ae8d2410da8a9fcf3c45f5a887b0a832 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Thu, 23 Mar 2023 13:36:17 +0000 Subject: [PATCH 11/11] do not install global libs on ci --- .github/actions/before-e2e/action.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/actions/before-e2e/action.yml b/.github/actions/before-e2e/action.yml index d768f527fd..48ae8932c0 100644 --- a/.github/actions/before-e2e/action.yml +++ b/.github/actions/before-e2e/action.yml @@ -46,9 +46,8 @@ runs: - name: Replace variables in app.config.json shell: bash run: | - npm install -g envsub APP_CONFIG_FILE_PATH="${{ inputs.to }}/app.config.json" - envsub --all $APP_CONFIG_FILE_PATH $APP_CONFIG_FILE_PATH || exit 1 + npx envsub --all $APP_CONFIG_FILE_PATH $APP_CONFIG_FILE_PATH || exit 1 echo -n " \_ Validating replaced config file ... "; $(npm bin)/ajv validate -s ./node_modules/@alfresco/adf-core/app.config.schema.json -d $APP_CONFIG_FILE_PATH --errors=text --verbose || exit 4 if grep -E -q '\$\{[A-Z0-9_]*\}' $APP_CONFIG_FILE_PATH; then