You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Code review + make Be/Browser matchers test type safe
Mock default option to speed up tests
Better way to speed-up tests
Add tests around default options
Fix $$ mock
Ensure matcherName is corectly passed + toExists test correctly
Reinforce and test `isElementArray`
Add missing coverage for `executeCommand`
Migrate test of toBeArraySize + add more robust util
- Migrate + add coverage for `toBeElementsArrayOfSize` matcher
- Fix wait not correctly considered in `toBeElementsArrayOfSize`
- Reinforce isElementArray and similar + add more coverage
- By default for `DEFAULT_OPTIONS`use a non 0 wait time
- Fix global mock missing element.parent
Add note on element not found + add potential case to support
Add edge cases
Add alternative with parametrized in aPI doc
Gracefully fails on invalid element types
With selector fixed add back Promise of elements case
Code review
Code review + add unsupported type to toBe matchers
Code review
Add unsupported type test coverage
Code review + add coverage + better awaitElement mechanism
Add asymmetric integration tests
Code review & coverage
Add more tests for toHaveAttribute
Array of array is not supported so adapting test for today
Review some TODOs
Support better failure msg for multiple results in toBe Matchers
Properly handle failure colored message for `.no` for multiple elementst
Properly support equal for NumberOptions and .not multiple values failure
Code review
Review coverage for formatMessage + numberOptions
Fix 0 not stringily correctly
Add .not elements integration tests
Add coverage
Review docs
Finalize `executeCommandBe` tests
Increase coverage
More stable tests
test
Add `toHaveText` non-indexed + non-strict length legacy behavior
Test more unknown expected type, but maybe some bug?
Use supported type instead of unknown for `toHaveElementProperty`
Add case of element not found which throws for single element
- Note that for multiple element so ElementArray, there is no exception but an empty array
Add missing element case and index out of bound from `$()[x]`
Review refresh test after rebase
- Ensure we return non modified args elements
All element matchers work with arrays of elements (e.g., `$$()` results).
4
-
-**Strict Length Matching**: If you provide an array of expected values, the number of values must match the number of elements found. A failure occurs if the lengths differ.
5
-
-**Index-based Matching**: When using an array of expected values, each element is compared to the value at the corresponding index.
6
-
-**Single Value Matching**: If you provide a single expected value, it is compared against *every* element in the array.
7
-
-**Asymmetric Matchers**: Asymmetric matchers can be used within the expected values array for more matching flexibility.
8
-
- If no elements exist, a failure occurs (except with `toBeElementsArrayOfSize`).
9
-
- Options like `StringOptions` or `HTMLOptions` apply to the entire array (except `NumberOptions`).
10
-
- The assertion passes only if **all** elements match the expected value(s).
11
-
- Using `.not` applies the negation to each element (e.g., *all* elements must *not* display).
3
+
Matchers element array support (e.g., `$$()`):
12
4
13
-
**Note:** Strict length matching does not apply on `toHaveText` to preserve existing behavior.
5
+
-**Strict Index-based Matching**: If an array of expected values is provided, it must match the elements' count; each value is checked at its index.
6
+
- If a single value is provided, every element is compared to it.
7
+
- Asymmetric matchers (e.g., `expect.stringContaining`) work within expected value arrays.
8
+
- An error is thrown if no elements are found (except with `toBeElementsArrayOfSize`).
9
+
- Options like `StringOptions` or `HTMLOptions` apply to the whole array; `NumberOptions` behaves like any expected provided value.
10
+
- The assertion passes only if **all** elements match.
11
+
- Using `.not` means all elements must **not** match.
12
+
13
+
**Note:** Strict Index-based matching does not apply to `toHaveText`, since an existing behavior was already in placed.
14
14
15
15
## Limitations
16
-
- An alternative to using `StringOptions` (like `ignoreCase` or `containing`) for a single expected value is to use RegEx (`/MyExample/i`) or Asymmetric Matchers (`expect.stringContaining('Example')`).
17
-
- Passing an array of "containing" values, as previously supported by `toHaveText`, is deprecated and not supported for other matchers.
16
+
- Instead of `StringOptions` for a single expected value, use RegExp or asymmetric matchers.
17
+
- For `ignoreCase` use RegEx (`/MyExample/i`)
18
+
- For `containing` use Asymmetric Matchers (`expect.stringContaining('Example')`)
19
+
- Passing an array of "containing" values is deprecated and not supported outside `toHaveText`.
18
20
19
21
## Supported types
20
-
21
-
Any of the below element types can be passed to `expect`:
22
+
You can pass any of these element types to `expect`:
22
23
-`ChainablePromiseArray` (the non-awaited case)
23
24
-`ElementArray` (the awaited case)
24
25
-`Element[]` (the filtered case)
26
+
27
+
## Alternative
28
+
29
+
For more granular or explicit per-element validation, use a parameterized test of your framework.
30
+
Example in Mocha:
31
+
```ts
32
+
describe('Element at index of `$$`', function () {
33
+
[ { expectedText: 'one', index: 0 },
34
+
{ expectedText: 'two', index: 2 },
35
+
{ expectedText: 'four', index: 4 },
36
+
].forEach(function ( { expectedText, index } ) {
37
+
it("Element at $index of `$$('label')` is $expectedText", function () {
0 commit comments