Skip to content

Commit

Permalink
Implemented new Python Django devfile test
Browse files Browse the repository at this point in the history
Signed-off-by: Tibor Dancs <tdancs@redhat.com>
  • Loading branch information
ScrewTSW committed Jan 22, 2020
1 parent 9284f1c commit 1e8e2e0
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 7 deletions.
8 changes: 8 additions & 0 deletions tests/e2e/mocha-python-django.opts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
--timeout 2200000
--reporter 'dist/driver/CheReporter.js'
-u tdd
--bail
--full-trace
--spec dist/tests/login/Login.spec.js
--spec dist/tests/devfiles/PythonDjango.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 @@ -14,6 +14,7 @@
"test-operatorhub-installation": "./generateIndex.sh && npm run lint && npm run tsc && mocha --opts mocha-che-operatorhub.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-python-django": "./generateIndex.sh && npm run lint && npm run tsc && mocha --opts mocha-python-django.opts",
"test-all-devfiles": "./generateIndex.sh && npm run lint && npm run tsc && mocha --opts mocha-all-devfiles.opts",
"lint": "tslint --fix -p .",
"tsc": "tsc -p ."
Expand Down
6 changes: 3 additions & 3 deletions tests/e2e/tests/devfiles/JavaMaven.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@ const codeNavigationClassName: string = 'String.class';
const stack : string = 'Java Maven';
const taskName: string = 'maven build';

suite('Java Maven test', async () => {
suite(`${stack} test`, async () => {
suite (`Create ${stack} workspace ${workspaceName}`, async () => {
workspaceHandling.createAndOpenWorkspace(workspaceName, stack);
projectAndFileTests.waitWorkspaceReadiness(workspaceName, sampleName, 'src');
});

suite('Validation of workspace build and run', async () => {
codeExecutionTests.runTask(taskName, 120000);
codeExecutionTests.runTask(taskName, 120_000);
codeExecutionTests.closeTerminal(taskName);
});

suite('Language server validation', async () => {
projectAndFileTests.openFile(fileFolderPath, tabTitle);
commonLsTests.waitLSInitialization('Starting Java Language Server', 1800000, 360000);
commonLsTests.waitLSInitialization('Starting Java Language Server', 1_800_000, 360_000);
commonLsTests.suggestionInvoking(tabTitle, 10, 20, 'append(char c) : PrintStream');
commonLsTests.errorHighlighting(tabTitle, 'error', 11);
commonLsTests.autocomplete(tabTitle, 10, 11, 'System - java.lang');
Expand Down
6 changes: 3 additions & 3 deletions tests/e2e/tests/devfiles/JavaVertx.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const buildTaskName: string = 'maven build';
const LSstarting: string = 'Starting Java Language Server';
const stack: string = 'Java Vert.x';

suite('Java Vert.x test', async () => {
suite(`${stack} test`, async () => {

suite (`Create ${stack} workspace ${workspaceName}`, async () => {
workspaceHandling.createAndOpenWorkspace(workspaceName, stack);
Expand All @@ -32,15 +32,15 @@ suite('Java Vert.x test', async () => {

suite('Language server validation', async () => {
projectAndFileTests.openFile(fileFolderPath, tabTitle);
commonLsTests.waitLSInitialization(LSstarting, 1800000, 360000);
commonLsTests.waitLSInitialization(LSstarting, 1_800_000, 360_000);
commonLsTests.suggestionInvoking(tabTitle, 19, 31, 'router(Vertx vertx) : Router');
commonLsTests.errorHighlighting(tabTitle, 'error', 20);
commonLsTests.autocomplete(tabTitle, 19, 7, 'Router - io.vertx.ext.web');
commonLsTests.codeNavigation(tabTitle, 19, 7, codeNavigationClassName);
});

suite('Validation of project build', async () => {
codeExecutionTests.runTask(buildTaskName, 120000);
codeExecutionTests.runTask(buildTaskName, 120_000);
codeExecutionTests.closeTerminal(buildTaskName);
});

Expand Down
51 changes: 51 additions & 0 deletions tests/e2e/tests/devfiles/PythonDjango.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*********************************************************************
* Copyright (c) 2019 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 { NameGenerator } from '../../utils/NameGenerator';
import 'reflect-metadata';
import * as codeExecutionHelper from '../../testsLibrary/CodeExecutionTests';
import * as workspaceHandler from '../../testsLibrary/WorksapceHandlingTests';
import * as projectManager from '../../testsLibrary/ProjectAndFileTests';

const workspaceName: string = NameGenerator.generate('wksp-test-', 5);
const workspaceStack: string = 'Python Django';
const workspaceSampleName: string = 'django-realworld-example-app';
const workspaceRootFolderName: string = 'conduit';

const taskInstallDependencies: string = 'install dependencies';
const taskMigrate: string = 'migrate';
const taskRunServer: string = 'run server';

suite(`${workspaceStack} test`, async () => {

suite(`Create ${workspaceStack} workspace ${workspaceName}`, async () => {
workspaceHandler.createAndOpenWorkspace(workspaceName, workspaceStack);
projectManager.waitWorkspaceReadiness(workspaceName, workspaceSampleName, workspaceRootFolderName);
})

suite('Install dependencies', async () => {
codeExecutionHelper.runTask(taskInstallDependencies, 60_000);
codeExecutionHelper.closeTerminal(taskInstallDependencies);
});

suite('Migrate Django application project', async () => {
codeExecutionHelper.runTask(taskMigrate, 30_000);
codeExecutionHelper.closeTerminal(taskMigrate);
});

suite('Run django server', async () => {
codeExecutionHelper.runTaskWithDialogShell(taskRunServer, 30_000, true, true);
});

suite('Stop and remove workspace', async() => {
workspaceHandler.stopWorkspace(workspaceName);
workspaceHandler.removeWorkspace(workspaceName);
});

});
2 changes: 1 addition & 1 deletion tests/e2e/testsLibrary/CodeExecutionTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const topMenu: TopMenu = e2eContainer.get(CLASSES.TopMenu);
const ide: Ide = e2eContainer.get(CLASSES.Ide);

export function runTask(taskName: string, timeout: number) {
test( `Run command '${taskName}'`, async () => {
test(`Run command '${taskName}'`, async () => {
await topMenu.runTask(taskName);
await ide.waitNotification('has exited with code 0.', timeout);
});
Expand Down

0 comments on commit 1e8e2e0

Please sign in to comment.