Skip to content

Commit

Permalink
Merge pull request #86 from ShellyDCMS/remove-focus-from-type
Browse files Browse the repository at this point in the history
remove focus from type methods
  • Loading branch information
ShellyDCMS committed Apr 30, 2024
2 parents 5616080 + 2f8d035 commit 754422d
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 26 deletions.
47 changes: 31 additions & 16 deletions documents/classes/Assertable.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[@shellygo/cypress-test-utils - v2.0.54](../README.md) / [Modules](../modules.md) / Assertable
[@shellygo/cypress-test-utils - v2.0.56](../README.md) / [Modules](../modules.md) / Assertable

# Class: Assertable<T\>

Expand Down Expand Up @@ -67,10 +67,10 @@ class Driver {
- [shouldBeDisabled](Assertable.md#shouldbedisabled)
- [shouldBeEnabled](Assertable.md#shouldbeenabled)
- [shouldBeFocused](Assertable.md#shouldbefocused)
- [shouldBeGreaterThen](Assertable.md#shouldbegreaterthen)
- [shouldBeGreaterThenOrEqual](Assertable.md#shouldbegreaterthenorequal)
- [shouldBeLessThen](Assertable.md#shouldbelessthen)
- [shouldBeLessThenOrEqual](Assertable.md#shouldbelessthenorequal)
- [shouldBeGreaterThan](Assertable.md#shouldbegreaterthan)
- [shouldBeGreaterThanOrEqual](Assertable.md#shouldbegreaterthanorequal)
- [shouldBeLessThan](Assertable.md#shouldbelessthan)
- [shouldBeLessThanOrEqual](Assertable.md#shouldbelessthanorequal)
- [shouldBeSelected](Assertable.md#shouldbeselected)
- [shouldBeVisible](Assertable.md#shouldbevisible)
- [shouldContainText](Assertable.md#shouldcontaintext)
Expand Down Expand Up @@ -219,9 +219,9 @@ then(get.elementByTestId("selector")).shouldBeFocused()

___

### shouldBeGreaterThen
### shouldBeGreaterThan

**shouldBeGreaterThen**(`value`): `Chainable`<`T`\>
**shouldBeGreaterThan**(`value`): `Chainable`<`T`\>

Asserts that the target is a number or a date greater than the given number or date n respectively.
However, it's often best to assert that the target is equal to its expected value.
Expand All @@ -239,14 +239,14 @@ However, it's often best to assert that the target is equal to its expected valu
**`Example`**

```ts
then(get.numberOfElements("radio")).shouldBeGreaterThen(5);
then(get.numberOfElements("radio")).shouldBeGreaterThan(5);
```

___

### shouldBeGreaterThenOrEqual
### shouldBeGreaterThanOrEqual

**shouldBeGreaterThenOrEqual**(`value`): `Chainable`<`T`\>
**shouldBeGreaterThanOrEqual**(`value`): `Chainable`<`T`\>

Asserts that the target is a number or a date greater than or equal to the given number or date n respectively. However, it's often best to assert that the target is equal to its expected value.

Expand All @@ -263,14 +263,14 @@ Asserts that the target is a number or a date greater than or equal to the given
**`Example`**

```ts
then(get.numberOfElements("radio")).shouldBeGreaterThenOrEqual(5);
then(get.numberOfElements("radio")).shouldBeGreaterThanOrEqual(5);
```

___

### shouldBeLessThen
### shouldBeLessThan

**shouldBeLessThen**(`value`): `Chainable`<`T`\>
**shouldBeLessThan**(`value`): `Chainable`<`T`\>

Asserts that the target is a number or a n date less than or equal to the given number or date n respectively. However, it's often best to assert that the target is equal to its expected value.

Expand All @@ -292,9 +292,9 @@ Asserts that the target is a number or a n date less than or equal to the given

___

### shouldBeLessThenOrEqual
### shouldBeLessThanOrEqual

**shouldBeLessThenOrEqual**(`value`): `Chainable`<`T`\>
**shouldBeLessThanOrEqual**(`value`): `Chainable`<`T`\>

Asserts that the target is a number or a date less than or equal to the given number or date n respectively.
However, it's often best to assert that the target is equal to its expected value.
Expand All @@ -312,7 +312,7 @@ However, it's often best to assert that the target is equal to its expected valu
**`Example`**

```ts
then(get.numberOfElements('list-item')).shouldBeLessThenOrEqual(5)
then(get.numberOfElements('list-item')).shouldBeLessThanOrEqual(5)
```

___
Expand Down Expand Up @@ -673,6 +673,21 @@ Assert spy was called with matching arguments (and possibly others).
then(get.spy("onSomething")).shouldHaveBeenCalledWithMatch(match({ id: 1 }))
```
**`Example`**
```ts
it('should call the get method of the HTTP client with a URL with query param filter = status', () => {
healthService.fetchHealthResults(status);
then(get.mock.httpClientService().get).shouldHaveBeenCalledWith(
match(baseURL),
match.hasNested(
'params.updates[0]',
match({ param: 'filter', value: `status eq ${status}` })
)
);
});
```
___
### shouldHaveClass
Expand Down
2 changes: 1 addition & 1 deletion documents/classes/CypressAngularComponentHelper.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[@shellygo/cypress-test-utils - v2.0.54](../README.md) / [Modules](../modules.md) / CypressAngularComponentHelper
[@shellygo/cypress-test-utils - v2.0.56](../README.md) / [Modules](../modules.md) / CypressAngularComponentHelper

# Class: CypressAngularComponentHelper<T\>

Expand Down
2 changes: 1 addition & 1 deletion documents/classes/CypressHelper.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[@shellygo/cypress-test-utils - v2.0.54](../README.md) / [Modules](../modules.md) / CypressHelper
[@shellygo/cypress-test-utils - v2.0.56](../README.md) / [Modules](../modules.md) / CypressHelper

# Class: CypressHelper

Expand Down
2 changes: 1 addition & 1 deletion documents/classes/CypressHelperOptions.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[@shellygo/cypress-test-utils - v2.0.54](../README.md) / [Modules](../modules.md) / CypressHelperOptions
[@shellygo/cypress-test-utils - v2.0.56](../README.md) / [Modules](../modules.md) / CypressHelperOptions

# Class: CypressHelperOptions

Expand Down
2 changes: 1 addition & 1 deletion documents/classes/CypressLitComponentHelper.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[@shellygo/cypress-test-utils - v2.0.54](../README.md) / [Modules](../modules.md) / CypressLitComponentHelper
[@shellygo/cypress-test-utils - v2.0.56](../README.md) / [Modules](../modules.md) / CypressLitComponentHelper

# Class: CypressLitComponentHelper

Expand Down
2 changes: 1 addition & 1 deletion documents/classes/CypressReactComponentHelper.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[@shellygo/cypress-test-utils - v2.0.54](../README.md) / [Modules](../modules.md) / CypressReactComponentHelper
[@shellygo/cypress-test-utils - v2.0.56](../README.md) / [Modules](../modules.md) / CypressReactComponentHelper

# Class: CypressReactComponentHelper

Expand Down
4 changes: 2 additions & 2 deletions documents/modules.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[@shellygo/cypress-test-utils - v2.0.54](README.md) / Modules
[@shellygo/cypress-test-utils - v2.0.56](README.md) / Modules

# @shellygo/cypress-test-utils - v2.0.54
# @shellygo/cypress-test-utils - v2.0.56

## Table of contents

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@shellygo/cypress-test-utils",
"description": "Cypress Test Automation Utilities",
"version": "2.0.55",
"version": "2.0.56",
"author": "Shelly Goldblit",
"private": false,
"license": "MIT",
Expand Down
14 changes: 14 additions & 0 deletions src/assertable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,20 @@ export class Assertable<T> {
* ```ts
* then(get.spy("onSomething")).shouldHaveBeenCalledWithMatch(match({ id: 1 }))
* ```
*
* @example
* ```ts
* it('should call the get method of the HTTP client with a URL with query param filter = status', () => {
* healthService.fetchHealthResults(status);
* then(get.mock.httpClientService().get).shouldHaveBeenCalledWith(
* match(baseURL),
* match.hasNested(
* 'params.updates[0]',
* match({ param: 'filter', value: `status eq ${status}` })
* )
* );
* });
* ```
*/
public shouldHaveBeenCalledWithMatch = (...args: any[]) =>
this.chainable.should("have.been.calledWithMatch", ...args);
Expand Down
3 changes: 1 addition & 2 deletions src/cypress-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,6 @@ export class CypressHelper {
type: (dataTestID: string, keys: string, index?: number) =>
this.get
.elementByTestId(dataTestID, index)
.focus()
.type(keys, { parseSpecialCharSequences: false }),

/**
Expand All @@ -520,7 +519,7 @@ export class CypressHelper {
* ```
*/
typeSpecialCharacter: (dataTestID: string, keys: string, index?: number) =>
this.get.elementByTestId(dataTestID, index).focus().type(keys),
this.get.elementByTestId(dataTestID, index).type(keys),

/**
* Runs a sequence of native press event (via cy.press) Type event is global. Make sure that it is not attached to any field.
Expand Down

0 comments on commit 754422d

Please sign in to comment.