From fa8b05a5d8186c5ceb018e42c4d11bfa5381a6c8 Mon Sep 17 00:00:00 2001 From: Sergey Skorik Date: Thu, 25 Feb 2021 18:29:01 +0200 Subject: [PATCH] [Selenium] Add DevWorkspaceHappyPath e2e typescript test (#19152) --- tests/e2e/TestConstants.ts | 7 +++- tests/e2e/mocha-devworkspace-happy-path.opts | 7 ++++ tests/e2e/package.json | 1 + .../DevWorkspaceHappyPath.spec.ts | 36 +++++++++++++++++++ 4 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 tests/e2e/mocha-devworkspace-happy-path.opts create mode 100644 tests/e2e/tests/e2e_happy_path/DevWorkspaceHappyPath.spec.ts diff --git a/tests/e2e/TestConstants.ts b/tests/e2e/TestConstants.ts index 7047b40d93..14c76fbf48 100644 --- a/tests/e2e/TestConstants.ts +++ b/tests/e2e/TestConstants.ts @@ -223,6 +223,11 @@ export const TestConstants = { /** * Print all timeout variables when tests launch, defaulte to false */ - TS_SELENIUM_PRINT_TIMEOUT_VARIABLES: process.env.TS_SELENIUM_PRINT_TIMEOUT_VARIABLES || false + TS_SELENIUM_PRINT_TIMEOUT_VARIABLES: process.env.TS_SELENIUM_PRINT_TIMEOUT_VARIABLES || false, + + /** + * URL of the workspace created by devworkspace-controller + */ + TS_SELENIUM_DEVWORKSPACE_URL: process.env.TS_SELENIUM_DEVWORKSPACE_URL }; diff --git a/tests/e2e/mocha-devworkspace-happy-path.opts b/tests/e2e/mocha-devworkspace-happy-path.opts new file mode 100644 index 0000000000..29526eef96 --- /dev/null +++ b/tests/e2e/mocha-devworkspace-happy-path.opts @@ -0,0 +1,7 @@ +--timeout 2200000 +--reporter 'dist/driver/CheReporter.js' +-u tdd +--bail +--full-trace +--spec dist/tests/e2e_happy_path/DevWorkspaceHappyPath.spec.js +--require source-map-support/register diff --git a/tests/e2e/package.json b/tests/e2e/package.json index 553aaea186..c601459e9b 100644 --- a/tests/e2e/package.json +++ b/tests/e2e/package.json @@ -10,6 +10,7 @@ "test": "./generateIndex.sh && npm run lint && npm run tsc && mocha --opts mocha.opts", "load-test": "./generateIndex.sh && npm run lint && npm run tsc && mocha --opts mocha-load.opts", "test-happy-path": "./generateIndex.sh && npm run lint && npm run tsc && mocha --opts mocha-happy-path.opts", + "test-devworkspace-happy-path": "./generateIndex.sh && npm run lint && npm run tsc && mocha --opts mocha-devworkspace-happy-path.opts", "test-wkspc-creation-and-ls": "./generateIndex.sh && npm run lint && npm run tsc && mocha --opts mocha-wkspc-creation-and-ls.opts", "test-java-vertx": "./generateIndex.sh && npm run lint && npm run tsc && mocha --opts mocha-java-vertx.opts", "test-git-ssh": "./generateIndex.sh && npm run lint && npm run tsc && mocha --opts mocha-git-ssh.opts", diff --git a/tests/e2e/tests/e2e_happy_path/DevWorkspaceHappyPath.spec.ts b/tests/e2e/tests/e2e_happy_path/DevWorkspaceHappyPath.spec.ts new file mode 100644 index 0000000000..584db8af77 --- /dev/null +++ b/tests/e2e/tests/e2e_happy_path/DevWorkspaceHappyPath.spec.ts @@ -0,0 +1,36 @@ +// /********************************************************************* +// * Copyright (c) 2021 Red Hat, Inc. +// * +// * This program and the accompanying materials are made +// * available under the terms of the Eclipse Public License 2.0 +// * which is available at https://www.eclipse.org/legal/epl-2.0/ +// * +// * SPDX-License-Identifier: EPL-2.0 +// **********************************************************************/ + +import { e2eContainer } from '../../inversify.config'; +import { CLASSES } from '../../inversify.types'; +import { DriverHelper } from '../../utils/DriverHelper'; +import * as projectAndFileTests from '../../testsLibrary/ProjectAndFileTests'; +import { TestConstants } from '../..'; + +const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper); + +// This test checks only workspace created from "web-nodejs-sample" https://github.com/devfile/devworkspace-operator/blob/main/samples/flattened_theia-next.yaml. +suite('Workspace creation via factory url', async () => { + + let factoryUrl : string = `${TestConstants.TS_SELENIUM_DEVWORKSPACE_URL}`; + const workspaceSampleName: string = 'web-nodejs-sample'; + const workspaceRootFolderName: string = 'app'; + + suite('Open factory URL', async () => { + test(`Navigating to factory URL`, async () => { + await driverHelper.navigateToUrl(factoryUrl); + }); + }); + + suite('Wait workspace readiness', async () => { + projectAndFileTests.waitWorkspaceReadiness(workspaceSampleName, workspaceRootFolderName); + }); + +});