froth-webdriverio-framework 5.0.7 → 5.0.9

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 (51) hide show
  1. package/allure-report/app.js +2 -0
  2. package/allure-report/data/attachments/5a44d93eb6bbc152.json +3 -0
  3. package/allure-report/data/attachments/8b4b70d43c5ef509.json +1 -0
  4. package/allure-report/data/attachments/f8f260f9d290c8dc.json +3 -0
  5. package/allure-report/data/behaviors.csv +2 -0
  6. package/allure-report/data/behaviors.json +1 -0
  7. package/allure-report/data/categories.csv +2 -0
  8. package/allure-report/data/categories.json +1 -0
  9. package/allure-report/data/packages.json +1 -0
  10. package/allure-report/data/suites.csv +2 -0
  11. package/allure-report/data/suites.json +1 -0
  12. package/allure-report/data/test-cases/eae527eca53ea9fc.json +1 -0
  13. package/allure-report/data/timeline.json +1 -0
  14. package/allure-report/export/influxDbData.txt +14 -0
  15. package/allure-report/export/mail.html +10 -0
  16. package/allure-report/export/prometheusData.txt +14 -0
  17. package/allure-report/favicon.ico +0 -0
  18. package/allure-report/history/categories-trend.json +1 -0
  19. package/allure-report/history/duration-trend.json +1 -0
  20. package/allure-report/history/history-trend.json +1 -0
  21. package/allure-report/history/history.json +1 -0
  22. package/allure-report/history/retry-trend.json +1 -0
  23. package/allure-report/index.html +34 -0
  24. package/allure-report/plugin/behaviors/index.js +276 -0
  25. package/allure-report/plugin/packages/index.js +160 -0
  26. package/allure-report/plugin/screen-diff/index.js +200 -0
  27. package/allure-report/plugin/screen-diff/styles.css +30 -0
  28. package/allure-report/styles.css +5 -0
  29. package/allure-report/widgets/behaviors.json +1 -0
  30. package/allure-report/widgets/categories-trend.json +1 -0
  31. package/allure-report/widgets/categories.json +1 -0
  32. package/allure-report/widgets/duration-trend.json +1 -0
  33. package/allure-report/widgets/duration.json +1 -0
  34. package/allure-report/widgets/environment.json +1 -0
  35. package/allure-report/widgets/executors.json +1 -0
  36. package/allure-report/widgets/history-trend.json +1 -0
  37. package/allure-report/widgets/launch.json +1 -0
  38. package/allure-report/widgets/retry-trend.json +1 -0
  39. package/allure-report/widgets/severity.json +1 -0
  40. package/allure-report/widgets/status-chart.json +1 -0
  41. package/allure-report/widgets/suites.json +1 -0
  42. package/allure-report/widgets/summary.json +1 -0
  43. package/froth_api_calls/browsersatckSessionInfo.js +6 -3
  44. package/froth_api_calls/getexecutionDetails.js +5 -2
  45. package/froth_common_actions/Utils.js +4 -1
  46. package/froth_common_actions/logData.js +73 -0
  47. package/froth_configs/commonconfig.js +53 -4
  48. package/froth_configs/setallDatailinBuffer.js +1 -1
  49. package/froth_configs/wdio.common.conf.js +26 -11
  50. package/package.json +5 -2
  51. package/config/commonconfig.js +0 -0
@@ -0,0 +1,200 @@
1
+ (function () {
2
+ var settings = allure.getPluginSettings('screen-diff', { diffType: 'diff' });
3
+
4
+ function renderImage(src) {
5
+ return (
6
+ '<div class="screen-diff__container">' +
7
+ '<img class="screen-diff__image" src="' +
8
+ src +
9
+ '">' +
10
+ '</div>'
11
+ );
12
+ }
13
+
14
+ function findImage(data, name) {
15
+ if (data.testStage && data.testStage.attachments) {
16
+ var matchedImage = data.testStage.attachments.filter(function (attachment) {
17
+ return attachment.name === name;
18
+ })[0];
19
+ if (matchedImage) {
20
+ return 'data/attachments/' + matchedImage.source;
21
+ }
22
+ }
23
+ return null;
24
+ }
25
+
26
+ function renderDiffContent(type, diffImage, actualImage, expectedImage) {
27
+ if (type === 'diff') {
28
+ if (diffImage) {
29
+ return renderImage(diffImage);
30
+ }
31
+ }
32
+ if (type === 'overlay' && expectedImage) {
33
+ return (
34
+ '<div class="screen-diff__overlay screen-diff__container">' +
35
+ '<img class="screen-diff__image" src="' +
36
+ expectedImage +
37
+ '">' +
38
+ '<div class="screen-diff__image-over">' +
39
+ '<img class="screen-diff__image" src="' +
40
+ actualImage +
41
+ '">' +
42
+ '</div>' +
43
+ '</div>'
44
+ );
45
+ }
46
+ if (actualImage) {
47
+ return renderImage(actualImage);
48
+ }
49
+ return 'No diff data provided';
50
+ }
51
+
52
+ var TestResultView = Backbone.Marionette.View.extend({
53
+ regions: {
54
+ subView: '.screen-diff-view',
55
+ },
56
+ template: function () {
57
+ return '<div class="screen-diff-view"></div>';
58
+ },
59
+ onRender: function () {
60
+ var data = this.model.toJSON();
61
+ var testType = data.labels.filter(function (label) {
62
+ return label.name === 'testType';
63
+ })[0];
64
+ var diffImage = findImage(data, 'diff');
65
+ var actualImage = findImage(data, 'actual');
66
+ var expectedImage = findImage(data, 'expected');
67
+ if (!testType || testType.value !== 'screenshotDiff') {
68
+ return;
69
+ }
70
+ this.showChildView(
71
+ 'subView',
72
+ new ScreenDiffView({
73
+ diffImage: diffImage,
74
+ actualImage: actualImage,
75
+ expectedImage: expectedImage,
76
+ }),
77
+ );
78
+ },
79
+ });
80
+ var ErrorView = Backbone.Marionette.View.extend({
81
+ templateContext: function () {
82
+ return this.options;
83
+ },
84
+ template: function (data) {
85
+ return '<pre class="screen-diff-error">' + data.error + '</pre>';
86
+ },
87
+ });
88
+ var AttachmentView = Backbone.Marionette.View.extend({
89
+ regions: {
90
+ subView: '.screen-diff-view',
91
+ },
92
+ template: function () {
93
+ return '<div class="screen-diff-view"></div>';
94
+ },
95
+ onRender: function () {
96
+ jQuery
97
+ .getJSON(this.options.sourceUrl)
98
+ .then(this.renderScreenDiffView.bind(this), this.renderErrorView.bind(this));
99
+ },
100
+ renderErrorView: function (error) {
101
+ console.log(error);
102
+ this.showChildView(
103
+ 'subView',
104
+ new ErrorView({
105
+ error: error.statusText,
106
+ }),
107
+ );
108
+ },
109
+ renderScreenDiffView: function (data) {
110
+ this.showChildView(
111
+ 'subView',
112
+ new ScreenDiffView({
113
+ diffImage: data.diff,
114
+ actualImage: data.actual,
115
+ expectedImage: data.expected,
116
+ }),
117
+ );
118
+ },
119
+ });
120
+
121
+ var ScreenDiffView = Backbone.Marionette.View.extend({
122
+ className: 'pane__section',
123
+ events: function () {
124
+ return {
125
+ ['click [name="screen-diff-type-' + this.cid + '"]']: 'onDiffTypeChange',
126
+ 'mousemove .screen-diff__overlay': 'onOverlayMove',
127
+ };
128
+ },
129
+ initialize: function (options) {
130
+ this.diffImage = options.diffImage;
131
+ this.actualImage = options.actualImage;
132
+ this.expectedImage = options.expectedImage;
133
+ this.radioName = 'screen-diff-type-' + this.cid;
134
+ },
135
+ templateContext: function () {
136
+ return {
137
+ diffType: settings.get('diffType'),
138
+ diffImage: this.diffImage,
139
+ actualImage: this.actualImage,
140
+ expectedImage: this.expectedImage,
141
+ radioName: this.radioName,
142
+ };
143
+ },
144
+ template: function (data) {
145
+ if (!data.diffImage && !data.actualImage && !data.expectedImage) {
146
+ return '';
147
+ }
148
+
149
+ return (
150
+ '<h3 class="pane__section-title">Screen Diff</h3>' +
151
+ '<div class="screen-diff__content">' +
152
+ '<div class="screen-diff__switchers">' +
153
+ '<label><input type="radio" name="' +
154
+ data.radioName +
155
+ '" value="diff"> Show diff</label>' +
156
+ '<label><input type="radio" name="' +
157
+ data.radioName +
158
+ '" value="overlay"> Show overlay</label>' +
159
+ '</div>' +
160
+ renderDiffContent(
161
+ data.diffType,
162
+ data.diffImage,
163
+ data.actualImage,
164
+ data.expectedImage,
165
+ ) +
166
+ '</div>'
167
+ );
168
+ },
169
+ adjustImageSize: function (event) {
170
+ var overImage = this.$(event.target);
171
+ overImage.width(overImage.width());
172
+ },
173
+ onRender: function () {
174
+ const diffType = settings.get('diffType');
175
+ this.$('[name="' + this.radioName + '"][value="' + diffType + '"]').prop(
176
+ 'checked',
177
+ true,
178
+ );
179
+ if (diffType === 'overlay') {
180
+ this.$('.screen-diff__image-over img').on('load', this.adjustImageSize.bind(this));
181
+ }
182
+ },
183
+ onOverlayMove: function (event) {
184
+ var pageX = event.pageX;
185
+ var containerScroll = this.$('.screen-diff__container').scrollLeft();
186
+ var elementX = event.currentTarget.getBoundingClientRect().left;
187
+ var delta = pageX - elementX + containerScroll;
188
+ this.$('.screen-diff__image-over').width(delta);
189
+ },
190
+ onDiffTypeChange: function (event) {
191
+ settings.save('diffType', event.target.value);
192
+ this.render();
193
+ },
194
+ });
195
+ allure.api.addTestResultBlock(TestResultView, { position: 'before' });
196
+ allure.api.addAttachmentViewer('application/vnd.allure.image.diff', {
197
+ View: AttachmentView,
198
+ icon: 'fa fa-exchange',
199
+ });
200
+ })();
@@ -0,0 +1,30 @@
1
+ .screen-diff__switchers {
2
+ margin-bottom: 1em;
3
+ }
4
+
5
+ .screen-diff__switchers label + label {
6
+ margin-left: 1em;
7
+ }
8
+
9
+ .screen-diff__overlay {
10
+ position: relative;
11
+ cursor: col-resize;
12
+ }
13
+
14
+ .screen-diff__container {
15
+ overflow-x: auto;
16
+ }
17
+
18
+ .screen-diff__image-over {
19
+ top: 0;
20
+ left: 0;
21
+ bottom: 0;
22
+ background: #fff;
23
+ position: absolute;
24
+ overflow: hidden;
25
+ box-shadow: 2px 0 1px -1px #aaa;
26
+ }
27
+
28
+ .screen-diff-error {
29
+ color: #fd5a3e;
30
+ }