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

[E2E] Update typescript tests according to workspace creation changes #13544

Merged
merged 3 commits into from
Jun 14, 2019
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
20 changes: 16 additions & 4 deletions e2e/pageobjects/dashboard/NewWorkspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ import { By } from 'selenium-webdriver';
import 'reflect-metadata';
import { Dashboard } from './Dashboard';
import { Workspaces } from './Workspaces';
import { Ide } from '../ide/Ide';
import { TestWorkspaceUtil, WorkspaceStatus } from '../../utils/workspace/TestWorkspaceUtil';
import { WorkspaceDetails } from './workspace-details/WorkspaceDetails';
import { TestWorkspaceUtil, Ide, WorkspaceStatus } from '../..';


@injectable()
Expand All @@ -44,17 +43,30 @@ export class NewWorkspace {
await this.prepareWorkspace(workspaceName, dataStackId, sampleName);
await this.clickOnCreateAndOpenButton();

await this.waitPageAbsence();
await this.driverHelper.waitVisibility(By.css(Ide.ACTIVATED_IDE_IFRAME_CSS));
await this.testWorkspaceUtil.waitWorkspaceStatus(namespace, workspaceName, WorkspaceStatus.STARTING);
}

async waitPageAbsence(timeout: number = TestConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT) {
await this.driverHelper.waitDisappearanceTestWithTimeout(By.css(NewWorkspace.NAME_FIELD_CSS), timeout);
await this.driverHelper.waitDisappearanceTestWithTimeout(By.css(NewWorkspace.TITLE_CSS), timeout);
}

async createWorkspaceAndProceedEditing(workspaceName: string, dataStackId: string, sampleName: string) {
await this.prepareWorkspace(workspaceName, dataStackId, sampleName);
await this.selectCreateWorkspaceAndProceedEditing();

await this.workspaceDetails.waitPage(workspaceName);
}

async createAndOpenWorksapce(workspaceName: string, dataStackId: string, sampleName: string) {
await this.prepareWorkspace(workspaceName, dataStackId, sampleName);
await this.clickOnCreateAndOpenButton();

await this.workspaceDetails.waitPage(workspaceName);
}

async confirmProjectAdding(sampleName: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
await this.clickOnAddButton(timeout);
await this.waitProjectAdding(sampleName, timeout);
Expand Down Expand Up @@ -170,11 +182,11 @@ export class NewWorkspace {
}

private getStackCssLocator(dataStackId: string): string {
return `div[data-stack-id='${dataStackId}']`;
return `span[devfile-name='${dataStackId}']`;
}

private getSelectedStackCssLocator(dataStackId: string) {
return `div.stack-selector-item-selected[data-stack-id='${dataStackId}']`;
return `div.devfile-selector-item-selected[data-devfile-id='${dataStackId}']`;
}

private async prepareWorkspace(workspaceName: string, dataStackId: string, sampleName: string) {
Expand Down
26 changes: 9 additions & 17 deletions e2e/tests/e2e/WorkspaceCreationAndLsInitialization.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,19 @@ import { ILoginPage } from '../../pageobjects/login/ILoginPage';
import { Dashboard } from '../../pageobjects/dashboard/Dashboard';
import { NameGenerator } from '../../utils/NameGenerator';
import { NewWorkspace } from '../../pageobjects/dashboard/NewWorkspace';
import { WorkspaceDetailsPlugins } from '../../pageobjects/dashboard/workspace-details/WorkspaceDetailsPlugins';
import { Ide } from '../../pageobjects/ide/Ide';
import { ProjectTree } from '../../pageobjects/ide/ProjectTree';
import { Editor } from '../../pageobjects/ide/Editor';

const workspaceName: string = NameGenerator.generate('wksp-test-', 5);
const namespace: string = 'che';
const sampleName: string = 'console-java-simple';
const pluginId: string = 'redhat/java/0.45.0';
const pluginVersion: string = '0.45.0';
const javaPluginName: string = `Language Support for Java`;
const fileFolderPath: string = `${sampleName}/src/main/java/org/eclipse/che/examples`;
const tabTitle: string = 'HelloWorld.java';

const loginPage: ILoginPage = e2eContainer.get<ILoginPage>(TYPES.LoginPage);
const dashboard: Dashboard = e2eContainer.get(CLASSES.Dashboard);
const newWorkspace: NewWorkspace = e2eContainer.get(CLASSES.NewWorkspace);
const workspaceDetailsPlugins: WorkspaceDetailsPlugins = e2eContainer.get(CLASSES.WorkspaceDetailsPlugins);
const ide: Ide = e2eContainer.get(CLASSES.Ide);
const projectTree: ProjectTree = e2eContainer.get(CLASSES.ProjectTree);
const editor: Editor = e2eContainer.get(CLASSES.Editor);
Expand All @@ -49,14 +44,9 @@ suite('E2E', async () => {
await newWorkspace.openPageByUI();
});

test(`Create a '${workspaceName}' workspace and proceed editing`, async () => {
await newWorkspace.createWorkspaceAndProceedEditing(workspaceName, 'che7-preview', sampleName);
test('Create and open workspace', async () => {
await newWorkspace.createAndRunWorkspace(namespace, workspaceName, 'Java Maven', sampleName);
});

test('Add \'Java Language Support\' plugin to workspace', async () => {
await workspaceDetailsPlugins.addPluginAndOpenWorkspace(namespace, workspaceName, javaPluginName, pluginId, pluginVersion);
});

});

suite('Work with IDE', async () => {
Expand All @@ -76,18 +66,20 @@ suite('E2E', async () => {
await projectTree.expandPathAndOpenFile(fileFolderPath, tabTitle);
});

// unskip after resolving issue https://github.com/eclipse/che/issues/12904
test.skip('Check "Java Language Server" initialization by statusbar', async () => {
test('Check "Java Language Server" initialization by statusbar', async () => {
await ide.waitStatusBarContains('Starting Java Language Server');
await ide.waitStatusBarContains('100% Starting Java Language Server');
await ide.waitStatusBarTextAbcence('Starting Java Language Server');
});

// unskip after resolving issue https://github.com/eclipse/che/issues/12904
test.skip('Check "Java Language Server" initialization by suggestion invoking', async () => {
test('Check "Java Language Server" initialization by suggestion invoking', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Yay! We are having more tests! :-D

await ide.closeAllNotifications();
await editor.waitEditorAvailable(tabTitle);
await editor.clickOnTab(tabTitle);
await editor.waitEditorAvailable(tabTitle);
await editor.waitTabFocused(tabTitle);
await editor.moveCursorToLineAndChar(tabTitle, 6, 20);
await editor.pressControlSpaceCombination(tabTitle);
await editor.waitSuggestion(tabTitle, 'append(CharSequence csq, int start, int end) : PrintStream');
});

});
Expand Down