-
Notifications
You must be signed in to change notification settings - Fork 231
/
Copy pathuser_adds_template_to_project.spec.js
80 lines (74 loc) · 3.83 KB
/
user_adds_template_to_project.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
'use strict';
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');
describe('User adds a template to a project', function() {
beforeEach(function() {
h.commonSetup();
h.login();
projectHelpers.deleteAllProjects();
});
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); // TODO: use fixture
expect(element(by.cssContainingText('td', 'nodejs-mongodb-example')).isPresent()).toBe(true); // TODO: use fixture
// 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); // TODO: use fixture
expect(element(by.cssContainingText('td', 'nodejs-mongodb-example')).isPresent()).toBe(true); // TODO: use fixture
// 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); // TODO: use fixture
});
});
it('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
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
.saveTemplate(JSON.stringify(nodeMongoTemplate))
.then((overview2) => {
var cat2 = overview2.clickAddToProject(); // implicit redirect to catalog page
// once the template processes, we just have to return
// to the catalog and verify the tile exists
cat2.visit();
cat2.clickCategory('JavaScript'); // TODO: pass in the tile name from the template fixture
cat2.findTileBy('Node.js + MongoDB (Ephemeral)', project.name); // TODO: pass in...
expect(element).toBeTruthy();
});
});
});
});
});