diff --git a/tests/e2e/specs/miscellaneous/WorkspaceWithParent.spec.ts b/tests/e2e/specs/miscellaneous/WorkspaceWithParent.spec.ts index af9d736a91e..d7c2385f501 100644 --- a/tests/e2e/specs/miscellaneous/WorkspaceWithParent.spec.ts +++ b/tests/e2e/specs/miscellaneous/WorkspaceWithParent.spec.ts @@ -45,6 +45,7 @@ suite(`Workspace using a parent test suite ${BASE_TEST_CONSTANTS.TEST_ENVIRONMEN suiteSetup(function (): void { kubernetesCommandLineToolsExecutor.loginToOcp(); + kubernetesCommandLineToolsExecutor.namespace = BASE_TEST_CONSTANTS.TEST_NAMESPACE; }); suiteSetup('Login', async function (): Promise { @@ -57,13 +58,13 @@ suite(`Workspace using a parent test suite ${BASE_TEST_CONSTANTS.TEST_ENVIRONMEN ? BASE_TEST_CONSTANTS.TS_SELENIUM_BASE_URL + '/dashboard/#/' + 'https://github.com/testsfactory/parentDevfile' : BASE_TEST_CONSTANTS.TS_SELENIUM_BASE_URL + '/dashboard/#/' + FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_REPO_URL; await dashboard.waitPage(); + await testWorkspaceUtil.switchOffTrustDialogWithJavaScript(); await browserTabsUtil.navigateTo(factoryUrl); - await createWorkspace.performTrustAuthorPopup(); await workspaceHandlingTests.obtainWorkspaceNameFromStartingPage(); registerRunningWorkspace(WorkspaceHandlingTests.getWorkspaceName()); await projectAndFileTests.waitWorkspaceReadinessForCheCodeEditor(); // add 10 sec timeout for waiting for finishing animation of all IDE parts (Welcome parts. bottom widgets. etc.) - // using 10 sec easier than performing of finishing animation a all elements + // using 10 sec easier than performing of finishing animation of all elements await driverHelper.wait(TIMEOUT_CONSTANTS.TS_SELENIUM_WAIT_FOR_URL); await projectAndFileTests.performTrustAuthorDialog(); }); diff --git a/tests/e2e/utils/workspace/ITestWorkspaceUtil.ts b/tests/e2e/utils/workspace/ITestWorkspaceUtil.ts index 1fd3ce0ae56..01a984a49f0 100644 --- a/tests/e2e/utils/workspace/ITestWorkspaceUtil.ts +++ b/tests/e2e/utils/workspace/ITestWorkspaceUtil.ts @@ -40,4 +40,9 @@ export interface ITestWorkspaceUtil { * Similar with 'force' deleting */ deleteAllWorkspaces(): Promise; + + /** + * set user preferences for Che "security.workspace.trust.enabled": false using JS. + */ + switchOffTrustDialogWithJavaScript(): Promise; } diff --git a/tests/e2e/utils/workspace/TestWorkspaceUtil.ts b/tests/e2e/utils/workspace/TestWorkspaceUtil.ts index 681ca6fc260..204e7bcff28 100644 --- a/tests/e2e/utils/workspace/TestWorkspaceUtil.ts +++ b/tests/e2e/utils/workspace/TestWorkspaceUtil.ts @@ -20,6 +20,7 @@ import axios, { AxiosResponse } from 'axios'; import { ITestWorkspaceUtil } from './ITestWorkspaceUtil'; import { ApiUrlResolver } from './ApiUrlResolver'; import { TIMEOUT_CONSTANTS } from '../../constants/TIMEOUT_CONSTANTS'; +import {string} from "yaml/dist/schema/common/string"; @injectable() export class TestWorkspaceUtil implements ITestWorkspaceUtil { @@ -172,4 +173,30 @@ export class TestWorkspaceUtil implements ITestWorkspaceUtil { await this.deleteWorkspaceByName(response.data.items[i].metadata.name); } } + + /** + * set user preferences for Che "security.workspace.trust.enabled": false using JS. in background mode + */ + async switchOffTrustDialogWithJavaScript(): Promise { + const javaScriptExecCode: string = '(async function importData() {\n' + + ' const stub = "{\\"vscode-web-db\\":{\\"vscode-userdata-store\\":{\\"/User/settings.json\\":{\\"type\\":\\"Uint8Array\\",\\"value\\":\\"%7B%0A%20%20%20%20%22security.workspace.trust.enabled%22%3A%20false%0A%7D\\"}}}}";\n' + + ' for (const [dbName, dbData] of Object.entries(JSON.parse(stub))) {\n' + + ' const req = indexedDB.open(dbName);\n' + + ' req.onupgradeneeded = ({ target: { result: db } }) =>\n' + + ' Object.keys(dbData).forEach((name) => db.createObjectStore(name));\n' + + ' await new Promise((r) => (req.onsuccess = r));\n' + + ' for (const [storeName, storeData] of Object.entries(dbData)) {\n' + + ' const transaction = req.result.transaction(storeName, "readwrite");\n' + + ' const store = transaction.objectStore(storeName);\n' + + ' store.clear();\n' + + ' for (const [key, { type, value }] of Object.entries(storeData)) {\n' + + ' const str = decodeURIComponent(value);\n' + + ' store.put(type === "String" ? str : new TextEncoder().encode(str), key);\n' + + ' }\n' + + ' await new Promise((r) => (transaction.oncomplete = r));\n' + + ' }\n' + + ' }\n' + + '})().then(() => {});' + await this.driverHelper.getDriver().executeScript(javaScriptExecCode); + } }