@syncfusion/ej2-base 25.2.7 → 26.1.35-7502

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.
Files changed (201) hide show
  1. package/{README.md → ReadMe.md} +100 -100
  2. package/bin/syncfusion-license.js +104 -1
  3. package/dist/ej2-base.min.js +1 -10
  4. package/dist/ej2-base.umd.min.js +1 -10
  5. package/dist/ej2-base.umd.min.js.map +1 -1
  6. package/dist/es6/ej2-base.es2015.js +268 -486
  7. package/dist/es6/ej2-base.es2015.js.map +1 -1
  8. package/dist/es6/ej2-base.es5.js +307 -522
  9. package/dist/es6/ej2-base.es5.js.map +1 -1
  10. package/dist/global/ej2-base.min.js +1 -10
  11. package/dist/global/ej2-base.min.js.map +1 -1
  12. package/dist/global/index.d.ts +0 -9
  13. package/dist/ts/undefined +67 -0
  14. package/e2e/crypto.js +16 -16
  15. package/e2e/index.d.ts +27 -27
  16. package/e2e/m.protractor.config.js +286 -286
  17. package/e2e/modified-protractor/protractor.config.js +316 -316
  18. package/e2e/protractor.config.js +389 -389
  19. package/helpers/e2e/index.js +3 -3
  20. package/license +10 -10
  21. package/package.json +225 -161
  22. package/src/ajax.d.ts +1 -1
  23. package/src/ajax.js +3 -7
  24. package/src/animation-model.d.ts +41 -41
  25. package/src/animation.d.ts +1 -1
  26. package/src/animation.js +20 -22
  27. package/src/base.d.ts +2 -1
  28. package/src/base.js +4 -13
  29. package/src/browser.d.ts +1 -1
  30. package/src/browser.js +3 -4
  31. package/src/child-property.d.ts +1 -0
  32. package/src/child-property.js +2 -2
  33. package/src/component-model.d.ts +16 -16
  34. package/src/component.d.ts +4 -0
  35. package/src/component.js +28 -36
  36. package/src/dom.js +4 -11
  37. package/src/draggable-model.d.ts +113 -113
  38. package/src/draggable.js +20 -41
  39. package/src/droppable-model.d.ts +23 -23
  40. package/src/droppable.js +19 -20
  41. package/src/event-handler.js +2 -6
  42. package/src/fetch.js +1 -2
  43. package/src/hijri-parser.js +3 -3
  44. package/src/internationalization.d.ts +4 -0
  45. package/src/internationalization.js +0 -5
  46. package/src/intl/date-formatter.js +19 -33
  47. package/src/intl/date-parser.js +33 -62
  48. package/src/intl/intl-base.d.ts +9 -1
  49. package/src/intl/intl-base.js +19 -18
  50. package/src/intl/number-formatter.js +14 -7
  51. package/src/intl/number-parser.js +2 -6
  52. package/src/intl/parser-base.js +6 -11
  53. package/src/keyboard-model.d.ts +16 -16
  54. package/src/keyboard.js +19 -20
  55. package/src/module-loader.js +1 -0
  56. package/src/notify-property-change.d.ts +0 -20
  57. package/src/notify-property-change.js +16 -55
  58. package/src/observer.js +3 -6
  59. package/src/sanitize-helper.js +0 -1
  60. package/src/template-engine.js +1 -7
  61. package/src/template.js +13 -18
  62. package/src/touch-model.d.ts +39 -39
  63. package/src/touch.js +22 -27
  64. package/src/util.d.ts +4 -4
  65. package/src/util.js +12 -37
  66. package/src/validate-lic.js +4 -3
  67. package/styles/_all.scss +2 -2
  68. package/styles/_bds-dark-definition.scss +16 -15
  69. package/styles/_bds-definition.scss +16 -15
  70. package/styles/_bootstrap-dark-definition.scss +42 -42
  71. package/styles/_bootstrap-definition.scss +42 -42
  72. package/styles/_bootstrap4-definition.scss +11 -11
  73. package/styles/_bootstrap5-dark-definition.scss +9 -9
  74. package/styles/_bootstrap5-definition.scss +8 -8
  75. package/styles/_bootstrap5.3-dark-definition.scss +8 -0
  76. package/styles/_bootstrap5.3-definition.scss +8 -0
  77. package/styles/_fabric-dark-definition.scss +42 -42
  78. package/styles/_fabric-definition.scss +42 -42
  79. package/styles/_fluent-dark-definition.scss +9 -9
  80. package/styles/_fluent-definition.scss +9 -9
  81. package/styles/_fluent2-dark-definition.scss +9 -0
  82. package/styles/_fluent2-definition.scss +9 -0
  83. package/styles/_fluent2-highcontrast-definition.scss +9 -0
  84. package/styles/_fusionnew-dark-definition.scss +8 -8
  85. package/styles/_fusionnew-definition.scss +8 -8
  86. package/styles/_highcontrast-definition.scss +42 -42
  87. package/styles/_highcontrast-light-definition.scss +42 -42
  88. package/styles/_material-dark-definition.scss +49 -48
  89. package/styles/_material-definition.scss +50 -49
  90. package/styles/_material3-dark-definition.scss +15 -14
  91. package/styles/_material3-definition.scss +16 -15
  92. package/styles/_tailwind-dark-definition.scss +16 -15
  93. package/styles/_tailwind-definition.scss +16 -15
  94. package/styles/_tailwind3-dark-definition.scss +15 -0
  95. package/styles/_tailwind3-definition.scss +15 -0
  96. package/styles/animation/_all.scss +535 -560
  97. package/styles/bds-lite.css +3408 -0
  98. package/styles/bds-lite.scss +3 -0
  99. package/styles/bds.css +3408 -0
  100. package/styles/bds.scss +3 -0
  101. package/styles/bootstrap-dark-lite.css +3749 -0
  102. package/styles/bootstrap-dark-lite.scss +3 -0
  103. package/styles/bootstrap-dark.css +1075 -169
  104. package/styles/bootstrap-lite.css +3749 -0
  105. package/styles/bootstrap-lite.scss +3 -0
  106. package/styles/bootstrap.css +1075 -169
  107. package/styles/bootstrap4-lite.css +3390 -0
  108. package/styles/bootstrap4-lite.scss +3 -0
  109. package/styles/bootstrap4.css +1063 -169
  110. package/styles/bootstrap5-dark-lite.css +2966 -0
  111. package/styles/bootstrap5-dark-lite.scss +3 -0
  112. package/styles/bootstrap5-dark.css +1068 -171
  113. package/styles/bootstrap5-lite.css +2966 -0
  114. package/styles/bootstrap5-lite.scss +3 -0
  115. package/styles/bootstrap5.3-lite.css +3559 -0
  116. package/styles/bootstrap5.3-lite.scss +3 -0
  117. package/styles/bootstrap5.3.css +3559 -0
  118. package/styles/bootstrap5.3.scss +3 -0
  119. package/styles/bootstrap5.css +1066 -169
  120. package/styles/common/_all.scss +2 -2
  121. package/styles/common/_core.scss +111 -117
  122. package/styles/common/_mixin.scss +11 -9
  123. package/styles/definition/_bds-dark.scss +1193 -1178
  124. package/styles/definition/_bds.scss +1488 -1458
  125. package/styles/definition/_bootstrap-dark.scss +213 -219
  126. package/styles/definition/_bootstrap.scss +208 -215
  127. package/styles/definition/_bootstrap4.scss +159 -167
  128. package/styles/definition/_bootstrap5-dark.scss +481 -494
  129. package/styles/definition/_bootstrap5.3-dark.scss +1232 -0
  130. package/styles/definition/_bootstrap5.3.scss +1579 -0
  131. package/styles/definition/_bootstrap5.scss +481 -495
  132. package/styles/definition/_fabric-dark.scss +194 -200
  133. package/styles/definition/_fabric.scss +192 -198
  134. package/styles/definition/_fluent-dark.scss +494 -557
  135. package/styles/definition/_fluent.scss +494 -558
  136. package/styles/definition/_fluent2-dark.scss +1523 -0
  137. package/styles/definition/_fluent2-highcontrast.scss +1523 -0
  138. package/styles/definition/_fluent2.scss +2295 -0
  139. package/styles/definition/_fusionnew-dark.scss +330 -362
  140. package/styles/definition/_fusionnew.scss +331 -363
  141. package/styles/definition/_highcontrast-light.scss +189 -193
  142. package/styles/definition/_highcontrast.scss +189 -195
  143. package/styles/definition/_material-dark.scss +193 -198
  144. package/styles/definition/_material.scss +186 -192
  145. package/styles/definition/_material3-dark.scss +660 -710
  146. package/styles/definition/_material3.scss +729 -792
  147. package/styles/definition/_tailwind-dark.scss +445 -488
  148. package/styles/definition/_tailwind.scss +443 -485
  149. package/styles/definition/_tailwind3-dark.scss +1622 -0
  150. package/styles/definition/_tailwind3.scss +2093 -0
  151. package/styles/fabric-dark-lite.css +3734 -0
  152. package/styles/fabric-dark-lite.scss +3 -0
  153. package/styles/fabric-dark.css +1075 -169
  154. package/styles/fabric-lite.css +3734 -0
  155. package/styles/fabric-lite.scss +3 -0
  156. package/styles/fabric.css +1075 -169
  157. package/styles/fluent-dark-lite.css +2966 -0
  158. package/styles/fluent-dark-lite.scss +3 -0
  159. package/styles/fluent-dark.css +1066 -169
  160. package/styles/fluent-lite.css +2966 -0
  161. package/styles/fluent-lite.scss +3 -0
  162. package/styles/fluent.css +1066 -169
  163. package/styles/fluent2-lite.css +4017 -0
  164. package/styles/fluent2-lite.scss +3 -0
  165. package/styles/fluent2.css +4017 -0
  166. package/styles/fluent2.scss +3 -0
  167. package/styles/highcontrast-light-lite.css +3725 -0
  168. package/styles/highcontrast-light-lite.scss +3 -0
  169. package/styles/highcontrast-light.css +1075 -169
  170. package/styles/highcontrast-lite.css +3725 -0
  171. package/styles/highcontrast-lite.scss +3 -0
  172. package/styles/highcontrast.css +1075 -169
  173. package/styles/material-dark-lite.css +3702 -0
  174. package/styles/material-dark-lite.scss +3 -0
  175. package/styles/material-dark.css +1075 -169
  176. package/styles/material-lite.css +3702 -0
  177. package/styles/material-lite.scss +3 -0
  178. package/styles/material.css +1075 -169
  179. package/styles/material3-dark-lite.css +3021 -0
  180. package/styles/material3-dark-lite.scss +3 -0
  181. package/styles/material3-dark.css +1066 -170
  182. package/styles/material3-lite.css +3077 -0
  183. package/styles/material3-lite.scss +3 -0
  184. package/styles/material3.css +1066 -170
  185. package/styles/offline-theme/material-dark.css +1075 -169
  186. package/styles/offline-theme/material.css +1075 -169
  187. package/styles/offline-theme/tailwind-dark.css +1067 -170
  188. package/styles/offline-theme/tailwind.css +1067 -170
  189. package/styles/tailwind-dark-lite.css +2967 -0
  190. package/styles/tailwind-dark-lite.scss +3 -0
  191. package/styles/tailwind-dark.css +1067 -170
  192. package/styles/tailwind-lite.css +2967 -0
  193. package/styles/tailwind-lite.scss +3 -0
  194. package/styles/tailwind.css +1067 -170
  195. package/styles/tailwind3-lite.css +3775 -0
  196. package/styles/tailwind3-lite.scss +3 -0
  197. package/styles/tailwind3.css +3775 -0
  198. package/styles/tailwind3.scss +3 -0
  199. package/.eslintrc.json +0 -260
  200. package/CHANGELOG.md +0 -649
  201. package/tslint.json +0 -111
@@ -1,316 +1,316 @@
1
- var shell = require('shelljs');
2
- var os = require('os');
3
- var camelCase = require('pix-diff/lib/camelCase.js');
4
- var seleniumAddress = 'http://150.107.121.2:4444/wd/hub';
5
- var request = require('request');
6
- var config = require('../../../../config.json');
7
- var RepalceRegex = /"/g;
8
- var isDashBoardReport = config['dashBoardReport'];
9
- var timeCal = {};
10
- var fs = require('fs');
11
- var enableW3c = '{W3cdisabled}';
12
- var HtmlScreenshotReporter = require('protractor-jasmine2-screenshot-reporter');
13
- var reporter = new HtmlScreenshotReporter({
14
- dest: 'e2e_report/' + config.browsers[0],
15
- filename: config.browsers[0] + '.html'
16
- });
17
- isDashBoardReport = isDashBoardReport === undefined ? true : isDashBoardReport;
18
- if (isDashBoardReport) {
19
- var currentRepo = shell.exec('git config --get remote.origin.url', {
20
- silent: true
21
- })
22
- .stdout.split('essential-studio/')[1].replace('.git', '').replace('/', '').trim();
23
- var components = JSON.stringify(config.components);
24
- components = components.replace(RepalceRegex, '').replace('[', '').replace(']', '').trim();
25
- var branch = JSON.stringify(config.branchName);
26
- branch = branch.replace(RepalceRegex, '').trim();
27
- var toMail = config.toMailAddress;
28
- var ccMail = config.ccMailAddress;
29
- }
30
-
31
- exports.config = {
32
- allScriptsTimeout: 600000,
33
-
34
- getPageTimeout: 60000,
35
-
36
- framework: 'jasmine',
37
-
38
- jasmineNodeOpts: {
39
- defaultTimeoutInterval: 100000
40
- },
41
- multiCapabilities: [],
42
-
43
- specs: ['../../../../e2e/tests/**/*.spec.js'],
44
-
45
- onComplete: function () {
46
- if (isDashBoardReport) {
47
- var failurecount = 0;
48
- var resultjson = require('../../../../jasmine-test-results.json');
49
- var key = Object.keys(resultjson);
50
- var totalcount = 0;
51
- for (var i = 0; i < key.length; i++) {
52
- var Objects = resultjson[key[i]]["specs"];
53
- totalcount = totalcount + Objects.length;
54
- for (var j = 0; j < Objects.length; j++) {
55
- if (Objects[j].status === "failed") {
56
- failurecount++;
57
- }
58
- }
59
- }
60
- ccMail.push("ej2core@syncfusion.com");
61
- var data = {
62
- RepositoryName: currentRepo,
63
- ComponentName: components,
64
- BranchName: branch,
65
- StartDate: new Date(),
66
- EndDate: new Date(),
67
- Type: "Desktop",
68
- TotalTestCaseCount: totalcount,
69
- FailureTestCaseCount: failurecount,
70
- SuccessTestCaseCount: totalcount - failurecount,
71
- Browser: browser.browserName,
72
- toMailAddress: toMail,
73
- ccMailAddress: ccMail
74
- };
75
- var status = failurecount.length ? 'Failure' : 'Success';
76
- var successCount = totalcount - failurecount;
77
- var notRun = totalcount - (successCount + failurecount);
78
- if (fs.existsSync('./testreport')) {
79
- shell.cd('./testreport');
80
- shell.exec('Syncfusion.UpdateTestResults.exe /Platform:"JavaScript - EJ2" /Control:"' + components +
81
- '" /TestingTool:"Selenium" /StartTime:"' + new Date().toLocaleTimeString() + '" /EndTime:"' + new Date().toLocaleTimeString() +
82
- '" /Status:"' + status + '" /TotalTestCase:' + totalcount +
83
- ' /SuccessCount:' + successCount + ' /FailureCount:' + failurecount + ' /NotRunCount:' + notRun + ' /UpdatedBy:"' + toMail[0] + '"');
84
- shell.cd('../');
85
- }
86
- request({
87
- url: 'https://ej2services.syncfusion.com/cicentral/api/getE2EReport',
88
- method: 'POST',
89
- json: true,
90
- body: data,
91
- headers: {
92
- 'authorization': 'ej2centrailzedstatus',
93
- 'content-type': 'application/json'
94
- }
95
- });
96
- }
97
-
98
- browser.driver.quit();
99
- console.log(browser.browserName + ' driver closed!');
100
- },
101
- beforeLaunch: function () {
102
- return new Promise(function (resolve) {
103
- reporter.beforeLaunch(resolve);
104
- });
105
- },
106
-
107
- onPrepare: function () {
108
- const PixDiff = require('pix-diff');
109
- const fs = require('fs');
110
- const path = require('path');
111
- browser.ignoreSynchronization = true;
112
- browser.waitForAngularEnabled = false;
113
- browser.isDesktop = true;
114
- timeCal['startTime'] = new Date().toLocaleTimeString();
115
- browser.basePath = require('../../../../protractor.browser.json').basePath;
116
-
117
- browser.driver.manage().window().setSize(1600, 1200);
118
- var JSONReporter = require('jasmine-json-test-reporter');
119
- jasmine.getEnv().addReporter(new JSONReporter({
120
- file: 'jasmine-test-results.json',
121
- beautify: true,
122
- indentationLevel: 4 // used if beautify === true
123
- }));
124
-
125
- //move to out off user screen
126
- browser.driver.manage().window().setPosition(2500, 0);
127
-
128
- browser.load = function (path) {
129
- browser.get(browser.basePath + path);
130
- // browser.wait(function () {
131
- // return element(By.css('.e-control')).isDisplayed();
132
- // }, 3000);
133
-
134
- if (browser.css) {
135
- browser.injectCss(browser.css);
136
- }
137
- }
138
-
139
- browser.loadAsync = function (path) {
140
- return browser.get(browser.basePath + path);
141
- }
142
-
143
- browser.getCapabilities().then(function (cap) {
144
-
145
- browser.browserName = cap.get('browserName');
146
-
147
- browser.pixResult = PixDiff;
148
-
149
- browser.pixDiff = new PixDiff({
150
- basePath: './e2e',
151
- diffPath: './e2e',
152
- formatImageName: '{tag}'
153
- });
154
-
155
- //override difference path
156
- browser.pixDiff.diffPath = path.normalize(camelCase('./e2e/Diff/' + browser.browserName));
157
- //create folder if not present
158
- createF(browser.pixDiff.diffPath);
159
-
160
- browser.compareScreen = function (element, fileName, opt) {
161
- var folderName = fileName;
162
- var fArr = fileName.split('/');
163
- if (fArr.length > 1) {
164
- fArr.splice(-1, 1);
165
- folderName = fArr.join('/')
166
- createF(camelCase('e2e/expected/' + browser.pixDiff.browserName + '/' + folderName));
167
- createF(camelCase('e2e/actual/' + browser.pixDiff.browserName + '/' + folderName));
168
- }
169
-
170
- // thresholdType: 'percent',
171
- // threshold: 0.009,
172
- var option = {
173
- imageAPath: '/expected/' + browser.pixDiff.browserName + '/' + fileName, // Use file-path
174
- imageBPath: '/actual/' + browser.pixDiff.browserName + '/' + fileName,
175
- filter: ['grayScale'],
176
- debug: true,
177
- hideShift: true,
178
- };
179
- var doneFn = arguments[arguments.length - 1];
180
- if (typeof opt === 'object' && Object.keys(opt).length) {
181
- Object.assign(option, opt);
182
- }
183
- browser.pixDiff.saveRegion(element, '/Actual/' + browser.pixDiff.browserName + '/' + fileName, option).then(() => {
184
- var fPathName = path.resolve(__dirname, '../../../../' + camelCase('e2e/expected/' + browser.pixDiff.browserName + '/' + fileName) + '.png');
185
- if (!fs.existsSync(fPathName) && fs.existsSync(fPathName.replace("Expected", "Actual"))) {
186
- fs.copyFileSync(fPathName.replace("Expected", "Actual"), fPathName);
187
- console.log('Expected Image Created : /expected/' + browser.pixDiff.browserName + '/' + fileName);
188
- }
189
- browser.saveCheckImage(element, fileName, option, doneFn);
190
- });
191
- }
192
-
193
- browser.saveCheckImage = function (element, fileName, option, doneFn) {
194
- browser.pixDiff.checkRegion(element, '/Expected/' + browser.pixDiff.browserName + '/' + fileName, option).then((result) => {
195
- //
196
- // * - `RESULT_UNKNOWN`: 0
197
- // * - `RESULT_DIFFERENT`: 1
198
- // * - `RESULT_SIMILAR`: 7
199
- // * - `RESULT_IDENTICAL`: 5
200
- console.log(JSON.stringify(result));
201
- expect(result.code).toEqual(browser.pixResult.RESULT_IDENTICAL);
202
- if (typeof doneFn === 'function') {
203
- doneFn();
204
- }
205
- });
206
- }
207
-
208
- browser.waitForEvent = function (id, moduleName, eventName) {
209
- return browser.executeAsyncScript(function (id, moduleName, eventName, callback) {
210
- var instances = document.getElementById(id).ej2_instances;
211
- var instanceObj;
212
- for (var i = 0; instances && i < instances.length; i++) {
213
- if (instances[i].getModuleName() == moduleName) {
214
- instanceObj = instances[i]
215
- }
216
- }
217
- if (instanceObj) {
218
- var handler;
219
- handler = function (e) {
220
- instanceObj.removeEventListener(eventName, handler);
221
- callback();
222
- };
223
- instanceObj.addEventListener(eventName, handler);
224
- } else {
225
- callback();
226
- }
227
- }, id, moduleName, eventName);
228
- }
229
-
230
- browser.injectScript = function (path, callback) {
231
- return browser.executeAsyncScript(function (path) {
232
- var head = document.getElementsByTagName('head')[0];
233
- var script = document.createElement('script');
234
- script.type = 'text/javascript';
235
- script.onload = function () {
236
- callback();
237
- }
238
- script.src = path;
239
- head.appendChild(script);
240
- }, browser.basePath + path);
241
-
242
- }
243
-
244
- browser.injectCss = function (content) {
245
- return browser.wait(browser.executeScript(`
246
- var style = document.createElement('style');
247
- style.id = 'browsercss';
248
- if (style.styleSheet) {style.styleSheet.cssText = '` + content + `';}
249
- else{style.appendChild(document.createTextNode('` + content + `'));}
250
- document.head.appendChild(style);
251
- `));
252
- }
253
-
254
- });
255
- jasmine.getEnv().addReporter(reporter);
256
-
257
- },
258
- afterLaunch: function (exitCode) {
259
- return new Promise(function (resolve) {
260
- reporter.afterLaunch(resolve.bind(this, exitCode));
261
- });
262
- },
263
- };
264
-
265
- //Browser Configuration
266
- if (config.browsers && config.browsers.length) {
267
- for (var i = 0; i < config.browsers.length; i++) {
268
- var browserName = config.browsers[i];
269
- if (browserName === 'chrome' && enableW3c === '{W3cenabled}') {
270
- exports.config.multiCapabilities.push({
271
- 'browserName': browserName,
272
- 'goog:chromeOptions': { //disable w3c here
273
- w3c: false,
274
- }
275
- });
276
- } else {
277
- exports.config.multiCapabilities.push({
278
- 'browserName': browserName
279
- });
280
- }
281
- }
282
- } else {
283
- if (os.platform() === 'win32') {
284
- exports.config.multiCapabilities.push({
285
- 'browserName': 'internet explorer'
286
- });
287
- if (Number(os.release().split('.')[0]) >= 10) {
288
- exports.config.multiCapabilities.push({
289
- 'browserName': 'MicrosoftEdge'
290
- });
291
- }
292
- }
293
- exports.config.multiCapabilities.push({
294
- 'browserName': 'firefox'
295
- });
296
- if (enableW3c === '{W3cenabled}') {
297
- exports.config.multiCapabilities.push({
298
- 'browserName': 'chrome',
299
- 'goog:chromeOptions': { //disable w3c here
300
- w3c: false,
301
- }
302
- });
303
- } else {
304
- exports.config.multiCapabilities.push({
305
- 'browserName': 'chrome',
306
- 'chromeOptions': {
307
- 'args': ['no-sandbox']
308
- }
309
- });
310
- }
311
- }
312
- exports.config.seleniumAddress = config.seleniumAddress || 'http://localhost:4444/wd/hub/';
313
-
314
- function createF(path) {
315
- shell.mkdir('-p', path);
316
- }
1
+ var shell = require('shelljs');
2
+ var os = require('os');
3
+ var camelCase = require('pix-diff/lib/camelCase.js');
4
+ var seleniumAddress = 'http://150.107.121.2:4444/wd/hub';
5
+ var request = require('request');
6
+ var config = require('../../../../config.json');
7
+ var RepalceRegex = /"/g;
8
+ var isDashBoardReport = config['dashBoardReport'];
9
+ var timeCal = {};
10
+ var fs = require('fs');
11
+ var enableW3c = '{W3cdisabled}';
12
+ var HtmlScreenshotReporter = require('protractor-jasmine2-screenshot-reporter');
13
+ var reporter = new HtmlScreenshotReporter({
14
+ dest: 'e2e_report/' + config.browsers[0],
15
+ filename: config.browsers[0] + '.html'
16
+ });
17
+ isDashBoardReport = isDashBoardReport === undefined ? true : isDashBoardReport;
18
+ if (isDashBoardReport) {
19
+ var currentRepo = shell.exec('git config --get remote.origin.url', {
20
+ silent: true
21
+ })
22
+ .stdout.split('essential-studio/')[1].replace('.git', '').replace('/', '').trim();
23
+ var components = JSON.stringify(config.components);
24
+ components = components.replace(RepalceRegex, '').replace('[', '').replace(']', '').trim();
25
+ var branch = JSON.stringify(config.branchName);
26
+ branch = branch.replace(RepalceRegex, '').trim();
27
+ var toMail = config.toMailAddress;
28
+ var ccMail = config.ccMailAddress;
29
+ }
30
+
31
+ exports.config = {
32
+ allScriptsTimeout: 600000,
33
+
34
+ getPageTimeout: 60000,
35
+
36
+ framework: 'jasmine',
37
+
38
+ jasmineNodeOpts: {
39
+ defaultTimeoutInterval: 100000
40
+ },
41
+ multiCapabilities: [],
42
+
43
+ specs: ['../../../../e2e/tests/**/*.spec.js'],
44
+
45
+ onComplete: function () {
46
+ if (isDashBoardReport) {
47
+ var failurecount = 0;
48
+ var resultjson = require('../../../../jasmine-test-results.json');
49
+ var key = Object.keys(resultjson);
50
+ var totalcount = 0;
51
+ for (var i = 0; i < key.length; i++) {
52
+ var Objects = resultjson[key[i]]["specs"];
53
+ totalcount = totalcount + Objects.length;
54
+ for (var j = 0; j < Objects.length; j++) {
55
+ if (Objects[j].status === "failed") {
56
+ failurecount++;
57
+ }
58
+ }
59
+ }
60
+ ccMail.push("ej2core@syncfusion.com");
61
+ var data = {
62
+ RepositoryName: currentRepo,
63
+ ComponentName: components,
64
+ BranchName: branch,
65
+ StartDate: new Date(),
66
+ EndDate: new Date(),
67
+ Type: "Desktop",
68
+ TotalTestCaseCount: totalcount,
69
+ FailureTestCaseCount: failurecount,
70
+ SuccessTestCaseCount: totalcount - failurecount,
71
+ Browser: browser.browserName,
72
+ toMailAddress: toMail,
73
+ ccMailAddress: ccMail
74
+ };
75
+ var status = failurecount.length ? 'Failure' : 'Success';
76
+ var successCount = totalcount - failurecount;
77
+ var notRun = totalcount - (successCount + failurecount);
78
+ if (fs.existsSync('./testreport')) {
79
+ shell.cd('./testreport');
80
+ shell.exec('Syncfusion.UpdateTestResults.exe /Platform:"JavaScript - EJ2" /Control:"' + components +
81
+ '" /TestingTool:"Selenium" /StartTime:"' + new Date().toLocaleTimeString() + '" /EndTime:"' + new Date().toLocaleTimeString() +
82
+ '" /Status:"' + status + '" /TotalTestCase:' + totalcount +
83
+ ' /SuccessCount:' + successCount + ' /FailureCount:' + failurecount + ' /NotRunCount:' + notRun + ' /UpdatedBy:"' + toMail[0] + '"');
84
+ shell.cd('../');
85
+ }
86
+ request({
87
+ url: 'https://ej2services.syncfusion.com/cicentral/api/getE2EReport',
88
+ method: 'POST',
89
+ json: true,
90
+ body: data,
91
+ headers: {
92
+ 'authorization': 'ej2centrailzedstatus',
93
+ 'content-type': 'application/json'
94
+ }
95
+ });
96
+ }
97
+
98
+ browser.driver.quit();
99
+ console.log(browser.browserName + ' driver closed!');
100
+ },
101
+ beforeLaunch: function () {
102
+ return new Promise(function (resolve) {
103
+ reporter.beforeLaunch(resolve);
104
+ });
105
+ },
106
+
107
+ onPrepare: function () {
108
+ const PixDiff = require('pix-diff');
109
+ const fs = require('fs');
110
+ const path = require('path');
111
+ browser.ignoreSynchronization = true;
112
+ browser.waitForAngularEnabled = false;
113
+ browser.isDesktop = true;
114
+ timeCal['startTime'] = new Date().toLocaleTimeString();
115
+ browser.basePath = require('../../../../protractor.browser.json').basePath;
116
+
117
+ browser.driver.manage().window().setSize(1600, 1200);
118
+ var JSONReporter = require('jasmine-json-test-reporter');
119
+ jasmine.getEnv().addReporter(new JSONReporter({
120
+ file: 'jasmine-test-results.json',
121
+ beautify: true,
122
+ indentationLevel: 4 // used if beautify === true
123
+ }));
124
+
125
+ //move to out off user screen
126
+ browser.driver.manage().window().setPosition(2500, 0);
127
+
128
+ browser.load = function (path) {
129
+ browser.get(browser.basePath + path);
130
+ // browser.wait(function () {
131
+ // return element(By.css('.e-control')).isDisplayed();
132
+ // }, 3000);
133
+
134
+ if (browser.css) {
135
+ browser.injectCss(browser.css);
136
+ }
137
+ }
138
+
139
+ browser.loadAsync = function (path) {
140
+ return browser.get(browser.basePath + path);
141
+ }
142
+
143
+ browser.getCapabilities().then(function (cap) {
144
+
145
+ browser.browserName = cap.get('browserName');
146
+
147
+ browser.pixResult = PixDiff;
148
+
149
+ browser.pixDiff = new PixDiff({
150
+ basePath: './e2e',
151
+ diffPath: './e2e',
152
+ formatImageName: '{tag}'
153
+ });
154
+
155
+ //override difference path
156
+ browser.pixDiff.diffPath = path.normalize(camelCase('./e2e/Diff/' + browser.browserName));
157
+ //create folder if not present
158
+ createF(browser.pixDiff.diffPath);
159
+
160
+ browser.compareScreen = function (element, fileName, opt) {
161
+ var folderName = fileName;
162
+ var fArr = fileName.split('/');
163
+ if (fArr.length > 1) {
164
+ fArr.splice(-1, 1);
165
+ folderName = fArr.join('/')
166
+ createF(camelCase('e2e/expected/' + browser.pixDiff.browserName + '/' + folderName));
167
+ createF(camelCase('e2e/actual/' + browser.pixDiff.browserName + '/' + folderName));
168
+ }
169
+
170
+ // thresholdType: 'percent',
171
+ // threshold: 0.009,
172
+ var option = {
173
+ imageAPath: '/expected/' + browser.pixDiff.browserName + '/' + fileName, // Use file-path
174
+ imageBPath: '/actual/' + browser.pixDiff.browserName + '/' + fileName,
175
+ filter: ['grayScale'],
176
+ debug: true,
177
+ hideShift: true,
178
+ };
179
+ var doneFn = arguments[arguments.length - 1];
180
+ if (typeof opt === 'object' && Object.keys(opt).length) {
181
+ Object.assign(option, opt);
182
+ }
183
+ browser.pixDiff.saveRegion(element, '/Actual/' + browser.pixDiff.browserName + '/' + fileName, option).then(() => {
184
+ var fPathName = path.resolve(__dirname, '../../../../' + camelCase('e2e/expected/' + browser.pixDiff.browserName + '/' + fileName) + '.png');
185
+ if (!fs.existsSync(fPathName) && fs.existsSync(fPathName.replace("Expected", "Actual"))) {
186
+ fs.copyFileSync(fPathName.replace("Expected", "Actual"), fPathName);
187
+ console.log('Expected Image Created : /expected/' + browser.pixDiff.browserName + '/' + fileName);
188
+ }
189
+ browser.saveCheckImage(element, fileName, option, doneFn);
190
+ });
191
+ }
192
+
193
+ browser.saveCheckImage = function (element, fileName, option, doneFn) {
194
+ browser.pixDiff.checkRegion(element, '/Expected/' + browser.pixDiff.browserName + '/' + fileName, option).then((result) => {
195
+ //
196
+ // * - `RESULT_UNKNOWN`: 0
197
+ // * - `RESULT_DIFFERENT`: 1
198
+ // * - `RESULT_SIMILAR`: 7
199
+ // * - `RESULT_IDENTICAL`: 5
200
+ console.log(JSON.stringify(result));
201
+ expect(result.code).toEqual(browser.pixResult.RESULT_IDENTICAL);
202
+ if (typeof doneFn === 'function') {
203
+ doneFn();
204
+ }
205
+ });
206
+ }
207
+
208
+ browser.waitForEvent = function (id, moduleName, eventName) {
209
+ return browser.executeAsyncScript(function (id, moduleName, eventName, callback) {
210
+ var instances = document.getElementById(id).ej2_instances;
211
+ var instanceObj;
212
+ for (var i = 0; instances && i < instances.length; i++) {
213
+ if (instances[i].getModuleName() == moduleName) {
214
+ instanceObj = instances[i]
215
+ }
216
+ }
217
+ if (instanceObj) {
218
+ var handler;
219
+ handler = function (e) {
220
+ instanceObj.removeEventListener(eventName, handler);
221
+ callback();
222
+ };
223
+ instanceObj.addEventListener(eventName, handler);
224
+ } else {
225
+ callback();
226
+ }
227
+ }, id, moduleName, eventName);
228
+ }
229
+
230
+ browser.injectScript = function (path, callback) {
231
+ return browser.executeAsyncScript(function (path) {
232
+ var head = document.getElementsByTagName('head')[0];
233
+ var script = document.createElement('script');
234
+ script.type = 'text/javascript';
235
+ script.onload = function () {
236
+ callback();
237
+ }
238
+ script.src = path;
239
+ head.appendChild(script);
240
+ }, browser.basePath + path);
241
+
242
+ }
243
+
244
+ browser.injectCss = function (content) {
245
+ return browser.wait(browser.executeScript(`
246
+ var style = document.createElement('style');
247
+ style.id = 'browsercss';
248
+ if (style.styleSheet) {style.styleSheet.cssText = '` + content + `';}
249
+ else{style.appendChild(document.createTextNode('` + content + `'));}
250
+ document.head.appendChild(style);
251
+ `));
252
+ }
253
+
254
+ });
255
+ jasmine.getEnv().addReporter(reporter);
256
+
257
+ },
258
+ afterLaunch: function (exitCode) {
259
+ return new Promise(function (resolve) {
260
+ reporter.afterLaunch(resolve.bind(this, exitCode));
261
+ });
262
+ },
263
+ };
264
+
265
+ //Browser Configuration
266
+ if (config.browsers && config.browsers.length) {
267
+ for (var i = 0; i < config.browsers.length; i++) {
268
+ var browserName = config.browsers[i];
269
+ if (browserName === 'chrome' && enableW3c === '{W3cenabled}') {
270
+ exports.config.multiCapabilities.push({
271
+ 'browserName': browserName,
272
+ 'goog:chromeOptions': { //disable w3c here
273
+ w3c: false,
274
+ }
275
+ });
276
+ } else {
277
+ exports.config.multiCapabilities.push({
278
+ 'browserName': browserName
279
+ });
280
+ }
281
+ }
282
+ } else {
283
+ if (os.platform() === 'win32') {
284
+ exports.config.multiCapabilities.push({
285
+ 'browserName': 'internet explorer'
286
+ });
287
+ if (Number(os.release().split('.')[0]) >= 10) {
288
+ exports.config.multiCapabilities.push({
289
+ 'browserName': 'MicrosoftEdge'
290
+ });
291
+ }
292
+ }
293
+ exports.config.multiCapabilities.push({
294
+ 'browserName': 'firefox'
295
+ });
296
+ if (enableW3c === '{W3cenabled}') {
297
+ exports.config.multiCapabilities.push({
298
+ 'browserName': 'chrome',
299
+ 'goog:chromeOptions': { //disable w3c here
300
+ w3c: false,
301
+ }
302
+ });
303
+ } else {
304
+ exports.config.multiCapabilities.push({
305
+ 'browserName': 'chrome',
306
+ 'chromeOptions': {
307
+ 'args': ['no-sandbox']
308
+ }
309
+ });
310
+ }
311
+ }
312
+ exports.config.seleniumAddress = config.seleniumAddress || 'http://localhost:4444/wd/hub/';
313
+
314
+ function createF(path) {
315
+ shell.mkdir('-p', path);
316
+ }