@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,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
+ }