Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Selenium] Add DevWorkspaceHappyPath e2e typescript test #19152

Merged
merged 4 commits into from
Feb 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion tests/e2e/TestConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

@dmytro-ndp dmytro-ndp Feb 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it actually existed workspace URL or URL to it's devfile ?

If it's URL to devfile which is used to create devworkspace, TS_SELENIUM_DEVWORKSPACE_DEVFILE_URL name is more relevant to value.

Copy link
Contributor Author

@SkorikSergey SkorikSergey Feb 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is url of existed workspace.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. We can keep it as proof of conception, but in future there should be factory URL with link to raw devfile, as far as I know.


};
7 changes: 7 additions & 0 deletions tests/e2e/mocha-devworkspace-happy-path.opts
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions tests/e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
36 changes: 36 additions & 0 deletions tests/e2e/tests/e2e_happy_path/DevWorkspaceHappyPath.spec.ts
Original file line number Diff line number Diff line change
@@ -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';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Workspace name web-nodejs-sample could be misleading depending on which devworkspace devfile URL is set.

What if we name test workspace as devworkspace-sample, not linking to concrete supported language?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now this test will check workspace created from flattened_theia-next.yaml yaml. And it uses web-nodejs-sample.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IF there is only one type of supported workspaces, I might make sense to express it in the test code, e.g.:

// This test checks only workspace created from "web-nodejs-sample" https://github.com/devfile/devworkspace-operator/blob/main/samples/flattened_theia-next.yaml.

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);
});

});