@atomic-testing/playwright 0.28.0 → 0.30.0
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.
|
@@ -17,13 +17,13 @@ class PlaywrightInteractor {
|
|
|
17
17
|
}
|
|
18
18
|
selectOptionValue(locator, values) {
|
|
19
19
|
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
const cssLocator = core_1.locatorUtil.toCssSelector(locator);
|
|
20
|
+
const cssLocator = yield core_1.locatorUtil.toCssSelector(locator, this);
|
|
21
21
|
yield this.page.locator(cssLocator).selectOption(values);
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
getInputValue(locator) {
|
|
25
25
|
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
const cssLocator = core_1.locatorUtil.toCssSelector(locator);
|
|
26
|
+
const cssLocator = yield core_1.locatorUtil.toCssSelector(locator, this);
|
|
27
27
|
return this.page.locator(cssLocator).inputValue();
|
|
28
28
|
});
|
|
29
29
|
}
|
|
@@ -31,7 +31,7 @@ class PlaywrightInteractor {
|
|
|
31
31
|
return __awaiter(this, void 0, void 0, function* () {
|
|
32
32
|
const optionLocator = (0, core_1.byCssSelector)('option:checked');
|
|
33
33
|
const selectedOptionLocator = core_1.locatorUtil.append(locator, optionLocator);
|
|
34
|
-
const cssLocator = core_1.locatorUtil.toCssSelector(selectedOptionLocator);
|
|
34
|
+
const cssLocator = yield core_1.locatorUtil.toCssSelector(selectedOptionLocator, this);
|
|
35
35
|
const allOptions = yield this.page.locator(cssLocator).all();
|
|
36
36
|
const values = [];
|
|
37
37
|
for (const option of allOptions) {
|
|
@@ -47,7 +47,7 @@ class PlaywrightInteractor {
|
|
|
47
47
|
return __awaiter(this, void 0, void 0, function* () {
|
|
48
48
|
const optionLocator = (0, core_1.byCssSelector)('option:checked');
|
|
49
49
|
const selectedOptionLocator = core_1.locatorUtil.append(locator, optionLocator);
|
|
50
|
-
const cssLocator = core_1.locatorUtil.toCssSelector(selectedOptionLocator);
|
|
50
|
+
const cssLocator = yield core_1.locatorUtil.toCssSelector(selectedOptionLocator, this);
|
|
51
51
|
const allOptions = yield this.page.locator(cssLocator).all();
|
|
52
52
|
const labels = [];
|
|
53
53
|
for (const option of allOptions) {
|
|
@@ -61,7 +61,7 @@ class PlaywrightInteractor {
|
|
|
61
61
|
}
|
|
62
62
|
getStyleValue(locator, propertyName) {
|
|
63
63
|
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
const cssLocator = core_1.locatorUtil.toCssSelector(locator);
|
|
64
|
+
const cssLocator = yield core_1.locatorUtil.toCssSelector(locator, this);
|
|
65
65
|
const elLocator = this.page.locator(cssLocator);
|
|
66
66
|
const value = yield elLocator.evaluate((element, prop) => {
|
|
67
67
|
return window.getComputedStyle(element).getPropertyValue(prop);
|
|
@@ -71,7 +71,7 @@ class PlaywrightInteractor {
|
|
|
71
71
|
}
|
|
72
72
|
enterText(locator, text, option) {
|
|
73
73
|
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
-
const cssLocator = core_1.locatorUtil.toCssSelector(locator);
|
|
74
|
+
const cssLocator = yield core_1.locatorUtil.toCssSelector(locator, this);
|
|
75
75
|
if (!(option === null || option === void 0 ? void 0 : option.append)) {
|
|
76
76
|
yield this.page.locator(cssLocator).clear();
|
|
77
77
|
}
|
|
@@ -80,13 +80,13 @@ class PlaywrightInteractor {
|
|
|
80
80
|
}
|
|
81
81
|
click(locator, option) {
|
|
82
82
|
return __awaiter(this, void 0, void 0, function* () {
|
|
83
|
-
const cssLocator = core_1.locatorUtil.toCssSelector(locator);
|
|
83
|
+
const cssLocator = yield core_1.locatorUtil.toCssSelector(locator, this);
|
|
84
84
|
yield this.page.locator(cssLocator).click();
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
87
|
hover(locator) {
|
|
88
88
|
return __awaiter(this, void 0, void 0, function* () {
|
|
89
|
-
const cssLocator = core_1.locatorUtil.toCssSelector(locator);
|
|
89
|
+
const cssLocator = yield core_1.locatorUtil.toCssSelector(locator, this);
|
|
90
90
|
yield this.page.locator(cssLocator).hover();
|
|
91
91
|
});
|
|
92
92
|
}
|
|
@@ -95,7 +95,7 @@ class PlaywrightInteractor {
|
|
|
95
95
|
}
|
|
96
96
|
getAttribute(locator, name, isMultiple) {
|
|
97
97
|
return __awaiter(this, void 0, void 0, function* () {
|
|
98
|
-
const cssLocator = core_1.locatorUtil.toCssSelector(locator);
|
|
98
|
+
const cssLocator = yield core_1.locatorUtil.toCssSelector(locator, this);
|
|
99
99
|
const elLocator = this.page.locator(cssLocator);
|
|
100
100
|
if (isMultiple) {
|
|
101
101
|
const locators = yield elLocator.all();
|
|
@@ -114,28 +114,28 @@ class PlaywrightInteractor {
|
|
|
114
114
|
}
|
|
115
115
|
getText(locator) {
|
|
116
116
|
return __awaiter(this, void 0, void 0, function* () {
|
|
117
|
-
const cssLocator = core_1.locatorUtil.toCssSelector(locator);
|
|
117
|
+
const cssLocator = yield core_1.locatorUtil.toCssSelector(locator, this);
|
|
118
118
|
const text = yield this.page.locator(cssLocator).textContent();
|
|
119
119
|
return text !== null && text !== void 0 ? text : undefined;
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
122
|
exists(locator) {
|
|
123
123
|
return __awaiter(this, void 0, void 0, function* () {
|
|
124
|
-
const cssLocator = core_1.locatorUtil.toCssSelector(locator);
|
|
124
|
+
const cssLocator = yield core_1.locatorUtil.toCssSelector(locator, this);
|
|
125
125
|
const count = yield this.page.locator(cssLocator).count();
|
|
126
126
|
return count > 0;
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
129
|
isChecked(locator) {
|
|
130
130
|
return __awaiter(this, void 0, void 0, function* () {
|
|
131
|
-
const cssLocator = core_1.locatorUtil.toCssSelector(locator);
|
|
131
|
+
const cssLocator = yield core_1.locatorUtil.toCssSelector(locator, this);
|
|
132
132
|
const checked = yield this.page.locator(cssLocator).isChecked();
|
|
133
133
|
return checked;
|
|
134
134
|
});
|
|
135
135
|
}
|
|
136
136
|
isDisabled(locator) {
|
|
137
137
|
return __awaiter(this, void 0, void 0, function* () {
|
|
138
|
-
const cssLocator = core_1.locatorUtil.toCssSelector(locator);
|
|
138
|
+
const cssLocator = yield core_1.locatorUtil.toCssSelector(locator, this);
|
|
139
139
|
const isDisabled = yield this.page.locator(cssLocator).isDisabled();
|
|
140
140
|
return isDisabled;
|
|
141
141
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlaywrightInteractor.js","sourceRoot":"","sources":["../src/PlaywrightInteractor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAU8B;AAG9B,MAAa,oBAAoB;IAC/B,YAA4B,IAAU;QAAV,SAAI,GAAJ,IAAI,CAAM;IAAG,CAAC;IAEpC,iBAAiB,CAAC,OAAoB,EAAE,MAAgB;;YAC5D,MAAM,UAAU,GAAG,kBAAW,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"PlaywrightInteractor.js","sourceRoot":"","sources":["../src/PlaywrightInteractor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAU8B;AAG9B,MAAa,oBAAoB;IAC/B,YAA4B,IAAU;QAAV,SAAI,GAAJ,IAAI,CAAM;IAAG,CAAC;IAEpC,iBAAiB,CAAC,OAAoB,EAAE,MAAgB;;YAC5D,MAAM,UAAU,GAAG,MAAM,kBAAW,CAAC,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;YAClE,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QAC3D,CAAC;KAAA;IAEK,aAAa,CAAC,OAAoB;;YACtC,MAAM,UAAU,GAAG,MAAM,kBAAW,CAAC,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;YAClE,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,UAAU,EAAE,CAAC;QACpD,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adapter",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"url": "https://github.com/atomic-testing/atomic-testing.git"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@atomic-testing/core": "0.
|
|
19
|
-
"@atomic-testing/test-runner": "0.
|
|
18
|
+
"@atomic-testing/core": "0.30.0",
|
|
19
|
+
"@atomic-testing/test-runner": "0.30.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@playwright/test": "^1.32.1",
|
|
@@ -15,19 +15,19 @@ export class PlaywrightInteractor implements Interactor {
|
|
|
15
15
|
constructor(public readonly page: Page) {}
|
|
16
16
|
|
|
17
17
|
async selectOptionValue(locator: PartLocator, values: string[]): Promise<void> {
|
|
18
|
-
const cssLocator = locatorUtil.toCssSelector(locator);
|
|
18
|
+
const cssLocator = await locatorUtil.toCssSelector(locator, this);
|
|
19
19
|
await this.page.locator(cssLocator).selectOption(values);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
async getInputValue(locator: PartLocator): Promise<Optional<string>> {
|
|
23
|
-
const cssLocator = locatorUtil.toCssSelector(locator);
|
|
23
|
+
const cssLocator = await locatorUtil.toCssSelector(locator, this);
|
|
24
24
|
return this.page.locator(cssLocator).inputValue();
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
async getSelectValues(locator: PartLocator): Promise<Optional<readonly string[]>> {
|
|
28
28
|
const optionLocator: PartLocator = byCssSelector('option:checked');
|
|
29
29
|
const selectedOptionLocator = locatorUtil.append(locator, optionLocator);
|
|
30
|
-
const cssLocator = locatorUtil.toCssSelector(selectedOptionLocator);
|
|
30
|
+
const cssLocator = await locatorUtil.toCssSelector(selectedOptionLocator, this);
|
|
31
31
|
const allOptions = await this.page.locator(cssLocator).all();
|
|
32
32
|
const values: string[] = [];
|
|
33
33
|
for (const option of allOptions) {
|
|
@@ -42,7 +42,7 @@ export class PlaywrightInteractor implements Interactor {
|
|
|
42
42
|
async getSelectLabels(locator: PartLocator): Promise<Optional<readonly string[]>> {
|
|
43
43
|
const optionLocator: PartLocator = byCssSelector('option:checked');
|
|
44
44
|
const selectedOptionLocator = locatorUtil.append(locator, optionLocator);
|
|
45
|
-
const cssLocator = locatorUtil.toCssSelector(selectedOptionLocator);
|
|
45
|
+
const cssLocator = await locatorUtil.toCssSelector(selectedOptionLocator, this);
|
|
46
46
|
const allOptions = await this.page.locator(cssLocator).all();
|
|
47
47
|
const labels: string[] = [];
|
|
48
48
|
for (const option of allOptions) {
|
|
@@ -55,7 +55,7 @@ export class PlaywrightInteractor implements Interactor {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
async getStyleValue(locator: PartLocator, propertyName: CssProperty): Promise<Optional<string>> {
|
|
58
|
-
const cssLocator = locatorUtil.toCssSelector(locator);
|
|
58
|
+
const cssLocator = await locatorUtil.toCssSelector(locator, this);
|
|
59
59
|
const elLocator = this.page.locator(cssLocator);
|
|
60
60
|
const value = await elLocator.evaluate((element, prop) => {
|
|
61
61
|
return window.getComputedStyle(element).getPropertyValue(prop as string);
|
|
@@ -64,7 +64,7 @@ export class PlaywrightInteractor implements Interactor {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
async enterText(locator: PartLocator, text: string, option?: Optional<Partial<EnterTextOption>>): Promise<void> {
|
|
67
|
-
const cssLocator = locatorUtil.toCssSelector(locator);
|
|
67
|
+
const cssLocator = await locatorUtil.toCssSelector(locator, this);
|
|
68
68
|
if (!option?.append) {
|
|
69
69
|
await this.page.locator(cssLocator).clear();
|
|
70
70
|
}
|
|
@@ -72,12 +72,12 @@ export class PlaywrightInteractor implements Interactor {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
async click(locator: PartLocator, option?: ClickOption): Promise<void> {
|
|
75
|
-
const cssLocator = locatorUtil.toCssSelector(locator);
|
|
75
|
+
const cssLocator = await locatorUtil.toCssSelector(locator, this);
|
|
76
76
|
await this.page.locator(cssLocator).click();
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
async hover(locator: PartLocator): Promise<void> {
|
|
80
|
-
const cssLocator = locatorUtil.toCssSelector(locator);
|
|
80
|
+
const cssLocator = await locatorUtil.toCssSelector(locator, this);
|
|
81
81
|
await this.page.locator(cssLocator).hover();
|
|
82
82
|
}
|
|
83
83
|
|
|
@@ -93,7 +93,7 @@ export class PlaywrightInteractor implements Interactor {
|
|
|
93
93
|
name: string,
|
|
94
94
|
isMultiple?: boolean,
|
|
95
95
|
): Promise<Optional<string> | readonly string[]> {
|
|
96
|
-
const cssLocator = locatorUtil.toCssSelector(locator);
|
|
96
|
+
const cssLocator = await locatorUtil.toCssSelector(locator, this);
|
|
97
97
|
const elLocator = this.page.locator(cssLocator);
|
|
98
98
|
if (isMultiple) {
|
|
99
99
|
const locators = await elLocator.all();
|
|
@@ -111,25 +111,25 @@ export class PlaywrightInteractor implements Interactor {
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
async getText(locator: PartLocator): Promise<Optional<string>> {
|
|
114
|
-
const cssLocator = locatorUtil.toCssSelector(locator);
|
|
114
|
+
const cssLocator = await locatorUtil.toCssSelector(locator, this);
|
|
115
115
|
const text = await this.page.locator(cssLocator).textContent();
|
|
116
116
|
return text ?? undefined;
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
async exists(locator: PartLocator): Promise<boolean> {
|
|
120
|
-
const cssLocator = locatorUtil.toCssSelector(locator);
|
|
120
|
+
const cssLocator = await locatorUtil.toCssSelector(locator, this);
|
|
121
121
|
const count = await this.page.locator(cssLocator).count();
|
|
122
122
|
return count > 0;
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
async isChecked(locator: PartLocator): Promise<boolean> {
|
|
126
|
-
const cssLocator = locatorUtil.toCssSelector(locator);
|
|
126
|
+
const cssLocator = await locatorUtil.toCssSelector(locator, this);
|
|
127
127
|
const checked = await this.page.locator(cssLocator).isChecked();
|
|
128
128
|
return checked;
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
async isDisabled(locator: PartLocator): Promise<boolean> {
|
|
132
|
-
const cssLocator = locatorUtil.toCssSelector(locator);
|
|
132
|
+
const cssLocator = await locatorUtil.toCssSelector(locator, this);
|
|
133
133
|
const isDisabled = await this.page.locator(cssLocator).isDisabled();
|
|
134
134
|
return isDisabled;
|
|
135
135
|
}
|