Skip to content

Commit fe3e19f

Browse files
e2e tests for Add To Project flow & support of future run-on-openshift tests
- Add h.waitForElem() and adjust h.waitForPresence() to allow for a callback fn - Add helpers/scroll - Add helpers/strings - Add README for pageobjects - Add base 'Page' PageObject for other pages to extend - Add createFromTemplate PageObject - Add deployments PageObject - Update helpers/matchers, set hLevel in expectHeading(), add expectPartialHeading - Add browser.sleep() to deleteAllProjects to ensure each project is removed - Move all e2e test flows under test/integration/features/ and name them based on user actions - Add xit to jshintrc - Cleanup user_adds_template_to_project.spec - Add numerous other helpers and page objects
1 parent 171a067 commit fe3e19f

24 files changed

+1073
-39
lines changed

test/.jshintrc

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"undef": true,
2020
"unused": true,
2121
"globals": {
22+
"ace": false,
2223
"after": false,
2324
"afterEach": false,
2425
"afterAll": false,
@@ -32,6 +33,7 @@
3233
"expect": false,
3334
"inject": false,
3435
"it": false,
36+
"xit": false,
3537
"jasmine": false,
3638
"spyOn": false,
3739
"hawtioPluginLoader": false,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
'use strict';
2+
3+
require('jasmine-beforeall');
4+
var h = require('../helpers');
5+
var projectHelpers = require('../helpers/project');
6+
var OverviewPage = require('../page-objects/overview').OverviewPage;
7+
var CreateProjectPage = require('../page-objects/createProject').CreateProjectPage;
8+
var DeploymentsPage = require('../page-objects/deployments').DeploymentsPage;
9+
var nodeMongoTemplate = require('../fixtures/nodejs-mongodb');
10+
//var logger = require('../helpers/logger');
11+
// TODO: use this to alter whitelist in the tests to support the create from url flow
12+
// var env = require('../helpers/env');
13+
14+
describe('User adds a template to a project', function() {
15+
16+
beforeEach(function() {
17+
h.commonSetup();
18+
h.login();
19+
projectHelpers.deleteAllProjects();
20+
});
21+
22+
afterEach(function() {
23+
h.commonTeardown();
24+
});
25+
26+
describe('after creating a new project', function() {
27+
describe('using the "Import YAML/JSON" tab', function() {
28+
it('should process and create the objects in the template', function() {
29+
var project = projectHelpers.projectDetails();
30+
var createProjectPage = new CreateProjectPage(project);
31+
createProjectPage.visit();
32+
createProjectPage.createProject();
33+
var overviewPage = new OverviewPage(project);
34+
overviewPage.visit();
35+
var catalogPage = overviewPage.clickAddToProject();
36+
catalogPage
37+
.processTemplate(JSON.stringify(nodeMongoTemplate))
38+
.then(function(createFromTemplatePage) {
39+
createFromTemplatePage.clickCreate(); // implicit redirect to overview page
40+
var deploymentsPage = new DeploymentsPage(project);
41+
deploymentsPage.visit();
42+
var tableRows = element(by.repeater('replicationController in replicationControllersForDC'));
43+
h.waitForElem(tableRows);
44+
// TODO:
45+
// this template has 7 objects that should be verified:
46+
// - Service (load balancer)
47+
// - ImageStream (nodejs-mongodb-example :latest)
48+
// - Route (to nodejs app)
49+
// - Service (database)
50+
// - DeploymentConfig (mongodb)
51+
// - DeploymentConfig (nodejs app)
52+
// We should probably be ensuring that all of these things were created,
53+
// ideally with a helper of some kind that can take the JSON template,
54+
// read it and then navigate through the app checking for these objects
55+
// on the appropriate pages.
56+
expect(element(by.cssContainingText('td', 'mongodb')).isPresent()).toBe(true);
57+
expect(element(by.cssContainingText('td', 'nodejs-mongodb-example')).isPresent()).toBe(true);
58+
});
59+
});
60+
61+
xit('should save the template in the project catalog', function() {
62+
// TODO: same flow as the above test, but use:
63+
// catalogPage.saveTemplate(tpl)
64+
// & assert that the template was added to the catalog in this project
65+
});
66+
});
67+
});
68+
});

0 commit comments

Comments
 (0)