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