generator-easy-ui5 2.4.6 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/README.md +66 -168
- package/generators/app/index.js +392 -171
- package/generators/app/postinstall.js +121 -0
- package/package.json +23 -18
- package/generators/additionalmodules/index.js +0 -222
- package/generators/additionalmodules/templates/approuter/package.json +0 -13
- package/generators/additionalmodules/templates/deployer/readme.md +0 -3
- package/generators/additionalmodules/templates/xs-security.json +0 -20
- package/generators/app/templates/_.editorconfig +0 -8
- package/generators/app/templates/_.eslintignore +0 -4
- package/generators/app/templates/_.eslintrc +0 -48
- package/generators/app/templates/_.gitignore +0 -11
- package/generators/app/templates/karma-ci.conf.js +0 -21
- package/generators/app/templates/karma.conf.js +0 -17
- package/generators/app/templates/readme.md +0 -6
- package/generators/newcomponent/index.js +0 -82
- package/generators/newcontrol/index.js +0 -81
- package/generators/newcontrol/templates/webapp/control/template.js +0 -23
- package/generators/newmodel/index.js +0 -142
- package/generators/newopa5journey/index.js +0 -99
- package/generators/newopa5journey/templates/test/integration/$journey.js +0 -23
- package/generators/newopa5po/index.js +0 -107
- package/generators/newopa5po/templates/test/integration/pages/$poFile.js +0 -43
- package/generators/newuiveri5po/index.js +0 -84
- package/generators/newuiveri5po/templates/pages/$poFile.js +0 -20
- package/generators/newuiveri5spec/index.js +0 -51
- package/generators/newuiveri5spec/templates/$specName.spec.js +0 -22
- package/generators/newview/index.js +0 -156
- package/generators/newview/templates/webapp/controller/$ViewName.controller.js +0 -7
- package/generators/newview/templates/webapp/view/$ViewName.view.$ViewEnding +0 -51
- package/generators/newwebapp/index.js +0 -239
- package/generators/newwebapp/templates/uimodule/ui5.yaml +0 -73
- package/generators/newwebapp/templates/uimodule/webapp/Component.js +0 -30
- package/generators/newwebapp/templates/uimodule/webapp/controller/BaseController.js +0 -70
- package/generators/newwebapp/templates/uimodule/webapp/css/style.css +0 -1
- package/generators/newwebapp/templates/uimodule/webapp/flpSandbox.html +0 -66
- package/generators/newwebapp/templates/uimodule/webapp/i18n/i18n.properties +0 -3
- package/generators/newwebapp/templates/uimodule/webapp/i18n/i18n_en.properties +0 -3
- package/generators/newwebapp/templates/uimodule/webapp/index.html +0 -29
- package/generators/newwebapp/templates/uimodule/webapp/manifest.json +0 -92
- package/generators/newwebapp/templates/uimodule/webapp/model/formatter.js +0 -4
- package/generators/newwebapp/templates/uimodule/webapp/model/models.js +0 -14
- package/generators/newwebapp/templates/uimodule/webapp/resources/img/favicon.ico +0 -0
- package/generators/newwebapp/templates/uimodule/webapp/xs-app.json +0 -11
- package/generators/opa5/index.js +0 -114
- package/generators/opa5/templates/test/integration/AllJourneys.js +0 -13
- package/generators/opa5/templates/test/integration/arrangements/Startup.js +0 -19
- package/generators/opa5/templates/test/integration/opaTests.qunit.html +0 -32
- package/generators/opa5/templates/test/integration/opaTests.qunit.js +0 -13
- package/generators/opa5/templates/test/testsuite.qunit.html +0 -10
- package/generators/opa5/templates/test/testsuite.qunit.js +0 -10
- package/generators/uiveri5/index.js +0 -144
- package/generators/uiveri5/templates/.gitignore +0 -2
- package/generators/uiveri5/templates/README.md +0 -11
- package/generators/uiveri5/templates/conf.js +0 -16
- package/generators/wdi5/index.js +0 -96
- package/generators/wdi5/templates/.gitignore +0 -1
- package/generators/wdi5/templates/README-wdi5.md +0 -39
- package/generators/wdi5/templates/basic.test.js +0 -17
- package/generators/wdi5/templates/wdio-wdi5.conf.js +0 -282
- package/helpers/fileaccess.js +0 -90
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
const Generator = require("yeoman-generator");
|
|
2
|
-
|
|
3
|
-
module.exports = class extends Generator {
|
|
4
|
-
|
|
5
|
-
prompting() {
|
|
6
|
-
const modules = this.config.get("uimodules");
|
|
7
|
-
var aPrompt = [{
|
|
8
|
-
type: "list",
|
|
9
|
-
name: "modulename",
|
|
10
|
-
message: "To which module do you want to add a control?",
|
|
11
|
-
choices: modules || [],
|
|
12
|
-
when: modules && modules.length > 1
|
|
13
|
-
}, {
|
|
14
|
-
type: "input",
|
|
15
|
-
name: "controlname",
|
|
16
|
-
message: "What is the name of the new control?",
|
|
17
|
-
validate: (s) => {
|
|
18
|
-
if (/^\d*[a-zA-Z][a-zA-Z0-9]*$/g.test(s)) {
|
|
19
|
-
return true;
|
|
20
|
-
}
|
|
21
|
-
return "Please use alpha numeric characters only for the control name.";
|
|
22
|
-
}
|
|
23
|
-
}, {
|
|
24
|
-
type: "input",
|
|
25
|
-
name: "supercontrol",
|
|
26
|
-
message: "Which control would you like to extend?",
|
|
27
|
-
validate: (s) => {
|
|
28
|
-
if (/^[a-zA-Z0-9\.]*$/g.test(s)) {
|
|
29
|
-
return true;
|
|
30
|
-
}
|
|
31
|
-
return "Please use alpha numeric characters and dots only to specifiy the super control.";
|
|
32
|
-
},
|
|
33
|
-
default: "sap.ui.core.Control"
|
|
34
|
-
}];
|
|
35
|
-
if (!this.config.getAll().viewtype) {
|
|
36
|
-
aPrompt = aPrompt.concat([{
|
|
37
|
-
type: "input",
|
|
38
|
-
name: "projectname",
|
|
39
|
-
message: "Seems like this project has not been generated with Easy-UI5. Please enter the name your project.",
|
|
40
|
-
validate: (s) => {
|
|
41
|
-
if (/^\d*[a-zA-Z][a-zA-Z0-9]*$/g.test(s)) {
|
|
42
|
-
return true;
|
|
43
|
-
}
|
|
44
|
-
return "Please use alpha numeric characters only for the project name.";
|
|
45
|
-
},
|
|
46
|
-
default: "myUI5App"
|
|
47
|
-
}, {
|
|
48
|
-
type: "input",
|
|
49
|
-
name: "namespace",
|
|
50
|
-
message: "Please enter the namespace you use currently",
|
|
51
|
-
validate: (s) => {
|
|
52
|
-
if (/^[a-zA-Z0-9_\.]*$/g.test(s)) {
|
|
53
|
-
return true;
|
|
54
|
-
}
|
|
55
|
-
return "Please use alpha numeric characters and dots only for the namespace.";
|
|
56
|
-
},
|
|
57
|
-
default: "com.myorg"
|
|
58
|
-
}]);
|
|
59
|
-
}
|
|
60
|
-
return this.prompt(aPrompt).then((answers) => {
|
|
61
|
-
this.options.oneTimeConfig = this.config.getAll();
|
|
62
|
-
this.options.oneTimeConfig.controlname = answers.controlname;
|
|
63
|
-
this.options.oneTimeConfig.supercontrol = answers.supercontrol;
|
|
64
|
-
this.options.oneTimeConfig.modulename = answers.modulename || modules[0];
|
|
65
|
-
|
|
66
|
-
this.options.oneTimeConfig.appId = this.options.oneTimeConfig.namespace + "." + (this.options.modulename === "uimodule" ? this.options.oneTimeConfig.projectname : this.options.modulename);
|
|
67
|
-
if (answers.projectname) {
|
|
68
|
-
this.options.oneTimeConfig.projectname = answers.projectname;
|
|
69
|
-
this.options.oneTimeConfig.namespace = answers.namespace;
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
writing() {
|
|
75
|
-
const sOrigin = this.templatePath("webapp/control/template.js");
|
|
76
|
-
const sTarget = `${this.options.oneTimeConfig.modulename}/webapp/control/${this.options.oneTimeConfig.controlname}.js`;
|
|
77
|
-
|
|
78
|
-
this.fs.copyTpl(sOrigin, sTarget, this.options.oneTimeConfig);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
sap.ui.define(
|
|
2
|
-
["<%= supercontrol.replace(/\./g, '/') %>"],
|
|
3
|
-
function(Control) {
|
|
4
|
-
return Control.extend("<%=appId%>.control.<%=controlname%>",{
|
|
5
|
-
metadata: {
|
|
6
|
-
properties: {},
|
|
7
|
-
aggregations: {},
|
|
8
|
-
},
|
|
9
|
-
|
|
10
|
-
renderer: {},
|
|
11
|
-
|
|
12
|
-
<% if (supercontrol !== 'sap.ui.core.Control') { %>
|
|
13
|
-
onAfterRendering: function() {
|
|
14
|
-
if(<%=supercontrol%>.prototype.onAfterRendering) {
|
|
15
|
-
<%=supercontrol%>.prototype.onAfterRendering.apply(this,arguments); //run the super class's method first
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
alert('<%=controlname%> has been rendered!');
|
|
19
|
-
},
|
|
20
|
-
<% } %>
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
);
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
const Generator = require("yeoman-generator"),
|
|
2
|
-
fileaccess = require("../../helpers/fileaccess");
|
|
3
|
-
|
|
4
|
-
module.exports = class extends Generator {
|
|
5
|
-
|
|
6
|
-
prompting() {
|
|
7
|
-
const modules = this.config.get("uimodules");
|
|
8
|
-
var aPrompt = [{
|
|
9
|
-
type: "list",
|
|
10
|
-
name: "modulename",
|
|
11
|
-
message: "To which module do you want to add a model?",
|
|
12
|
-
choices: modules || [],
|
|
13
|
-
when: modules && modules.length > 1
|
|
14
|
-
}, {
|
|
15
|
-
type: "input",
|
|
16
|
-
name: "modelName",
|
|
17
|
-
message: "What is the name of your model, press enter if it is the default model?",
|
|
18
|
-
validate: (s) => {
|
|
19
|
-
if (/^[a-zA-Z0-9_-]*$/g.test(s)) {
|
|
20
|
-
return true;
|
|
21
|
-
}
|
|
22
|
-
return "Please use alpha numeric characters only for the view name.";
|
|
23
|
-
},
|
|
24
|
-
default: ""
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
type: "list",
|
|
28
|
-
name: "modelType",
|
|
29
|
-
message: "Which type of model do you want to add?",
|
|
30
|
-
choices: ["OData v2", "OData v4", "JSON"],
|
|
31
|
-
default: "OData v4"
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
type: "list",
|
|
35
|
-
name: "bindingMode",
|
|
36
|
-
message: "Which binding mode do you want to use?",
|
|
37
|
-
choices: ["TwoWay", "OneWay"],
|
|
38
|
-
default: "TwoWay"
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
when: function (props) {
|
|
42
|
-
return props.modelType.includes("OData");
|
|
43
|
-
},
|
|
44
|
-
type: "input",
|
|
45
|
-
name: "url",
|
|
46
|
-
message: "What is the data source url?"
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
when: function (props) {
|
|
50
|
-
return props.modelType === "OData v2";
|
|
51
|
-
},
|
|
52
|
-
type: "list",
|
|
53
|
-
name: "countMode",
|
|
54
|
-
message: "Which count mode do you want to use?",
|
|
55
|
-
choices: ["Inline", "Request"],
|
|
56
|
-
default: "Inline"
|
|
57
|
-
}];
|
|
58
|
-
|
|
59
|
-
return this.prompt(aPrompt).then((answers) => {
|
|
60
|
-
this.options.oneTimeConfig = this.config.getAll();
|
|
61
|
-
this.options.oneTimeConfig.modelName = answers.modelName;
|
|
62
|
-
this.options.oneTimeConfig.modelType = answers.modelType;
|
|
63
|
-
this.options.oneTimeConfig.bindingMode = answers.bindingMode;
|
|
64
|
-
this.options.oneTimeConfig.modulename = answers.modulename || modules[0];
|
|
65
|
-
|
|
66
|
-
if (answers.modelType.includes("OData")) {
|
|
67
|
-
this.options.oneTimeConfig.url = answers.url;
|
|
68
|
-
if (answers.modelType === "OData v2") {
|
|
69
|
-
this.options.oneTimeConfig.countMode = answers.countMode;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
async writing() {
|
|
76
|
-
|
|
77
|
-
let override;
|
|
78
|
-
|
|
79
|
-
if (this.options.oneTimeConfig.modelType.includes("OData")) {
|
|
80
|
-
let sDataSource = this.options.oneTimeConfig.url.replace("/sap/opu/odata/sap/", "");
|
|
81
|
-
sDataSource = sDataSource.replace(/\//ig, "");
|
|
82
|
-
|
|
83
|
-
const sourceSettings = this.options.oneTimeConfig.modelType === "OData v2" ? {
|
|
84
|
-
localUri: "localService/" + this.options.oneTimeConfig.url + "/metadata.xml"
|
|
85
|
-
} : {
|
|
86
|
-
localUri: "localService/" + this.options.oneTimeConfig.url + "/metadata.xml",
|
|
87
|
-
odataVersion: "4.0"
|
|
88
|
-
};
|
|
89
|
-
const modelType = this.options.oneTimeConfig.modelType === "OData v2" ? "sap.ui.model.odata.v2.ODataModel" : "sap.ui.model.odata.v4.ODataModel";
|
|
90
|
-
const modelSettings = this.options.oneTimeConfig.modelType === "OData v2" ? {
|
|
91
|
-
defaultOperationMode: "Server",
|
|
92
|
-
defaultBindingMode: this.options.oneTimeConfig.bindingMode,
|
|
93
|
-
defaultCountMode: this.options.oneTimeConfig.countMode,
|
|
94
|
-
preload: true
|
|
95
|
-
} : {
|
|
96
|
-
synchronizationMode: "None",
|
|
97
|
-
operationMode: "Server",
|
|
98
|
-
autoExpandSelect: true,
|
|
99
|
-
earlyRequests: true,
|
|
100
|
-
groupProperties: {
|
|
101
|
-
default: {
|
|
102
|
-
submit: "Auto"
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
override = {
|
|
108
|
-
["sap.app"]: {
|
|
109
|
-
dataSources: {
|
|
110
|
-
[sDataSource]: {
|
|
111
|
-
uri: this.options.oneTimeConfig.url,
|
|
112
|
-
type: "OData",
|
|
113
|
-
settings: sourceSettings
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
["sap.ui5"]: {
|
|
118
|
-
models: {
|
|
119
|
-
[this.options.oneTimeConfig.modelName]: {
|
|
120
|
-
type: modelType,
|
|
121
|
-
settings: modelSettings,
|
|
122
|
-
dataSource: sDataSource
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
} else {
|
|
128
|
-
override = {
|
|
129
|
-
["sap.ui5"]: {
|
|
130
|
-
models: {
|
|
131
|
-
[this.options.oneTimeConfig.modelName]: {
|
|
132
|
-
"type": "sap.ui.model.json.JSONModel",
|
|
133
|
-
"settings": {}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
await fileaccess.manipulateJSON.call(this, "/" + this.options.oneTimeConfig.modulename + "/webapp/manifest.json", override);
|
|
141
|
-
}
|
|
142
|
-
};
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
const Generator = require("yeoman-generator");
|
|
2
|
-
const validFilename = require("valid-filename");
|
|
3
|
-
const fs = require("fs");
|
|
4
|
-
|
|
5
|
-
module.exports = class extends Generator {
|
|
6
|
-
|
|
7
|
-
prompting() {
|
|
8
|
-
let aPrompt = [];
|
|
9
|
-
this.options.oneTimeConfig = this.config.getAll();
|
|
10
|
-
|
|
11
|
-
if (this.options.isSubgeneratorCall) {
|
|
12
|
-
this.options.oneTimeConfig.projectname = this.options.projectname;
|
|
13
|
-
this.options.oneTimeConfig.namespaceInput = this.options.namespaceInput;
|
|
14
|
-
this.options.oneTimeConfig.modulename = this.options.modulename;
|
|
15
|
-
} else {
|
|
16
|
-
if (!this.config.getAll().viewtype) {
|
|
17
|
-
aPrompt = aPrompt.concat([{
|
|
18
|
-
type: "input",
|
|
19
|
-
name: "projectname",
|
|
20
|
-
message: "Seems like this project has not been generated with Easy-UI5. Please enter the name of your project.",
|
|
21
|
-
validate: (s) => {
|
|
22
|
-
if (/^\d*[a-zA-Z][a-zA-Z0-9]*$/g.test(s)) {
|
|
23
|
-
return true;
|
|
24
|
-
}
|
|
25
|
-
return "Please use alpha numeric characters only for the project name.";
|
|
26
|
-
},
|
|
27
|
-
default: "myUI5App"
|
|
28
|
-
}, {
|
|
29
|
-
type: "input",
|
|
30
|
-
name: "namespaceInput",
|
|
31
|
-
message: "Please enter the namespace you use currently",
|
|
32
|
-
validate: (s) => {
|
|
33
|
-
if (/^[a-zA-Z0-9_\.]*$/g.test(s)) {
|
|
34
|
-
return true;
|
|
35
|
-
}
|
|
36
|
-
return "Please use alpha numeric characters and dots only for the namespace.";
|
|
37
|
-
},
|
|
38
|
-
default: "com.myorg"
|
|
39
|
-
}]);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const modules = this.config.get("uimodules") || [];
|
|
43
|
-
if (modules.length) {
|
|
44
|
-
aPrompt.push({
|
|
45
|
-
type: "list",
|
|
46
|
-
name: "modulename",
|
|
47
|
-
message: "To which module do you want to add an OPA5 page object?",
|
|
48
|
-
choices: modules,
|
|
49
|
-
when: modules.length
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
aPrompt = aPrompt.concat([{
|
|
55
|
-
type: "input",
|
|
56
|
-
name: "journey",
|
|
57
|
-
message: "Journey name:",
|
|
58
|
-
default: "Master",
|
|
59
|
-
validate: validFilename
|
|
60
|
-
}]);
|
|
61
|
-
|
|
62
|
-
return this.prompt(aPrompt).then((answers) => {
|
|
63
|
-
for (var key in answers) {
|
|
64
|
-
this.options.oneTimeConfig[key] = answers[key];
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
this.options.oneTimeConfig.namespaceInput = this.options.oneTimeConfig.namespaceInput || this.options.oneTimeConfig.namespace;
|
|
68
|
-
this.options.oneTimeConfig.journey = this.options.oneTimeConfig.journey.charAt(0).toUpperCase() + this.options.oneTimeConfig.journey.substr(1);
|
|
69
|
-
|
|
70
|
-
const journeys = this.config.get("opa5Journeys") || [];
|
|
71
|
-
journeys.push(this.options.oneTimeConfig.journey);
|
|
72
|
-
this.config.set("opa5Journeys", journeys);
|
|
73
|
-
this.options.oneTimeConfig.opa5Journeys = journeys;
|
|
74
|
-
|
|
75
|
-
// set default value for opa5pos if empty
|
|
76
|
-
const pos = this.config.get("opa5pos") || [];
|
|
77
|
-
this.config.set("opa5pos", pos);
|
|
78
|
-
this.options.oneTimeConfig.opa5pos = pos;
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
async writing() {
|
|
83
|
-
const sModule = (this.options.oneTimeConfig.modulename ? this.options.oneTimeConfig.modulename + "/" : "") + "webapp/";
|
|
84
|
-
|
|
85
|
-
this.fs.copyTpl(
|
|
86
|
-
this.templatePath("test/integration/$journey.js"),
|
|
87
|
-
this.destinationPath(sModule + "test/integration/" + this.options.oneTimeConfig.journey + "Journey.js"),
|
|
88
|
-
this.options.oneTimeConfig
|
|
89
|
-
);
|
|
90
|
-
|
|
91
|
-
// add new journey to AllJourneys list
|
|
92
|
-
const allJourneysFile = this.destinationPath(sModule + "test/integration/AllJourneys.js");
|
|
93
|
-
if (fs.existsSync(allJourneysFile)) {
|
|
94
|
-
const content = fs.readFileSync(allJourneysFile, "utf8").replace(/sap.ui.define\(\[(.*)\s\]/gms,
|
|
95
|
-
`sap.ui.define([$1,\n "./${this.options.oneTimeConfig.journey}Journey"\n]`).replace(/\s,\s/, ",\n");
|
|
96
|
-
fs.writeFileSync(allJourneysFile, content);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
sap.ui.define([
|
|
2
|
-
"sap/ui/test/opaQunit",
|
|
3
|
-
// "./pages/<%= journey %>"<% opa5pos.forEach(function (po) { %>,
|
|
4
|
-
"./pages/<%= po %>"<% }) %>
|
|
5
|
-
], function (opaTest) {
|
|
6
|
-
"use strict";
|
|
7
|
-
|
|
8
|
-
opaTest("Should see the page", function (Given, When, Then) {
|
|
9
|
-
|
|
10
|
-
// Arrangements
|
|
11
|
-
Given.iStartMyApp();
|
|
12
|
-
|
|
13
|
-
// Actions
|
|
14
|
-
// When.onThe<%= journey %>Page.iPressTheButton();
|
|
15
|
-
|
|
16
|
-
// Assertions
|
|
17
|
-
Then.onThe<%= journey %>Page.iShouldSeeTheTitle();
|
|
18
|
-
|
|
19
|
-
// Cleanup
|
|
20
|
-
Then.iTeardownMyApp();
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
});
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
const Generator = require("yeoman-generator");
|
|
2
|
-
const validFilename = require("valid-filename");
|
|
3
|
-
const fs = require("fs");
|
|
4
|
-
|
|
5
|
-
module.exports = class extends Generator {
|
|
6
|
-
|
|
7
|
-
prompting() {
|
|
8
|
-
let aPrompt = [];
|
|
9
|
-
this.options.oneTimeConfig = this.config.getAll();
|
|
10
|
-
|
|
11
|
-
if (this.options.isSubgeneratorCall) {
|
|
12
|
-
this.options.oneTimeConfig.projectname = this.options.projectname;
|
|
13
|
-
this.options.oneTimeConfig.namespaceInput = this.options.namespaceInput;
|
|
14
|
-
this.options.oneTimeConfig.modulename = this.options.modulename;
|
|
15
|
-
} else {
|
|
16
|
-
if (!this.config.getAll().viewtype) {
|
|
17
|
-
aPrompt = aPrompt.concat([{
|
|
18
|
-
type: "input",
|
|
19
|
-
name: "projectname",
|
|
20
|
-
message: "Seems like this project has not been generated with Easy-UI5. Please enter the name of your project.",
|
|
21
|
-
validate: (s) => {
|
|
22
|
-
if (/^\d*[a-zA-Z][a-zA-Z0-9]*$/g.test(s)) {
|
|
23
|
-
return true;
|
|
24
|
-
}
|
|
25
|
-
return "Please use alpha numeric characters only for the project name.";
|
|
26
|
-
},
|
|
27
|
-
default: "myUI5App"
|
|
28
|
-
}, {
|
|
29
|
-
type: "input",
|
|
30
|
-
name: "namespaceInput",
|
|
31
|
-
message: "Please enter the namespace you use currently",
|
|
32
|
-
validate: (s) => {
|
|
33
|
-
if (/^[a-zA-Z0-9_\.]*$/g.test(s)) {
|
|
34
|
-
return true;
|
|
35
|
-
}
|
|
36
|
-
return "Please use alpha numeric characters and dots only for the namespace.";
|
|
37
|
-
},
|
|
38
|
-
default: "com.myorg"
|
|
39
|
-
}]);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const modules = this.config.get("uimodules") || [];
|
|
43
|
-
if (modules.length) {
|
|
44
|
-
aPrompt.push({
|
|
45
|
-
type: "list",
|
|
46
|
-
name: "modulename",
|
|
47
|
-
message: "To which module do you want to add an OPA5 page object?",
|
|
48
|
-
choices: modules,
|
|
49
|
-
when: modules.length
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
aPrompt = aPrompt.concat([{
|
|
55
|
-
type: "input",
|
|
56
|
-
name: "poName",
|
|
57
|
-
message: "Page object name:",
|
|
58
|
-
default: "Master",
|
|
59
|
-
validate: validFilename
|
|
60
|
-
}, {
|
|
61
|
-
type: "input",
|
|
62
|
-
name: "action",
|
|
63
|
-
message: "Add action with name (empty string to skip actions):"
|
|
64
|
-
}, {
|
|
65
|
-
type: "input",
|
|
66
|
-
name: "assertion",
|
|
67
|
-
message: "Add assertion with name (empty string to skip assertions):"
|
|
68
|
-
}]);
|
|
69
|
-
|
|
70
|
-
return this.prompt(aPrompt).then((answers) => {
|
|
71
|
-
for (var key in answers) {
|
|
72
|
-
this.options.oneTimeConfig[key] = answers[key];
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
var appName = !this.options.oneTimeConfig.modulename || this.options.oneTimeConfig.modulename === "uimodule" ? this.options.oneTimeConfig.projectname : this.options.oneTimeConfig.modulename;
|
|
76
|
-
this.options.oneTimeConfig.namespaceInput = this.options.oneTimeConfig.namespaceInput || this.options.oneTimeConfig.namespace;
|
|
77
|
-
this.options.oneTimeConfig.poName = this.options.oneTimeConfig.poName.charAt(0).toUpperCase() + this.options.oneTimeConfig.poName.substr(1);
|
|
78
|
-
this.options.oneTimeConfig.appId = this.options.oneTimeConfig.appId || this.options.oneTimeConfig.namespaceInput + "." + appName;
|
|
79
|
-
|
|
80
|
-
const pos = this.config.get("opa5pos") || [];
|
|
81
|
-
pos.push(this.options.oneTimeConfig.poName);
|
|
82
|
-
this.config.set("opa5pos", pos);
|
|
83
|
-
this.options.oneTimeConfig.opa5pos = pos;
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
async writing() {
|
|
88
|
-
const sModule = (this.options.oneTimeConfig.modulename ? this.options.oneTimeConfig.modulename + "/" : "") + "webapp/";
|
|
89
|
-
const journeys = this.config.get("opa5Journeys") || [];
|
|
90
|
-
|
|
91
|
-
this.fs.copyTpl(
|
|
92
|
-
this.templatePath("test/integration/pages/$poFile.js"),
|
|
93
|
-
this.destinationPath(sModule + "test/integration/pages/" + this.options.oneTimeConfig.poName + ".js"),
|
|
94
|
-
this.options.oneTimeConfig
|
|
95
|
-
);
|
|
96
|
-
|
|
97
|
-
// add new po to existing journeys
|
|
98
|
-
journeys.forEach((journey) => {
|
|
99
|
-
const journeyFile = this.destinationPath(sModule + "test/integration/" + journey + "Journey.js");
|
|
100
|
-
if (fs.existsSync(journeyFile)) {
|
|
101
|
-
const content = fs.readFileSync(journeyFile, "utf8").replace(/sap.ui.define\(\[(.*)\s\]/gms,
|
|
102
|
-
`sap.ui.define([$1,\n "./pages/${this.options.oneTimeConfig.poName}"\n]`).replace(/\s,\s/, ",\n");
|
|
103
|
-
fs.writeFileSync(journeyFile, content);
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
<% function upperFirst (str) { return str.charAt(0).toUpperCase() + str.substr(1);} %>sap.ui.require([
|
|
2
|
-
"sap/ui/test/Opa5"<% if (action) { %>,
|
|
3
|
-
"sap/ui/test/actions/Press"<% } %>
|
|
4
|
-
], function (Opa5<% if (action) { %>, Press<% } %>) {
|
|
5
|
-
"use strict";
|
|
6
|
-
|
|
7
|
-
var sViewName = "<%= appId %>.view.<%= upperFirst(poName) %>View";
|
|
8
|
-
|
|
9
|
-
Opa5.createPageObjects({
|
|
10
|
-
onThe<%= upperFirst(poName) %>Page: {
|
|
11
|
-
viewName: sViewName,
|
|
12
|
-
|
|
13
|
-
actions: {
|
|
14
|
-
// add action functions here<% if (action) { %>
|
|
15
|
-
<%= action %>: function () {
|
|
16
|
-
return this.waitFor({
|
|
17
|
-
controlType: "sap.m.Button",
|
|
18
|
-
actions: new Press(),
|
|
19
|
-
errorMessage: "App does not have a button"
|
|
20
|
-
});
|
|
21
|
-
}<% } %>
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
assertions: {
|
|
25
|
-
// add assertion functions here<% if (assertion) { %>
|
|
26
|
-
<%= assertion %>: function () {
|
|
27
|
-
return this.waitFor({
|
|
28
|
-
controlType: "sap.m.Title",
|
|
29
|
-
properties: {
|
|
30
|
-
text: "<%=appId%>"
|
|
31
|
-
},
|
|
32
|
-
success: function() {
|
|
33
|
-
Opa5.assert.ok(true, "The page shows the correct title");
|
|
34
|
-
},
|
|
35
|
-
errorMessage: "App does not show the expected title <%=appId%>"
|
|
36
|
-
});
|
|
37
|
-
}<% } %>
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
});
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
var Generator = require("yeoman-generator");
|
|
2
|
-
var validFilename = require("valid-filename");
|
|
3
|
-
var fs = require("fs");
|
|
4
|
-
|
|
5
|
-
module.exports = class extends Generator {
|
|
6
|
-
constructor(args, opts) {
|
|
7
|
-
super(args, opts);
|
|
8
|
-
this.answers = {};
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
prompting() {
|
|
12
|
-
return this.prompt([{
|
|
13
|
-
type: "input",
|
|
14
|
-
name: "poName",
|
|
15
|
-
message: "Page object name:",
|
|
16
|
-
default: "Master",
|
|
17
|
-
validate: validFilename
|
|
18
|
-
}, {
|
|
19
|
-
type: "input",
|
|
20
|
-
name: "action",
|
|
21
|
-
message: "Add action with name (empty string to skip actions):"
|
|
22
|
-
}, {
|
|
23
|
-
type: "input",
|
|
24
|
-
name: "assertion",
|
|
25
|
-
message: "Add assertion with name (empty string to skip assertions):"
|
|
26
|
-
}]).then(function (answers) {
|
|
27
|
-
this.options.oneTimeConfig = this.config.getAll();
|
|
28
|
-
for (var key in answers) {
|
|
29
|
-
this.options.oneTimeConfig[key] = answers[key];
|
|
30
|
-
}
|
|
31
|
-
this.options.oneTimeConfig.poFile = this.options.oneTimeConfig.poName.charAt(0).toLowerCase() + this.options.oneTimeConfig.poName.substr(1);
|
|
32
|
-
|
|
33
|
-
this.options.oneTimeConfig.dirname = "";
|
|
34
|
-
if (this.options.dirname) {
|
|
35
|
-
this.options.oneTimeConfig.dirname = this.options.dirname + "/";
|
|
36
|
-
} else if (this.options.oneTimeConfig.uiveri5Tests) {
|
|
37
|
-
this.options.oneTimeConfig.dirname = this.options.oneTimeConfig.uiveri5Tests + "/";
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const pos = this.config.get("uiveri5pos") || {};
|
|
41
|
-
pos[this.options.oneTimeConfig.poFile] = {
|
|
42
|
-
action: this.options.oneTimeConfig.action,
|
|
43
|
-
assertion: this.options.oneTimeConfig.assertion
|
|
44
|
-
};
|
|
45
|
-
this.config.set("uiveri5pos", pos);
|
|
46
|
-
this.options.oneTimeConfig.uiveri5pos = pos;
|
|
47
|
-
}.bind(this));
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
writing() {
|
|
51
|
-
const specs = this.config.get("uiveri5specs") || [];
|
|
52
|
-
|
|
53
|
-
this.fs.copyTpl(
|
|
54
|
-
this.templatePath("pages/$poFile.js"),
|
|
55
|
-
this.destinationPath(this.options.oneTimeConfig.dirname + "pages/" + this.options.oneTimeConfig.poFile + ".js"),
|
|
56
|
-
this.options.oneTimeConfig
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
// add new po to existing specs
|
|
60
|
-
specs.forEach((spec) => {
|
|
61
|
-
const specFile = this.destinationPath(this.options.oneTimeConfig.dirname + spec + ".spec.js");
|
|
62
|
-
if (fs.existsSync(specFile)) {
|
|
63
|
-
let content = fs.readFileSync(specFile, "utf8");
|
|
64
|
-
content = `require("./pages/${this.options.oneTimeConfig.poFile}");\n` + content.substr(0, content.lastIndexOf("});"));
|
|
65
|
-
Object.keys(this.options.oneTimeConfig.uiveri5pos).forEach(function (poFile) {
|
|
66
|
-
const poName = poFile.charAt(0).toUpperCase() + poFile.substr(1);
|
|
67
|
-
content += ` it("should see the ${poName} page", function () {\n // call the page object's actions and assertions:\n` +
|
|
68
|
-
` // When.onThe${poName}Page.iDoSomething();\n` +
|
|
69
|
-
` // Then.onThe${poName}Page.iAssertSomething();\n`;
|
|
70
|
-
if (this.options.oneTimeConfig.uiveri5pos[poFile].action) {
|
|
71
|
-
content += ` When.onThe${poName}Page.${this.options.oneTimeConfig.uiveri5pos[poFile].action}();\n`;
|
|
72
|
-
}
|
|
73
|
-
if (this.options.oneTimeConfig.uiveri5pos[poFile].assertion) {
|
|
74
|
-
content += ` Then.onThe${poName}Page.${this.options.oneTimeConfig.uiveri5pos[poFile].assertion}();\n`;
|
|
75
|
-
}
|
|
76
|
-
content += " });\n\n";
|
|
77
|
-
}.bind(this));
|
|
78
|
-
content += "});\n";
|
|
79
|
-
|
|
80
|
-
fs.writeFileSync(specFile, content);
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<% function upperFirst (str) { return str.charAt(0).toUpperCase() + str.substr(1);} %>module.exports = createPageObjects({
|
|
2
|
-
<%= upperFirst(poName) %>: {
|
|
3
|
-
actions: {
|
|
4
|
-
// add action functions here
|
|
5
|
-
<% if (action) { %><%= action %>: function () {
|
|
6
|
-
element(by.control({
|
|
7
|
-
controlType: "sap.m.Button"
|
|
8
|
-
})).click();
|
|
9
|
-
}<% } %>
|
|
10
|
-
},
|
|
11
|
-
assertions: {
|
|
12
|
-
// add assertion functions here
|
|
13
|
-
<% if (assertion) { %><%= assertion %>: function () {
|
|
14
|
-
expect(element(by.control({
|
|
15
|
-
controlType: "sap.m.Button"
|
|
16
|
-
})).isDisplayed()).toBeTruthy();
|
|
17
|
-
}<% } %>
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
});
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
var Generator = require("yeoman-generator");
|
|
2
|
-
var validFilename = require("valid-filename");
|
|
3
|
-
|
|
4
|
-
module.exports = class extends Generator {
|
|
5
|
-
|
|
6
|
-
prompting() {
|
|
7
|
-
return this.prompt([{
|
|
8
|
-
type: "input",
|
|
9
|
-
name: "suiteName",
|
|
10
|
-
message: "Name for the suite (describe block):",
|
|
11
|
-
default: "masterdetail",
|
|
12
|
-
validate: validFilename
|
|
13
|
-
}, {
|
|
14
|
-
type: "input",
|
|
15
|
-
name: "specName",
|
|
16
|
-
message: "Name for the spec (it block):",
|
|
17
|
-
default: "should see the app"
|
|
18
|
-
}]).then(function (answers) {
|
|
19
|
-
this.options.oneTimeConfig = this.config.getAll();
|
|
20
|
-
for (var key in answers) {
|
|
21
|
-
this.options.oneTimeConfig[key] = answers[key];
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
this.options.oneTimeConfig.dirname = "";
|
|
25
|
-
if (this.options.dirname) {
|
|
26
|
-
this.options.oneTimeConfig.dirname = this.options.dirname + "/";
|
|
27
|
-
} else if (this.options.oneTimeConfig.uiveri5Tests) {
|
|
28
|
-
this.options.oneTimeConfig.dirname = this.options.oneTimeConfig.uiveri5Tests + "/";
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const specs = this.config.get("uiveri5specs") || [];
|
|
32
|
-
specs.push(this.options.oneTimeConfig.suiteName);
|
|
33
|
-
this.config.set("uiveri5specs", specs);
|
|
34
|
-
this.options.oneTimeConfig.uiveri5specs = specs;
|
|
35
|
-
|
|
36
|
-
// set default value for uiveri5pos if empty
|
|
37
|
-
const pos = this.config.get("uiveri5pos") || {};
|
|
38
|
-
this.config.set("uiveri5pos", pos);
|
|
39
|
-
this.options.oneTimeConfig.uiveri5pos = pos;
|
|
40
|
-
}.bind(this));
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
async writing() {
|
|
44
|
-
this.fs.copyTpl(
|
|
45
|
-
this.templatePath("$specName.spec.js"),
|
|
46
|
-
this.destinationPath(this.options.oneTimeConfig.dirname + "/" + this.options.oneTimeConfig.suiteName + ".spec.js"),
|
|
47
|
-
this.options.oneTimeConfig
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
};
|