@syncfusion/ej2-base 26.1.35-806029 → 26.1.35-8139

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