Skip to content

Commit 05f1fe9

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 sq
1 parent 5ca208d commit 05f1fe9

24 files changed

+1082
-52
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,66 @@
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 ServicesPage = require('../page-objects/services').ServicesPage;
10+
var RoutesPage = require('../page-objects/routes').RoutesPage;
11+
var nodeMongoTemplate = require('../fixtures/nodejs-mongodb');
12+
//var logger = require('../helpers/logger');
13+
// TODO: use this to alter whitelist in the tests to support the create from url flow
14+
// var env = require('../helpers/env');
15+
16+
describe('User adds a template to a project', function() {
17+
18+
beforeEach(function() {
19+
h.commonSetup();
20+
h.login();
21+
projectHelpers.deleteAllProjects();
22+
});
23+
24+
afterEach(function() {
25+
h.commonTeardown();
26+
});
27+
28+
describe('after creating a new project', function() {
29+
describe('using the "Import YAML/JSON" tab', function() {
30+
it('should process and create the objects in the template', function() {
31+
var project = projectHelpers.projectDetails();
32+
var createProjectPage = new CreateProjectPage(project);
33+
createProjectPage.visit();
34+
createProjectPage.createProject();
35+
var overviewPage = new OverviewPage(project);
36+
overviewPage.visit();
37+
var catalogPage = overviewPage.clickAddToProject(); // implicit redirect to catalog page
38+
catalogPage
39+
.processTemplate(JSON.stringify(nodeMongoTemplate))
40+
.then(function(createFromTemplatePage) {
41+
createFromTemplatePage.clickCreate(); // implicit redirect to overview page
42+
// verify we have the 2 deployments in the template
43+
var deploymentsPage = new DeploymentsPage(project);
44+
deploymentsPage.visit();
45+
expect(element(by.cssContainingText('td', 'mongodb')).isPresent()).toBe(true);
46+
expect(element(by.cssContainingText('td', 'nodejs-mongodb-example')).isPresent()).toBe(true);
47+
// verify we have the two services in the template
48+
var servicesPage = new ServicesPage(project);
49+
servicesPage.visit();
50+
expect(element(by.cssContainingText('td', 'mongodb')).isPresent()).toBe(true);
51+
expect(element(by.cssContainingText('td', 'nodejs-mongodb-example')).isPresent()).toBe(true);
52+
// verify we have one route for the mongo app
53+
var routesPage = new RoutesPage(project);
54+
routesPage.visit();
55+
expect(element(by.cssContainingText('td', 'nodejs-mongodb-example')).isPresent()).toBe(true);
56+
});
57+
});
58+
59+
xit('should save the template in the project catalog', function() {
60+
// TODO: same flow as the above test, but use:
61+
// catalogPage.saveTemplate(tpl)
62+
// & assert that the template was added to the catalog in this project
63+
});
64+
});
65+
});
66+
});

0 commit comments

Comments
 (0)