-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(test): start POC test for booster terminal test
- Loading branch information
Showing
5 changed files
with
167 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
import { browser, Key, ExpectedConditions as until, $, $$ } from 'protractor'; | ||
import * as support from './support'; | ||
import { Quickstart } from './support/quickstart'; | ||
import { TextInput, Button } from './ui'; | ||
|
||
import { LandingPage } from './page_objects/landing.page'; | ||
import { SpaceDashboardPage } from './page_objects/space_dashboard.page'; | ||
import { SpaceChePage } from './page_objects/space_che.page'; | ||
import { SpaceCheWorkspacePage } from './page_objects/space_cheworkspace.page'; | ||
import { MainDashboardPage } from './page_objects/main_dashboard.page'; | ||
|
||
let globalSpaceName: string; | ||
|
||
/* Tests to verify the build pipeline */ | ||
|
||
describe('Creating new quickstart in OSIO', () => { | ||
let dashboardPage: MainDashboardPage; | ||
|
||
beforeEach(async () => { | ||
await support.desktopTestSetup(); | ||
let login = new support.LoginInteraction(); | ||
dashboardPage = await login.run(); | ||
|
||
let userProfilePage = await dashboardPage.gotoUserProfile(); | ||
support.debug(">>> Go to user's Profile Page - OK"); | ||
support.debug('>>> Go to Edit Profile Page'); | ||
let editProfilePage = await userProfilePage.gotoEditProfile(); | ||
support.debug('>>> Go to Edit Profile Page - OK'); | ||
support.debug('>>> Go to Reset Env Page'); | ||
let cleanupEnvPage = await editProfilePage.gotoResetEnvironment(); | ||
support.debug('>>> Go to Reset Env Page - OK'); | ||
|
||
await cleanupEnvPage.cleanup(browser.params.login.user); | ||
|
||
}); | ||
|
||
afterEach( async () => { | ||
await browser.sleep(support.DEFAULT_WAIT); | ||
|
||
support.writeScreenshot('target/screenshots/che_final_' + globalSpaceName + '.png'); | ||
support.info('\n ============ End of test reached ============ \n'); | ||
// support.info('\n ============ End of test reached, logging out ============ \n'); | ||
/* Logout is causing random failures on prod-preview - possibky due to navigating browser windows? */ | ||
// await dashboardPage.logout(); | ||
}); | ||
|
||
/* Simple test - accept all defaults for new quickstarts */ | ||
|
||
it('Create a new space, new ' + browser.params.quickstart.name + ' quickstart, run its pipeline', async () => { | ||
let quickstart = new Quickstart(browser.params.quickstart.name); | ||
let spaceName = support.newSpaceName(); | ||
globalSpaceName = spaceName; | ||
let spaceDashboardPage = await dashboardPage.createNewSpace(spaceName); | ||
|
||
let wizard = await spaceDashboardPage.addToSpace(); | ||
|
||
support.info('Creating quickstart: ' + quickstart.name); | ||
await wizard.newQuickstartProject({ project: quickstart.name }); | ||
await spaceDashboardPage.ready(); | ||
|
||
/* This statement does not reliably wait for the modal dialog to disappear: | ||
await browser.wait(until.not(until.visibilityOf(spaceDashboardPage.modalFade)), support.LONGEST_WAIT); | ||
The above statement fails with this error: Failed: unknown error: Element <a id="spacehome-pipelines-title" | ||
href="/username/spaceName/create/pipelines">...</a> is not clickable at point (725, 667). Other element would | ||
receive the click: <modal-container class="modal fade" role="dialog" tabindex="-1" style="display: | ||
block;">...</modal-container> | ||
The only reliable way to avoid this is a sleep statement: await browser.sleep(5000); */ | ||
await browser.sleep(5000); | ||
|
||
/* Open Che display page */ | ||
|
||
// tslint:disable:max-line-length | ||
await spaceDashboardPage.codebasesSectionTitle.clickWhenReady(); | ||
|
||
let spaceChePage = new SpaceChePage(); | ||
await spaceChePage.createCodebase.clickWhenReady(support.LONGEST_WAIT); | ||
|
||
/* A new browser window is opened when Che opens - switch to that new window now */ | ||
let handles = await browser.getAllWindowHandles(); | ||
support.debug('Number of browser tabs before = ' + handles.length); | ||
|
||
handles = await browser.getAllWindowHandles(); | ||
while (handles.length < 2) { | ||
support.info ('***Waiting for Che browser window to open***'); | ||
await browser.sleep (3000); | ||
handles = await browser.getAllWindowHandles(); | ||
} | ||
|
||
support.debug('Number of browser tabs after = ' + handles.length); | ||
support.writeScreenshot('target/screenshots/che_workspace_parta_' + spaceName + '.png'); | ||
|
||
/* Switch to the Che browser window */ | ||
await browser.switchTo().window(handles[1]); | ||
|
||
let spaceCheWorkSpacePage = new SpaceCheWorkspacePage(); | ||
support.writeScreenshot('target/screenshots/che_workspace_partb_' + spaceName + '.png'); | ||
|
||
let projectInCheTree = new Button(spaceCheWorkSpacePage.recentProjectRootByName(spaceName), 'Project in Che Tree'); | ||
await projectInCheTree.untilPresent(support.LONGEST_WAIT); | ||
support.writeScreenshot('target/screenshots/che_workspace_partc_' + spaceName + '.png'); | ||
|
||
expect(await spaceCheWorkSpacePage.recentProjectRootByName(spaceName).getText()).toContain(spaceName); | ||
|
||
// Defer this test to speed up test execution as hourly ee test | ||
// await spaceCheWorkSpacePage.mainMenuRunButton.clickWhenReady(support.LONGEST_WAIT); | ||
// | ||
// await spaceCheWorkSpacePage.mainMenuRunButtonRunSelection.clickWhenReady(support.LONGEST_WAIT); | ||
// await spaceCheWorkSpacePage.bottomPanelRunTab.clickWhenReady(support.LONGEST_WAIT); | ||
// | ||
// await browser.wait(until.textToBePresentInElement(spaceCheWorkSpacePage.bottomPanelCommandConsoleLines, 'Succeeded in deploying verticle'), support.LONGER_WAIT); | ||
// let textStr = await spaceCheWorkSpacePage.bottomPanelCommandConsoleLines.getText(); | ||
// support.info('Output from run = ' + textStr); | ||
// expect(await spaceCheWorkSpacePage.bottomPanelCommandConsoleLines.getText()).toContain('Succeeded in deploying verticle'); | ||
|
||
/* Open the terminal window and execute a command */ | ||
await spaceCheWorkSpacePage.bottomPanelTerminalTab.clickWhenReady(); | ||
// await browser.driver.actions().mouseDown(spaceCheWorkSpacePage.bottomPanelTerminal).click().sendKeys(' ls -la').perform(); | ||
// await browser.driver.actions().mouseDown(spaceCheWorkSpacePage.bottomPanelTerminal).click().sendKeys(Key.ENTER).perform(); | ||
await support.printTerminal(spaceCheWorkSpacePage, 'ls -la'); | ||
await support.printTerminal(spaceCheWorkSpacePage, 'cd ' + spaceName); | ||
await support.printTerminal(spaceCheWorkSpacePage, 'ls -la'); | ||
await support.printTerminal(spaceCheWorkSpacePage, 'mvn install'); | ||
await browser.sleep(support.DEFAULT_WAIT); | ||
|
||
let theText = await spaceCheWorkSpacePage.bottomPanelTerminal.getText(); | ||
support.info ('retrieved text = ' + theText); | ||
|
||
/* Switch back to the OSIO browser window */ | ||
await browser.switchTo().window(handles[0]); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters