/*********************************************************************
 * Copyright (c) 2020 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 'reflect-metadata' ; import { CLASSES } from '../../inversify.types' ; import { LanguageServerTests } from '../../testsLibrary/LanguageServerTests' ; import { e2eContainer } from '../../inversify.config' ; import { CodeExecutionTests } from '../../testsLibrary/CodeExecutionTests' ; import { ProjectAndFileTests } from '../../testsLibrary/ProjectAndFileTests' ; import { WorkspaceHandlingTests } from '../../testsLibrary/WorkspaceHandlingTests' ; import CheReporter from '../../driver/CheReporter' ; const workspaceHandlingTests = e2eContainer . get ( CLASSES . WorkspaceHandlingTests ) ; const projectAndFileTests = e2eContainer . get ( CLASSES . ProjectAndFileTests ) ; const commonLanguageServerTests = e2eContainer . get ( CLASSES . LanguageServerTests ) ; const codeExecutionTests = e2eContainer . get ( CLASSES . CodeExecutionTests ) ; const workspaceSampleName = 'console-scala-simple' ; const workspaceRootFolderName = 'example' ; const fileFolderPath = `${ workspaceSampleName }/${ workspaceRootFolderName }/src/main/scala/org/eclipse/che/examples` ; const tabTitle = 'HelloWorld.scala' ; const compileTaskkName = 'sbt compile' ; const runTaskName = 'sbt run' ; const testTaskName = 'sbt test' ; const stack = 'Scala' ; let workspaceName ; suite . skip ( `${ stack } test` , async ( ) => { suite ( `Create ${ stack } workspace` , async ( ) => { workspaceHandlingTests . createAndOpenWorkspace ( stack ) ; test ( 'Register running workspace' , async ( ) => { workspaceName = WorkspaceHandlingTests . getWorkspaceName ( ) ; CheReporter . registerRunningWorkspace ( workspaceName ) ; } ) ; projectAndFileTests . waitWorkspaceReadiness ( workspaceSampleName , workspaceRootFolderName , false ) ; } ) ; suite ( 'Test opening file' , async ( ) => { projectAndFileTests . openFile ( fileFolderPath , tabTitle ) ; } ) ; suite ( 'Validation of commands' , async ( ) => { codeExecutionTests . runTask ( compileTaskkName , 240000 ) ; codeExecutionTests . closeTerminal ( compileTaskkName ) ; codeExecutionTests . runTaskInputText ( runTaskName , '[info] running org.eclipse.che.examples.HelloWorld' , 'Test User' , 120000 ) ; codeExecutionTests . closeTerminal ( runTaskName ) ; codeExecutionTests . runTask ( testTaskName , 120000 ) ; codeExecutionTests . closeTerminal ( testTaskName ) ; } ) ; suite ( 'Language server validation' , async ( ) => { commonLanguageServerTests . errorHighlighting ( tabTitle , 'Abc:' , 21 ) ; commonLanguageServerTests . autocomplete ( tabTitle , 25 , 28 , 'name: String' ) ; } ) ; suite ( 'Stopping and deleting the workspace' , async ( ) => { test ( `Stop and remowe workspace` , async ( ) => { await workspaceHandlingTests . stopAndRemoveWorkspace ( workspaceName ) ; } ) ; } ) ; } ) ;