diff --git a/test/integration/page-objects/catalog.js b/test/integration/page-objects/catalog.js index d97528f291..a63cd3bd2d 100644 --- a/test/integration/page-objects/catalog.js +++ b/test/integration/page-objects/catalog.js @@ -1,38 +1,8 @@ 'use strict'; const h = require('../helpers.js'); -const inputs = require('../helpers/inputs'); const Page = require('./page').Page; - -let AddTemplateModal = function(project) { - this.project = project; - this.modal = element(by.css('.modal-dialog')); - this.checkboxes = this.modal.all(by.css('input[type="checkbox"]')); - this.processBox = this.checkboxes.get(0); - this.saveBox = this.checkboxes.get(1); - this.continue = this.modal.element(by.cssContainingText('.btn-primary', 'Continue')); - this.cancel = this.modal.element(by.cssContainingText('.btn-default', 'Cancel')); - this.process = function() { - inputs.check(this.processBox); - inputs.uncheck(this.saveBox); - this.continue.click(); - return browser.sleep(500).then(function() { - // lazy require to avoid potential of circular dependencies - var CreateFromTemplatePage = require('./createFromTemplate').CreateFromTemplatePage; - return new CreateFromTemplatePage(this.project); - }.bind(this)); - }; - this.save = function() { - inputs.uncheck(this.processBox); - inputs.check(this.saveBox); - this.continue.click(); - return browser.sleep(500).then(() => { - // lazy require - var OverviewPage = require('./overview').OverviewPage; - return new OverviewPage(this.project); // automatic redirect - }); - }; -}; +const AddTemplateModal = require('./modals/addTemplateModal').AddTemplateModal; class CatalogPage extends Page { constructor(project, menu) { diff --git a/test/integration/page-objects/modals/addTemplateModal.js b/test/integration/page-objects/modals/addTemplateModal.js new file mode 100644 index 0000000000..c986672e71 --- /dev/null +++ b/test/integration/page-objects/modals/addTemplateModal.js @@ -0,0 +1,37 @@ +'use strict'; + +const inputs = require('../../helpers/inputs'); + +class AddTemplateModal { + constructor(project) { + this.project = project; + this.modal = element(by.css('.modal-dialog')); + this.checkboxes = this.modal.all(by.css('input[type="checkbox"]')); + this.processBox = this.checkboxes.get(0); + this.saveBox = this.checkboxes.get(1); + this.continue = this.modal.element(by.cssContainingText('.btn-primary', 'Continue')); + this.cancel = this.modal.element(by.cssContainingText('.btn-default', 'Cancel')); + } + process() { + inputs.check(this.processBox); + inputs.uncheck(this.saveBox); + this.continue.click(); + return browser.sleep(500).then(() => { + // lazy require to avoid potential of circular dependencies + let CreateFromTemplatePage = require('../createFromTemplate').CreateFromTemplatePage; + return new CreateFromTemplatePage(this.project); + }); + } + save() { + inputs.uncheck(this.processBox); + inputs.check(this.saveBox); + this.continue.click(); + return browser.sleep(500).then(() => { + // lazy require + let OverviewPage = require('../overview').OverviewPage; + return new OverviewPage(this.project); // automatic redirect + }); + } +} + +exports.AddTemplateModal = AddTemplateModal;