@helvetia-design/playwright 0.0.0-stage → 0.0.3

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 (76) hide show
  1. package/LICENSE +210 -0
  2. package/dist/src/index.js +8 -0
  3. package/dist/src/lib/components/accordion.po.js +74 -0
  4. package/dist/src/lib/components/app-footer.po.js +132 -0
  5. package/dist/src/lib/components/app-navbar.po.js +106 -0
  6. package/dist/src/lib/components/badge.po.js +32 -0
  7. package/dist/src/lib/components/brand-icon.po.js +13 -0
  8. package/dist/src/lib/components/button.po.js +86 -0
  9. package/dist/src/lib/components/card.po.js +148 -0
  10. package/dist/src/lib/components/carousel.po.js +92 -0
  11. package/dist/src/lib/components/checkbox.po.js +107 -0
  12. package/dist/src/lib/components/close.po.js +31 -0
  13. package/dist/src/lib/components/content.po.js +32 -0
  14. package/dist/src/lib/components/counter.po.js +121 -0
  15. package/dist/src/lib/components/data-item.po.js +235 -0
  16. package/dist/src/lib/components/data.po.js +110 -0
  17. package/dist/src/lib/components/datepicker.po.js +260 -0
  18. package/dist/src/lib/components/divider.po.js +10 -0
  19. package/dist/src/lib/components/drawer.po.js +55 -0
  20. package/dist/src/lib/components/file-upload.po.js +200 -0
  21. package/dist/src/lib/components/heading.po.js +32 -0
  22. package/dist/src/lib/components/hint.po.js +71 -0
  23. package/dist/src/lib/components/icon.po.js +13 -0
  24. package/dist/src/lib/components/index.js +49 -0
  25. package/dist/src/lib/components/input.po.js +107 -0
  26. package/dist/src/lib/components/label.po.js +32 -0
  27. package/dist/src/lib/components/list.po.js +68 -0
  28. package/dist/src/lib/components/logo.po.js +13 -0
  29. package/dist/src/lib/components/modal.po.js +97 -0
  30. package/dist/src/lib/components/notification.po.js +56 -0
  31. package/dist/src/lib/components/number-input.po.js +107 -0
  32. package/dist/src/lib/components/page-object.js +47 -0
  33. package/dist/src/lib/components/pagination.po.js +146 -0
  34. package/dist/src/lib/components/phone-input.po.js +302 -0
  35. package/dist/src/lib/components/popup.po.js +55 -0
  36. package/dist/src/lib/components/radio.po.js +89 -0
  37. package/dist/src/lib/components/root.po.js +32 -0
  38. package/dist/src/lib/components/segment.po.js +135 -0
  39. package/dist/src/lib/components/select.po.js +257 -0
  40. package/dist/src/lib/components/shape.po.js +10 -0
  41. package/dist/src/lib/components/sheet.po.js +88 -0
  42. package/dist/src/lib/components/slider.po.js +101 -0
  43. package/dist/src/lib/components/snackbar.po.js +115 -0
  44. package/dist/src/lib/components/spinner.po.js +13 -0
  45. package/dist/src/lib/components/stack.po.js +32 -0
  46. package/dist/src/lib/components/steps.po.js +112 -0
  47. package/dist/src/lib/components/tabs.po.js +110 -0
  48. package/dist/src/lib/components/tag.po.js +53 -0
  49. package/dist/src/lib/components/text.po.js +32 -0
  50. package/dist/src/lib/components/textarea.po.js +89 -0
  51. package/dist/src/lib/components/toast.po.js +92 -0
  52. package/dist/src/lib/components/toggle.po.js +107 -0
  53. package/dist/src/lib/components/tooltip.po.js +32 -0
  54. package/dist/src/lib/devices.js +6 -0
  55. package/dist/src/lib/extend.js +375 -0
  56. package/dist/src/lib/functions/a11y.js +31 -0
  57. package/dist/src/lib/matchers/index.js +12 -0
  58. package/dist/src/lib/matchers/to-have-first-received-event-detail.js +44 -0
  59. package/dist/src/lib/matchers/to-have-nth-received-event-detail.js +53 -0
  60. package/dist/src/lib/matchers/to-have-received-event-detail.js +44 -0
  61. package/dist/src/lib/matchers/to-have-received-event-times.js +33 -0
  62. package/dist/src/lib/matchers/to-have-received-event.js +33 -0
  63. package/dist/src/lib/page/event-spy.js +198 -0
  64. package/dist/src/lib/page/utils/goto.js +71 -0
  65. package/dist/src/lib/page/utils/index.js +6 -0
  66. package/dist/src/lib/page/utils/locator.js +38 -0
  67. package/dist/src/lib/page/utils/mount-ssr.js +118 -0
  68. package/dist/src/lib/page/utils/mount.js +70 -0
  69. package/dist/src/lib/page/utils/spy-on-event.js +34 -0
  70. package/dist/src/lib/page/utils/wait-for-changes.js +99 -0
  71. package/dist/src/lib/screenshot.js +13 -0
  72. package/dist/src/lib/test-expect.js +1 -0
  73. package/dist/src/lib/types.js +54 -0
  74. package/package.json +31 -3
  75. package/sbom.cdx.json +80470 -0
  76. package/README.md +0 -3
@@ -0,0 +1,148 @@
1
+ import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
2
+ import { _ as _inherits } from "@swc/helpers/_/_inherits";
3
+ import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
4
+ import { expect } from '@playwright/test';
5
+ import { PageObject } from './page-object';
6
+ export var DsCard = /*#__PURE__*/ function(PageObject) {
7
+ "use strict";
8
+ _inherits(DsCard, PageObject);
9
+ function DsCard(el) {
10
+ return PageObject.call(this, el) || this;
11
+ }
12
+ var _proto = DsCard.prototype;
13
+ _proto.assertToContainText = function assertToContainText(text) {
14
+ return _async_to_generator(function() {
15
+ return _ts_generator(this, function(_state) {
16
+ switch(_state.label){
17
+ case 0:
18
+ return [
19
+ 4,
20
+ expect(this.el).toContainText(text)
21
+ ];
22
+ case 1:
23
+ _state.sent();
24
+ return [
25
+ 2
26
+ ];
27
+ }
28
+ });
29
+ }).call(this);
30
+ };
31
+ return DsCard;
32
+ }(PageObject);
33
+ export var DsCardTitle = /*#__PURE__*/ function(PageObject) {
34
+ "use strict";
35
+ _inherits(DsCardTitle, PageObject);
36
+ function DsCardTitle(el) {
37
+ return PageObject.call(this, el) || this;
38
+ }
39
+ var _proto = DsCardTitle.prototype;
40
+ _proto.assertToContainText = function assertToContainText(text) {
41
+ return _async_to_generator(function() {
42
+ return _ts_generator(this, function(_state) {
43
+ switch(_state.label){
44
+ case 0:
45
+ return [
46
+ 4,
47
+ expect(this.el).toContainText(text)
48
+ ];
49
+ case 1:
50
+ _state.sent();
51
+ return [
52
+ 2
53
+ ];
54
+ }
55
+ });
56
+ }).call(this);
57
+ };
58
+ return DsCardTitle;
59
+ }(PageObject);
60
+ export var DsCardSubtitle = /*#__PURE__*/ function(PageObject) {
61
+ "use strict";
62
+ _inherits(DsCardSubtitle, PageObject);
63
+ function DsCardSubtitle(el) {
64
+ return PageObject.call(this, el) || this;
65
+ }
66
+ var _proto = DsCardSubtitle.prototype;
67
+ _proto.assertToContainText = function assertToContainText(text) {
68
+ return _async_to_generator(function() {
69
+ return _ts_generator(this, function(_state) {
70
+ switch(_state.label){
71
+ case 0:
72
+ return [
73
+ 4,
74
+ expect(this.el).toContainText(text)
75
+ ];
76
+ case 1:
77
+ _state.sent();
78
+ return [
79
+ 2
80
+ ];
81
+ }
82
+ });
83
+ }).call(this);
84
+ };
85
+ return DsCardSubtitle;
86
+ }(PageObject);
87
+ export var DsCardContent = /*#__PURE__*/ function(PageObject) {
88
+ "use strict";
89
+ _inherits(DsCardContent, PageObject);
90
+ function DsCardContent(el) {
91
+ return PageObject.call(this, el) || this;
92
+ }
93
+ var _proto = DsCardContent.prototype;
94
+ _proto.assertToContainText = function assertToContainText(text) {
95
+ return _async_to_generator(function() {
96
+ return _ts_generator(this, function(_state) {
97
+ switch(_state.label){
98
+ case 0:
99
+ return [
100
+ 4,
101
+ expect(this.el).toContainText(text)
102
+ ];
103
+ case 1:
104
+ _state.sent();
105
+ return [
106
+ 2
107
+ ];
108
+ }
109
+ });
110
+ }).call(this);
111
+ };
112
+ return DsCardContent;
113
+ }(PageObject);
114
+ export var DsCardActions = /*#__PURE__*/ function(PageObject) {
115
+ "use strict";
116
+ _inherits(DsCardActions, PageObject);
117
+ function DsCardActions(el) {
118
+ return PageObject.call(this, el) || this;
119
+ }
120
+ return DsCardActions;
121
+ }(PageObject);
122
+ export var DsCardHeader = /*#__PURE__*/ function(PageObject) {
123
+ "use strict";
124
+ _inherits(DsCardHeader, PageObject);
125
+ function DsCardHeader(el) {
126
+ return PageObject.call(this, el) || this;
127
+ }
128
+ var _proto = DsCardHeader.prototype;
129
+ _proto.assertToContainText = function assertToContainText(text) {
130
+ return _async_to_generator(function() {
131
+ return _ts_generator(this, function(_state) {
132
+ switch(_state.label){
133
+ case 0:
134
+ return [
135
+ 4,
136
+ expect(this.el).toContainText(text)
137
+ ];
138
+ case 1:
139
+ _state.sent();
140
+ return [
141
+ 2
142
+ ];
143
+ }
144
+ });
145
+ }).call(this);
146
+ };
147
+ return DsCardHeader;
148
+ }(PageObject);
@@ -0,0 +1,92 @@
1
+ import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
2
+ import { _ as _inherits } from "@swc/helpers/_/_inherits";
3
+ import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
4
+ import { expect } from '@playwright/test';
5
+ import { PageObject } from './page-object';
6
+ export var DsCarousel = /*#__PURE__*/ function(PageObject) {
7
+ "use strict";
8
+ _inherits(DsCarousel, PageObject);
9
+ function DsCarousel(el) {
10
+ return PageObject.call(this, el) || this;
11
+ }
12
+ var _proto = DsCarousel.prototype;
13
+ _proto.item = function item(name) {
14
+ return this.el.locator('ds-carousel-item[name="' + name + '"]');
15
+ };
16
+ _proto.dot = function dot(index) {
17
+ return this.el.locator('.dot').nth(index);
18
+ };
19
+ _proto.clickDot = function clickDot(index) {
20
+ return _async_to_generator(function() {
21
+ return _ts_generator(this, function(_state) {
22
+ switch(_state.label){
23
+ case 0:
24
+ return [
25
+ 4,
26
+ this.dot(index).click()
27
+ ];
28
+ case 1:
29
+ _state.sent();
30
+ return [
31
+ 2
32
+ ];
33
+ }
34
+ });
35
+ }).call(this);
36
+ };
37
+ _proto.selectItem = function selectItem(name) {
38
+ return _async_to_generator(function() {
39
+ return _ts_generator(this, function(_state) {
40
+ switch(_state.label){
41
+ case 0:
42
+ return [
43
+ 4,
44
+ this.item(name).click()
45
+ ];
46
+ case 1:
47
+ _state.sent();
48
+ return [
49
+ 2
50
+ ];
51
+ }
52
+ });
53
+ }).call(this);
54
+ };
55
+ _proto.assertItemSelected = function assertItemSelected(name) {
56
+ return _async_to_generator(function() {
57
+ return _ts_generator(this, function(_state) {
58
+ switch(_state.label){
59
+ case 0:
60
+ return [
61
+ 4,
62
+ expect(this.item(name)).toHaveAttribute('selected', '')
63
+ ];
64
+ case 1:
65
+ _state.sent();
66
+ return [
67
+ 2
68
+ ];
69
+ }
70
+ });
71
+ }).call(this);
72
+ };
73
+ _proto.assertItemNotSelected = function assertItemNotSelected(name) {
74
+ return _async_to_generator(function() {
75
+ return _ts_generator(this, function(_state) {
76
+ switch(_state.label){
77
+ case 0:
78
+ return [
79
+ 4,
80
+ expect(this.item(name)).not.toHaveAttribute('selected', '')
81
+ ];
82
+ case 1:
83
+ _state.sent();
84
+ return [
85
+ 2
86
+ ];
87
+ }
88
+ });
89
+ }).call(this);
90
+ };
91
+ return DsCarousel;
92
+ }(PageObject);
@@ -0,0 +1,107 @@
1
+ import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
2
+ import { _ as _inherits } from "@swc/helpers/_/_inherits";
3
+ import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
4
+ import { expect } from '@playwright/test';
5
+ import { PageObject } from './page-object';
6
+ export var DsCheckbox = /*#__PURE__*/ function(PageObject) {
7
+ "use strict";
8
+ _inherits(DsCheckbox, PageObject);
9
+ function DsCheckbox(el) {
10
+ var _this;
11
+ _this = PageObject.call(this, el) || this;
12
+ _this.nativeInput = el.locator('[part="input"]');
13
+ return _this;
14
+ }
15
+ var _proto = DsCheckbox.prototype;
16
+ _proto.check = function check() {
17
+ return _async_to_generator(function() {
18
+ return _ts_generator(this, function(_state) {
19
+ switch(_state.label){
20
+ case 0:
21
+ return [
22
+ 4,
23
+ this.nativeInput.check()
24
+ ];
25
+ case 1:
26
+ _state.sent();
27
+ return [
28
+ 2
29
+ ];
30
+ }
31
+ });
32
+ }).call(this);
33
+ };
34
+ _proto.uncheck = function uncheck() {
35
+ return _async_to_generator(function() {
36
+ return _ts_generator(this, function(_state) {
37
+ switch(_state.label){
38
+ case 0:
39
+ return [
40
+ 4,
41
+ this.nativeInput.uncheck()
42
+ ];
43
+ case 1:
44
+ _state.sent();
45
+ return [
46
+ 2
47
+ ];
48
+ }
49
+ });
50
+ }).call(this);
51
+ };
52
+ _proto.assertToBeChecked = function assertToBeChecked() {
53
+ return _async_to_generator(function() {
54
+ return _ts_generator(this, function(_state) {
55
+ switch(_state.label){
56
+ case 0:
57
+ return [
58
+ 4,
59
+ expect(this.nativeInput).toBeChecked()
60
+ ];
61
+ case 1:
62
+ _state.sent();
63
+ return [
64
+ 2
65
+ ];
66
+ }
67
+ });
68
+ }).call(this);
69
+ };
70
+ _proto.assertToBeUnchecked = function assertToBeUnchecked() {
71
+ return _async_to_generator(function() {
72
+ return _ts_generator(this, function(_state) {
73
+ switch(_state.label){
74
+ case 0:
75
+ return [
76
+ 4,
77
+ expect(this.nativeInput).not.toBeChecked()
78
+ ];
79
+ case 1:
80
+ _state.sent();
81
+ return [
82
+ 2
83
+ ];
84
+ }
85
+ });
86
+ }).call(this);
87
+ };
88
+ _proto.assertToBeDisabled = function assertToBeDisabled() {
89
+ return _async_to_generator(function() {
90
+ return _ts_generator(this, function(_state) {
91
+ switch(_state.label){
92
+ case 0:
93
+ return [
94
+ 4,
95
+ expect(this.nativeInput).toBeDisabled()
96
+ ];
97
+ case 1:
98
+ _state.sent();
99
+ return [
100
+ 2
101
+ ];
102
+ }
103
+ });
104
+ }).call(this);
105
+ };
106
+ return DsCheckbox;
107
+ }(PageObject);
@@ -0,0 +1,31 @@
1
+ import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
2
+ import { _ as _inherits } from "@swc/helpers/_/_inherits";
3
+ import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
4
+ import { PageObject } from './page-object';
5
+ export var DsClose = /*#__PURE__*/ function(PageObject) {
6
+ "use strict";
7
+ _inherits(DsClose, PageObject);
8
+ function DsClose(el) {
9
+ return PageObject.call(this, el) || this;
10
+ }
11
+ var _proto = DsClose.prototype;
12
+ _proto.click = function click() {
13
+ return _async_to_generator(function() {
14
+ return _ts_generator(this, function(_state) {
15
+ switch(_state.label){
16
+ case 0:
17
+ return [
18
+ 4,
19
+ this.el.click()
20
+ ];
21
+ case 1:
22
+ _state.sent();
23
+ return [
24
+ 2
25
+ ];
26
+ }
27
+ });
28
+ }).call(this);
29
+ };
30
+ return DsClose;
31
+ }(PageObject);
@@ -0,0 +1,32 @@
1
+ import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
2
+ import { _ as _inherits } from "@swc/helpers/_/_inherits";
3
+ import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
4
+ import { expect } from '@playwright/test';
5
+ import { PageObject } from './page-object';
6
+ export var DsContent = /*#__PURE__*/ function(PageObject) {
7
+ "use strict";
8
+ _inherits(DsContent, PageObject);
9
+ function DsContent(el) {
10
+ return PageObject.call(this, el) || this;
11
+ }
12
+ var _proto = DsContent.prototype;
13
+ _proto.assertToContainText = function assertToContainText(text) {
14
+ return _async_to_generator(function() {
15
+ return _ts_generator(this, function(_state) {
16
+ switch(_state.label){
17
+ case 0:
18
+ return [
19
+ 4,
20
+ expect(this.el).toContainText(text)
21
+ ];
22
+ case 1:
23
+ _state.sent();
24
+ return [
25
+ 2
26
+ ];
27
+ }
28
+ });
29
+ }).call(this);
30
+ };
31
+ return DsContent;
32
+ }(PageObject);
@@ -0,0 +1,121 @@
1
+ import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
2
+ import { _ as _inherits } from "@swc/helpers/_/_inherits";
3
+ import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
4
+ import { expect } from '@playwright/test';
5
+ import { PageObject } from './page-object';
6
+ export var DsCounter = /*#__PURE__*/ function(PageObject) {
7
+ "use strict";
8
+ _inherits(DsCounter, PageObject);
9
+ function DsCounter(el) {
10
+ var _this;
11
+ _this = PageObject.call(this, el) || this;
12
+ _this.counter = el.locator('[part="counter"]');
13
+ _this.decreaseButton = el.locator('[part="decrease"]');
14
+ _this.increaseButton = el.locator('[part="increase"]');
15
+ _this.valueDisplay = el.locator('[part="value"]');
16
+ return _this;
17
+ }
18
+ var _proto = DsCounter.prototype;
19
+ /**
20
+ * Waits out a macrotask tick so `dsChange`'s debounced (setTimeout(0)) emit has
21
+ * actually run before the returned promise resolves.
22
+ */ _proto.increase = function increase() {
23
+ return _async_to_generator(function() {
24
+ return _ts_generator(this, function(_state) {
25
+ switch(_state.label){
26
+ case 0:
27
+ return [
28
+ 4,
29
+ this.increaseButton.click()
30
+ ];
31
+ case 1:
32
+ _state.sent();
33
+ return [
34
+ 4,
35
+ this.el.evaluate(function() {
36
+ return new Promise(function(resolve) {
37
+ return setTimeout(resolve, 0);
38
+ });
39
+ })
40
+ ];
41
+ case 2:
42
+ _state.sent();
43
+ return [
44
+ 2
45
+ ];
46
+ }
47
+ });
48
+ }).call(this);
49
+ };
50
+ _proto.decrease = function decrease() {
51
+ return _async_to_generator(function() {
52
+ return _ts_generator(this, function(_state) {
53
+ switch(_state.label){
54
+ case 0:
55
+ return [
56
+ 4,
57
+ this.decreaseButton.click()
58
+ ];
59
+ case 1:
60
+ _state.sent();
61
+ return [
62
+ 4,
63
+ this.el.evaluate(function() {
64
+ return new Promise(function(resolve) {
65
+ return setTimeout(resolve, 0);
66
+ });
67
+ })
68
+ ];
69
+ case 2:
70
+ _state.sent();
71
+ return [
72
+ 2
73
+ ];
74
+ }
75
+ });
76
+ }).call(this);
77
+ };
78
+ _proto.assertValue = function assertValue(value) {
79
+ return _async_to_generator(function() {
80
+ return _ts_generator(this, function(_state) {
81
+ switch(_state.label){
82
+ case 0:
83
+ return [
84
+ 4,
85
+ expect(this.el).toHaveAttribute('value', value)
86
+ ];
87
+ case 1:
88
+ _state.sent();
89
+ return [
90
+ 2
91
+ ];
92
+ }
93
+ });
94
+ }).call(this);
95
+ };
96
+ _proto.assertToBeDisabled = function assertToBeDisabled() {
97
+ return _async_to_generator(function() {
98
+ return _ts_generator(this, function(_state) {
99
+ switch(_state.label){
100
+ case 0:
101
+ return [
102
+ 4,
103
+ expect(this.decreaseButton).toHaveAttribute('disabled', '')
104
+ ];
105
+ case 1:
106
+ _state.sent();
107
+ return [
108
+ 4,
109
+ expect(this.increaseButton).toHaveAttribute('disabled', '')
110
+ ];
111
+ case 2:
112
+ _state.sent();
113
+ return [
114
+ 2
115
+ ];
116
+ }
117
+ });
118
+ }).call(this);
119
+ };
120
+ return DsCounter;
121
+ }(PageObject);