Skip to content

Run on e2e setup, test add to project flow, prepwork for Run On OpenShift tests #1057

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

Merged
merged 1 commit into from
Jan 25, 2017
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
5 changes: 4 additions & 1 deletion test/.jshintrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"node": true,
"browser": true,
"esnext": true,
"esversion": 6,
"bitwise": true,
"camelcase": false,
"curly": true,
Expand All @@ -18,7 +18,9 @@
"sub" : true,
"undef": true,
"unused": true,
"expr" : true,
"globals": {
"ace": false,
"after": false,
"afterEach": false,
"afterAll": false,
Expand All @@ -32,6 +34,7 @@
"expect": false,
"inject": false,
"it": false,
"xit": false,
"jasmine": false,
"spyOn": false,
"hawtioPluginLoader": false,
Expand Down
66 changes: 66 additions & 0 deletions test/integration/features/user_adds_template_to_project.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
'use strict';

require('jasmine-beforeall');
var h = require('../helpers');
var projectHelpers = require('../helpers/project');
var OverviewPage = require('../page-objects/overview').OverviewPage;
var CreateProjectPage = require('../page-objects/createProject').CreateProjectPage;
var DeploymentsPage = require('../page-objects/deployments').DeploymentsPage;
var ServicesPage = require('../page-objects/services').ServicesPage;
var RoutesPage = require('../page-objects/routes').RoutesPage;
var nodeMongoTemplate = require('../fixtures/nodejs-mongodb');
//var logger = require('../helpers/logger');
// TODO: use this to alter whitelist in the tests to support the create from url flow
// var env = require('../helpers/env');

describe('User adds a template to a project', function() {

beforeEach(function() {
h.commonSetup();
h.login();
projectHelpers.deleteAllProjects();
Copy link
Member

Choose a reason for hiding this comment

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

I'm unclear why we're deleting all projects before every test. Will this delete everything I've created if I run the tests in my development environment?

It seems like the test that creates the project should delete it on tear down.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It should, but if a test fails protractor dies. It doesn't cleanup (and delete the project). So this is needed to ensure you start clean slate every time, otherwise you have to manually login as e2e-user and delete them by hand.

Copy link
Member

Choose a reason for hiding this comment

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

OK, so it only deletes e2e-user projects? I'd add a comment explaining.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do.

Copy link
Member

Choose a reason for hiding this comment

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

dont forget to add the comment here like @spadgett requested

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it, I'll add the comment in the projectHelpers file above deleteAllProjects

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, actually I already did there:

// All projects visible to the current user.
// This function will click the 'delete' on every project that appears on the project list page.
// Be careful about using this function if your test gives the e2e-user access
// to internal projects such as openshift, or openshift-infra

});

afterEach(function() {
h.commonTeardown();
});

describe('after creating a new project', function() {
describe('using the "Import YAML/JSON" tab', function() {
it('should process and create the objects in the template', function() {
var project = projectHelpers.projectDetails();
var createProjectPage = new CreateProjectPage(project);
createProjectPage.visit();
createProjectPage.createProject();
var overviewPage = new OverviewPage(project);
overviewPage.visit();
var catalogPage = overviewPage.clickAddToProject(); // implicit redirect to catalog page
catalogPage
.processTemplate(JSON.stringify(nodeMongoTemplate))
.then(function(createFromTemplatePage) {
createFromTemplatePage.clickCreate(); // implicit redirect to overview page
// verify we have the 2 deployments in the template
var deploymentsPage = new DeploymentsPage(project);
deploymentsPage.visit();
expect(element(by.cssContainingText('td', 'mongodb')).isPresent()).toBe(true);
expect(element(by.cssContainingText('td', 'nodejs-mongodb-example')).isPresent()).toBe(true);
// verify we have the two services in the template
var servicesPage = new ServicesPage(project);
servicesPage.visit();
expect(element(by.cssContainingText('td', 'mongodb')).isPresent()).toBe(true);
expect(element(by.cssContainingText('td', 'nodejs-mongodb-example')).isPresent()).toBe(true);
// verify we have one route for the mongo app
var routesPage = new RoutesPage(project);
routesPage.visit();
expect(element(by.cssContainingText('td', 'nodejs-mongodb-example')).isPresent()).toBe(true);
});
});

xit('should save the template in the project catalog', function() {
// TODO: same flow as the above test, but use:
// catalogPage.saveTemplate(tpl)
// & assert that the template was added to the catalog in this project
});
});
});
});
Loading