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

Update protractor to fix travis e2e tests #3747

Merged
merged 10 commits into from
Aug 13, 2019
5,853 changes: 2,903 additions & 2,950 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
"ng-packagr": "^4.7.1",
"ngrx-store-freeze": "^0.2.3",
"npm-run-all": "^4.1.5",
"protractor": "^5.4.0",
"protractor": "^5.4.2",
"ps-node": "^0.1.6",
"q": "^1.4.1",
"replace-in-file": "^3.4.0",
Expand Down
14 changes: 10 additions & 4 deletions src/test-e2e/application/application-delete-e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ describe('Application Delete', () => {
let nav: SideNavigation;
let appWall: ApplicationsPage;
let applicationE2eHelper: ApplicationE2eHelper;
let cfGuid, app;
let testAppName;
let cfGuid: string;
let app;
let testAppName: string;

beforeAll(() => {
nav = new SideNavigation();
Expand Down Expand Up @@ -55,7 +56,7 @@ describe('Application Delete', () => {
it('Should return to summary page after cancel', () => {
const appSummaryPage = new ApplicationBasePage(cfGuid, app.metadata.guid);
appSummaryPage.navigateTo();
appSummaryPage.waitForPage();
appSummaryPage.waitForPage(40000);
// Open delete app dialog
const deleteApp = appSummaryPage.delete(testAppName);
// App did not have a route, so there should be no routes step
Expand All @@ -73,6 +74,11 @@ describe('Application Delete', () => {
const timeout = 100000;
extendE2ETestTime(timeout);

beforeAll(() => {
expect(app).toBeDefined();
expect(testAppName).toBeDefined();
});

it('Should delete app', () => {
// We should be on the app wall
expect(appWall.isActivePage()).toBeTruthy();
Expand All @@ -81,7 +87,7 @@ describe('Application Delete', () => {
appWall.appList.header.refresh();

appWall.appList.header.setSearchText(testAppName);
expect(appWall.appList.getTotalResults()).toBe(1);
expect(appWall.appList.getTotalResults()).toBe(1, 'Failed to find app that we should test delete on');

// Open delete app dialog
const appSummaryPage = new ApplicationBasePage(cfGuid, app.metadata.guid);
Expand Down
8 changes: 4 additions & 4 deletions src/test-e2e/application/application-deploy-e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { ApplicationPageRoutesTab } from './po/application-page-routes.po';
import { ApplicationPageSummaryTab } from './po/application-page-summary.po';
import { ApplicationPageVariablesTab } from './po/application-page-variables.po';
import { ApplicationBasePage } from './po/application-page.po';
import { CreateApplication } from './po/create-application.po';
import { DeployApplication } from './po/deploy-app.po';

let nav: SideNavigation;
let appWall: ApplicationsPage;
Expand Down Expand Up @@ -65,20 +65,20 @@ describe('Application Deploy -', () => {
beforeAll(() => nav.goto(SideNavMenuItem.Applications));

// Might take a bit longer to deploy the app than the global default timeout allows
beforeEach(function() {
beforeEach(function () {
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 120000;
});

afterEach(function() {
afterEach(function () {
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
});

// Allow up to 2 minutes for the application to be deployed
describe('Should deploy app from GitHub', () => {

const loggingPrefix = 'Application Deploy: Deploy from Github:';
let deployApp;
let deployApp: DeployApplication;

beforeAll(() => {
// Should be on deploy app modal
Expand Down
268 changes: 134 additions & 134 deletions src/test-e2e/application/application-view-e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,181 +81,181 @@ describe('Application View -', () => {
});
});

it('Walk tabs', () => {
appSummary.navigateTo();

appSummary.goToInstancesTab();
appSummary.goToRoutesTab();
appSummary.goToLogStreamTab();
appSummary.goToServicesTab();
appSummary.goToVariablesTab();
appSummary.goToEventsTab();
appSummary.goToSummaryTab();
});

describe('Summary Tab -', () => {
describe('Tabs', () => {
beforeAll(() => {
appSummary.navigateTo();
appSummary.waitForPage();
ApplicationsPage.goToAppSummary(appName, CFHelpers.cachedDefaultCfGuid, app.metadata.guid);
});

it('Status', () => {
appSummary.cardStatus.waitForStatus('Incomplete');
it('Walk tabs', () => {
appSummary.goToInstancesTab();
appSummary.goToRoutesTab();
appSummary.goToLogStreamTab();
appSummary.goToServicesTab();
appSummary.goToVariablesTab();
appSummary.goToEventsTab();
appSummary.goToSummaryTab();
});

it('Instances', () => {
appSummary.cardInstances.waitForRunningInstancesText('0 / 1');
});

it('App Running', () => {
appSummary.cardUptime.waitForTitle('Application is not running');
});
describe('Summary Tab -', () => {
it('Status', () => {
appSummary.goToSummaryTab();
appSummary.cardStatus.waitForStatus('Incomplete');
});

it('Info', () => {
expect(appSummary.cardInfo.memQuota.getValue()).toBe('23 MB');
expect(appSummary.cardInfo.diskQuota.getValue()).toBe('35 MB');
expect(appSummary.cardInfo.appState.getValue()).toBe('STOPPED');
expect(appSummary.cardInfo.packageState.getValue()).toBe('PENDING');
expect(appSummary.cardInfo.services.getValue()).toBe('0');
expect(appSummary.cardInfo.routes.getValue()).toBe('0');
});
it('Instances', () => {
appSummary.cardInstances.waitForRunningInstancesText('0 / 1');
});

it('Cf', () => {
const defaultCf = e2e.secrets.getDefaultCFEndpoint();
it('App Running', () => {
appSummary.cardUptime.waitForTitle('Application is not running');
});

expect(appSummary.cardCfInfo.cf.getValue()).toBe(defaultCf.name);
expect(appSummary.cardCfInfo.org.getValue()).toBe(defaultCf.testOrg);
expect(appSummary.cardCfInfo.space.getValue()).toBe(defaultCf.testSpace);
});
it('Info', () => {
expect(appSummary.cardInfo.memQuota.getValue()).toBe('23 MB');
expect(appSummary.cardInfo.diskQuota.getValue()).toBe('35 MB');
expect(appSummary.cardInfo.appState.getValue()).toBe('STOPPED');
expect(appSummary.cardInfo.packageState.getValue()).toBe('PENDING');
expect(appSummary.cardInfo.services.getValue()).toBe('0');
expect(appSummary.cardInfo.routes.getValue()).toBe('0');
});

it('Build Info', () => {
expect(appSummary.cardBuildInfo.buildPack.getValue()).toBe('-');
expect(appSummary.cardBuildInfo.stack.getValue()).toBe(defaultStack);
});
it('Cf', () => {
const defaultCf = e2e.secrets.getDefaultCFEndpoint();

it('Deployment Info', () => {
appSummary.cardDeployInfo.waitForTitle('Deployment Info');
expect(appSummary.cardDeployInfo.getContent()).toBe('None');
});
});
expect(appSummary.cardCfInfo.cf.getValue()).toBe(defaultCf.name);
expect(appSummary.cardCfInfo.org.getValue()).toBe(defaultCf.testOrg);
expect(appSummary.cardCfInfo.space.getValue()).toBe(defaultCf.testSpace);
});

describe('Instances Tab -', () => {
let appInstances: ApplicationPageInstancesTab;
it('Build Info', () => {
expect(appSummary.cardBuildInfo.buildPack.getValue()).toBe('-');
expect(appSummary.cardBuildInfo.stack.getValue()).toBe(defaultStack);
});

beforeAll(() => {
appInstances = new ApplicationPageInstancesTab(CFHelpers.cachedDefaultCfGuid, app.metadata.guid);
appInstances.navigateTo();
appInstances.waitForPage();
it('Deployment Info', () => {
appSummary.cardDeployInfo.waitForTitle('Deployment Info');
expect(appSummary.cardDeployInfo.getContent()).toBe('None');
});
});

it('Status', () => {
appInstances.cardStatus.waitForStatus('Incomplete');
});
describe('Instances Tab -', () => {
let appInstances: ApplicationPageInstancesTab;

it('Instances', () => {
appInstances.cardInstances.waitForRunningInstancesText('0 / 1');
});
beforeAll(() => {
appInstances = new ApplicationPageInstancesTab(CFHelpers.cachedDefaultCfGuid, app.metadata.guid);
appInstances.goToInstancesTab();
appInstances.waitForPage();
});

it('App Running', () => {
appInstances.cardUsage.waitForTitle('Application is not running');
});
it('Status', () => {
appInstances.cardStatus.waitForStatus('Incomplete');
});

it('Empty Instances Table', () => {
expect(appInstances.list.empty.getDefault().isDisplayed()).toBeTruthy();
expect(appInstances.list.empty.getDefault().getComponent().getText()).toBe('There are no application instances');
});
it('Instances', () => {
appInstances.cardInstances.waitForRunningInstancesText('0 / 1');
});

});
it('App Running', () => {
appInstances.cardUsage.waitForTitle('Application is not running');
});

describe('Routes Tab -', () => {
let appRoutes: ApplicationPageRoutesTab;
it('Empty Instances Table', () => {
expect(appInstances.list.empty.getDefault().isDisplayed()).toBeTruthy();
expect(appInstances.list.empty.getDefault().getComponent().getText()).toBe('There are no application instances');
});

beforeAll(() => {
appRoutes = new ApplicationPageRoutesTab(CFHelpers.cachedDefaultCfGuid, app.metadata.guid);
appRoutes.navigateTo();
appRoutes.waitForPage();
});

it('Empty Routes Table', () => {
expect(appRoutes.list.empty.getDefault().isPresent()).toBeFalsy();
expect(appRoutes.list.empty.getDefault().getComponent().isPresent()).toBeFalsy();
expect(appRoutes.list.empty.getCustom().getComponent().isDisplayed()).toBeTruthy();
expect(appRoutes.list.empty.getCustomLineOne()).toBe('This application has no routes');
});
describe('Routes Tab -', () => {
let appRoutes: ApplicationPageRoutesTab;

it('Should be able to cancel from Add Route', () => {
expect(appRoutes.list.header.getAdd().isDisplayed()).toBeTruthy();
appRoutes.list.header.getAdd().click();
beforeAll(() => {
appRoutes = new ApplicationPageRoutesTab(CFHelpers.cachedDefaultCfGuid, app.metadata.guid);
appRoutes.goToRoutesTab();
appRoutes.waitForPage();
});

const addRoutePage = new CreateRoutesPage(CFHelpers.cachedDefaultCfGuid, app.metadata.guid, app.entity.space_guid);
expect(addRoutePage.isActivePage()).toBeTruthy();
expect(addRoutePage.header.getTitleText()).toBe('Create Route');
expect(addRoutePage.type.getSelected().getText()).toBe('Create and map new route');
it('Empty Routes Table', () => {
expect(appRoutes.list.empty.getDefault().isPresent()).toBeFalsy();
expect(appRoutes.list.empty.getDefault().getComponent().isPresent()).toBeFalsy();
expect(appRoutes.list.empty.getCustom().getComponent().isDisplayed()).toBeTruthy();
expect(appRoutes.list.empty.getCustomLineOne()).toBe('This application has no routes');
});

expect(addRoutePage.stepper.canCancel()).toBeTruthy();
addRoutePage.stepper.cancel();
it('Should be able to cancel from Add Route', () => {
expect(appRoutes.list.header.getAdd().isDisplayed()).toBeTruthy();
appRoutes.list.header.getAdd().click();

// Should return back to App Routes
appRoutes.waitForPage();
});
});
const addRoutePage = new CreateRoutesPage(CFHelpers.cachedDefaultCfGuid, app.metadata.guid, app.entity.space_guid);
expect(addRoutePage.isActivePage()).toBeTruthy();
expect(addRoutePage.header.getTitleText()).toBe('Create Route');
expect(addRoutePage.type.getSelected().getText()).toBe('Create and map new route');

// Events tab tests should come before anything else adds events
describe('Events Tab -', () => {
let appEvents: ApplicationPageEventsTab;
expect(addRoutePage.stepper.canCancel()).toBeTruthy();
addRoutePage.stepper.cancel();

beforeAll(() => {
appEvents = new ApplicationPageEventsTab(CFHelpers.cachedDefaultCfGuid, app.metadata.guid);
appEvents.navigateTo();
appEvents.waitForPage();
// Should return back to App Routes
appRoutes.waitForPage();
});
});

it('One row in events table', () => {
expect(appEvents.list.empty.isDisplayed()).toBeFalsy();
expect(appEvents.list.isTableView()).toBeTruthy();
expect(appEvents.list.getTotalResults()).toBe(1);
expect(appEvents.list.table.getCell(0, 1).getText()).toBe('audit\napp\ncreate');
expect(appEvents.list.table.getCell(0, 2).getText()).toBe('person\nadmin');
});
// Events tab tests should come before anything else adds events
describe('Events Tab -', () => {
let appEvents: ApplicationPageEventsTab;

});
beforeAll(() => {
appEvents = new ApplicationPageEventsTab(CFHelpers.cachedDefaultCfGuid, app.metadata.guid);
appEvents.goToEventsTab();
appEvents.waitForPage();
});

describe('Variables Tab -', () => {
let appVariables: ApplicationPageVariablesTab;
it('One row in events table', () => {
expect(appEvents.list.empty.isDisplayed()).toBeFalsy();
expect(appEvents.list.isTableView()).toBeTruthy();
expect(appEvents.list.getTotalResults()).toBe(1);
expect(appEvents.list.table.getCell(0, 1).getText()).toBe('audit\napp\ncreate');
expect(appEvents.list.table.getCell(0, 2).getText()).toBe('person\nadmin');
});

beforeAll(() => {
appVariables = new ApplicationPageVariablesTab(CFHelpers.cachedDefaultCfGuid, app.metadata.guid);
appVariables.goToVariablesTab();
appVariables.waitForPage();
});

it('Empty Variables Table', () => {
expect(appVariables.list.empty.getDefault().isPresent()).toBeTruthy();
expect(appVariables.list.empty.getDefault().getComponent().getText()).toBe('There are no variables');
});
describe('Variables Tab -', () => {
let appVariables: ApplicationPageVariablesTab;

beforeAll(() => {
appVariables = new ApplicationPageVariablesTab(CFHelpers.cachedDefaultCfGuid, app.metadata.guid);
appVariables.goToVariablesTab();
appVariables.waitForPage();
});

it('CRUD Env Var', () => {
appVariables.list.empty.waitUntilShown();
it('Empty Variables Table', () => {
expect(appVariables.list.empty.getDefault().isPresent()).toBeTruthy();
expect(appVariables.list.empty.getDefault().getComponent().getText()).toBe('There are no variables');
});

// Add Env Var
const envVarName = E2EHelpers.createCustomName('envVar');
const envVarValue = 'new env var value';
appVariables.addVariable(envVarName, envVarValue);
it('CRUD Env Var', () => {
appVariables.list.empty.waitUntilShown();

expect(appVariables.list.table.getRows().count()).toBe(1);
expect(appVariables.list.table.getCell(0, 1).getText()).toBe(envVarName);
expect(appVariables.list.table.getCell(0, 2).getText()).toBe(envVarValue);
// Add Env Var
const envVarName = E2EHelpers.createCustomName('envVar');
const envVarValue = 'new env var value';
appVariables.addVariable(envVarName, envVarValue);

// Edit Env Var
const envVarValueEdited = `${envVarValue}-edited`;
appVariables.editVariable(0, envVarValueEdited);
expect(appVariables.list.table.getCell(0, 2).getText()).toBe(envVarValueEdited);
expect(appVariables.list.table.getRows().count()).toBe(1);
expect(appVariables.list.table.getCell(0, 1).getText()).toBe(envVarName);
expect(appVariables.list.table.getCell(0, 2).getText()).toBe(envVarValue);

// Delete Env Var
appVariables.deleteVariable(0, envVarName);
appVariables.list.empty.waitUntilShown();
});
// Edit Env Var
const envVarValueEdited = `${envVarValue}-edited`;
appVariables.editVariable(0, envVarValueEdited);
expect(appVariables.list.table.getCell(0, 2).getText()).toBe(envVarValueEdited);

// Delete Env Var
appVariables.deleteVariable(0, envVarName);
appVariables.list.empty.waitUntilShown();
});

});
});

});
Loading