-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(assertions): add "Then I see pathname" & "Then I see pathname co…
…ntains"
- Loading branch information
1 parent
2f30859
commit 6a64b96
Showing
2 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './hash'; | ||
export * from './location'; | ||
export * from './pathname'; | ||
export * from './search'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { DataTable, Then } from '@badeball/cypress-cucumber-preprocessor'; | ||
|
||
import { getOptions } from '../../utils'; | ||
|
||
/** | ||
* Then I see pathname: | ||
* | ||
* ```gherkin | ||
* Then I see pathname {string} | ||
* ``` | ||
* | ||
* @example | ||
* | ||
* ```gherkin | ||
* Then I see pathname "/pathname" | ||
* ``` | ||
* | ||
* With [options](https://docs.cypress.io/api/commands/location#Arguments): | ||
* | ||
* ```gherkin | ||
* Then I see pathname "/pathname" | ||
* | log | true | | ||
* | timeout | 4000 | | ||
* ``` | ||
* | ||
* @see | ||
* | ||
* - {@link Then_I_see_pathname_contains | Then I see pathname contains} | ||
*/ | ||
export function Then_I_see_pathname(pathname: string, options?: DataTable) { | ||
cy.location(getOptions(options)).should((location) => { | ||
expect(location.pathname).to.equal(pathname); | ||
}); | ||
} | ||
|
||
Then('I see pathname {string}', Then_I_see_pathname); | ||
|
||
/** | ||
* Then I see pathname contains: | ||
* | ||
* ```gherkin | ||
* Then I see pathname contains {string} | ||
* ``` | ||
* | ||
* @example | ||
* | ||
* ```gherkin | ||
* Then I see pathname contains "pathname" | ||
* ``` | ||
* | ||
* With [options](https://docs.cypress.io/api/commands/location#Arguments): | ||
* | ||
* ```gherkin | ||
* Then I see pathname contains "pathname" | ||
* | log | true | | ||
* | timeout | 4000 | | ||
* ``` | ||
* | ||
* @see | ||
* | ||
* - {@link Then_I_see_pathname | Then I see pathname} | ||
*/ | ||
export function Then_I_see_pathname_contains( | ||
pathname: string, | ||
options?: DataTable, | ||
) { | ||
cy.location(getOptions(options)).should((location) => { | ||
expect(location.pathname).to.contain(pathname); | ||
}); | ||
} | ||
|
||
Then('I see pathname contains {string}', Then_I_see_pathname_contains); |