@actionlogementservices/wdio-test-context 1.0.0 → 1.0.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@actionlogementservices/wdio-test-context",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "A framework to add test context to webdriverio end to end tests.",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -139,11 +139,12 @@ export default class Page {
139
139
  * **Retrieves the list of values** of the specified **select** css selector.
140
140
  * Waits during the specified (or default) timeout **before throwing error**.
141
141
  * @param {string} css css selector of the select
142
+ * @param {number} [childrenCount] optional count of children to wait for (default 1)
142
143
  * @param {number} [timeout] optional timeout before throwing error
143
144
  * @returns {Promise<string[]>} the corresponding values
144
145
  */
145
- async getOptions(css, timeout = TIMEOUT) {
146
- await this.waitElementHasChildren(css, timeout);
146
+ async getSelectOptions(css, childrenCount = 1, timeout = TIMEOUT) {
147
+ await this.waitElementHasChildren(`${css} option`, childrenCount, timeout);
147
148
  const options = await $$(`${css} option`).getElements();
148
149
  // le tableau des options
149
150
  const items = [];
@@ -158,11 +159,12 @@ export default class Page {
158
159
  * **Retrieves the selected text** of the specified **select** css selector.
159
160
  * Waits during the specified (or default) timeout **before throwing error**.
160
161
  * @param {string} css css selector of the select
162
+ * @param {number} [childrenCount] optional count of children to wait for (default 1)
161
163
  * @param {number} [timeout] optional timeout before throwing error
162
164
  * @returns {Promise<string>} the corresponding text
163
165
  */
164
- async getSelectedText(css, timeout = TIMEOUT) {
165
- await this.waitElementHasChildren(css, timeout);
166
+ async getSelectSelectedText(css, childrenCount = 1, timeout = TIMEOUT) {
167
+ await this.waitElementHasChildren(`${css} option`, childrenCount, timeout);
166
168
  return $(`${css} option:checked`).getText();
167
169
  }
168
170
 
@@ -170,11 +172,12 @@ export default class Page {
170
172
  * **Retrieves the selected value** of the specified **select** css selector.
171
173
  * Waits during the specified (or default) timeout **before throwing error**.
172
174
  * @param {string} css css selector of the select
175
+ * @param {number} [childrenCount] optional count of children to wait for (default 1)
173
176
  * @param {number} [timeout] optional timeout before throwing error
174
177
  * @returns {Promise<string>} the corresponding text
175
178
  */
176
- async getSelectedValue(css, timeout = TIMEOUT) {
177
- await this.waitElementHasChildren(css, timeout);
179
+ async getSelectSelectedValue(css, childrenCount = 1, timeout = TIMEOUT) {
180
+ await this.waitElementHasChildren(`${css} option`, childrenCount, timeout);
178
181
  return $(`${css} option:checked`).getValue();
179
182
  }
180
183
 
@@ -319,7 +322,7 @@ export default class Page {
319
322
  /**
320
323
  * **Waits until the element** specified by the css selector **has children**.
321
324
  * **Throws an error** after the specified (or default) timeout has expired.
322
- * @param {string} css css selector
325
+ * @param {string} css css selector that contains children
323
326
  * @param {number} [childrenCount] optional count of children to wait for (default 1)
324
327
  * @param {number} [timeout] optional timeout before throwing error
325
328
  * @returns {Promise<boolean>} true if condition is fullfilled