1
1
'use strict' ;
2
2
3
- var h = require ( '../helpers.js' ) ;
4
- var _ = require ( 'lodash' ) ;
5
- var inputs = require ( '../helpers/inputs' ) ;
6
- var Page = require ( './page' ) . Page ;
7
- //var logger = require('../helpers/logger');
3
+ const h = require ( '../helpers.js' ) ;
4
+ const inputs = require ( '../helpers/inputs' ) ;
5
+ const Page = require ( './page' ) . Page ;
8
6
9
- var AddTemplateModal = function ( project ) {
7
+ let AddTemplateModal = function ( project ) {
10
8
this . project = project ;
11
9
this . modal = element ( by . css ( '.modal-dialog' ) ) ;
12
10
this . checkboxes = this . modal . all ( by . css ( 'input[type="checkbox"]' ) ) ;
@@ -33,62 +31,59 @@ var AddTemplateModal = function(project) {
33
31
} ;
34
32
} ;
35
33
36
- var CatalogPage = function ( project ) {
37
- this . project = project ;
38
- } ;
39
-
40
- _ . extend ( CatalogPage . prototype , Page . prototype , {
41
- getUrl : function ( ) {
42
- // ?tab=tab=fromFile, ?tab=fromCatalog, ?tab=deployImage
34
+ class CatalogPage extends Page {
35
+ constructor ( project , menu ) {
36
+ super ( project , menu ) ;
37
+ }
38
+ getUrl ( ) {
39
+ // TODO: ?tab=tab=fromFile, ?tab=fromCatalog, ?tab=deployImage
43
40
return 'project/' + this . project . name + '/create' ;
44
- } ,
45
- // TODO: push this up into Page, include a way to pass tab names to the constructor &
46
- // auto generate clickTab<name>() functions?
47
- _findTabs : function ( ) {
48
- var tabs = element ( by . css ( '.nav-tabs' ) ) ;
41
+ }
42
+ _findTabs ( ) {
43
+ let tabs = element ( by . css ( '.nav-tabs' ) ) ;
49
44
h . waitForElem ( tabs ) ;
50
45
return tabs ;
51
- } ,
52
- clickBrowseCatalog : function ( ) {
46
+ }
47
+ clickBrowseCatalog ( ) {
53
48
return this . _findTabs ( )
54
49
. element ( by . cssContainingText ( 'a' , 'Browse Catalog' ) )
55
50
. click ( ) ;
56
- } ,
57
- clickDeployImage : function ( ) {
51
+ }
52
+ clickDeployImage ( ) {
58
53
return this . _findTabs ( )
59
54
. element ( by . cssContainingText ( 'a' , 'Deploy Image' ) )
60
55
. click ( ) ;
61
- } ,
62
- clickImport : function ( ) {
56
+ }
57
+ clickImport ( ) {
63
58
return this . _findTabs ( )
64
59
. element ( by . cssContainingText ( 'a' , 'Import YAML / JSON' ) )
65
60
. click ( ) ;
66
- } ,
67
- setImportValue : function ( str ) {
68
- return browser . executeScript ( function ( value ) {
61
+ }
62
+ setImportValue ( str ) {
63
+ return browser . executeScript ( ( value ) => {
69
64
window . ace . edit ( 'add-component-editor' ) . setValue ( value ) ;
70
65
} , str ) ;
71
- } ,
72
- getImportValue : function ( ) {
73
- return browser . executeScript ( function ( ) {
66
+ }
67
+ getImportValue ( ) {
68
+ return browser . executeScript ( ( ) => {
74
69
return window . ace . edit ( 'add-component-editor' ) . getValue ( ) ;
75
70
} ) ;
76
- } ,
77
- submitImport : function ( ) {
71
+ }
72
+ submitImport ( ) {
78
73
element ( by . cssContainingText ( '.btn-primary' , 'Create' ) ) . click ( ) ;
79
- return browser . sleep ( 500 ) . then ( function ( ) {
74
+ return browser . sleep ( 500 ) . then ( ( ) => {
80
75
return new AddTemplateModal ( this . project ) ;
81
- } . bind ( this ) ) ;
82
- } ,
83
- processTemplate : function ( templateStr ) {
76
+ } ) ;
77
+ }
78
+ processTemplate ( templateStr ) {
84
79
this . clickImport ( ) ;
85
- return this . setImportValue ( templateStr ) . then ( function ( ) {
86
- return this . submitImport ( ) . then ( function ( addTemplateModal ) {
80
+ return this . setImportValue ( templateStr ) . then ( ( ) => {
81
+ return this . submitImport ( ) . then ( ( addTemplateModal ) => {
87
82
// implicit nav therefore returns new CreateFromTemplatePage()
88
83
return addTemplateModal . process ( ) ;
89
84
} ) ;
90
- } . bind ( this ) ) ;
85
+ } ) ;
91
86
}
92
- } ) ;
87
+ }
93
88
94
89
exports . CatalogPage = CatalogPage ;
0 commit comments