|
| 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