-
-
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.
test(cypress): modularize cypress features
- Loading branch information
1 parent
6cf4eaa
commit c15059a
Showing
11 changed files
with
194 additions
and
194 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
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,33 @@ | ||
Feature: Cypress aliasing | ||
Scenario: Get nth element | ||
Given I visit "https://example.cypress.io/commands/aliasing" | ||
When I find buttons by text "Change" | ||
And I get first element | ||
And I click "top-right" | ||
Then I find buttons by text "Changed" | ||
And I count 1 element | ||
When I find buttons by text "Change" | ||
And I get 2nd element | ||
And I click "top" | ||
Then I find buttons by text "Changed" | ||
And I count 2 elements | ||
When I find buttons by text "Change" | ||
And I get 3rd element | ||
And I click "bottom-right" | ||
Then I find buttons by text "Changed" | ||
And I count 3 elements | ||
When I find buttons by text "Change" | ||
And I get last element | ||
And I click "bottom-left" | ||
Then I find buttons by text "Changed" | ||
And I count 4 elements | ||
When I find links by text "cypress" | ||
And I get 1st element | ||
And I click "center" | ||
|
||
Scenario: Count elements length | ||
Given I visit "https://example.cypress.io/commands/aliasing" | ||
When I find buttons by text "Get Comment" | ||
Then I count 1 element | ||
When I find buttons by text "Change" | ||
Then I count 4 elements |
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,15 @@ | ||
Feature: Cypress cookies | ||
Scenario: Cookie | ||
Given I visit "https://example.cypress.io/commands/cookies" | ||
When I set cookie "name" to "value" | ||
Then I see cookie "name" | ||
When I clear cookie "name" | ||
Then I do not see cookie "name" | ||
When I set cookie "foo" to "bar" | ||
Then I see cookie "foo" has value "bar" | ||
When I clear cookies | ||
Then I do not see cookie "foo" | ||
When I click on button "Set Cookie" | ||
Then I see cookie "token" contains value "123" | ||
When I clear all cookies | ||
Then I do not see cookie "test" |
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,19 @@ | ||
Feature: Cypress misc | ||
Scenario: Form with textarea | ||
Given I visit "https://example.cypress.io/commands/misc" | ||
When I find form | ||
And I get children | ||
And I get last element | ||
And I click | ||
And I type "children" | ||
Then I see textarea value "children" | ||
And I see textarea value contains "child" | ||
|
||
Scenario: Assert input value | ||
Given I visit "https://example.cypress.io/commands/misc" | ||
When I find element by label text "Name" | ||
And I type "John Smith" | ||
Then I see input value "John Smith" | ||
And I see input value contains "John" | ||
When I find input by label text "Name" | ||
Then I see value "John Smith" |
22 changes: 22 additions & 0 deletions
22
cypress/e2e/cypress/example/commands/network-requests.feature
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,22 @@ | ||
Feature: Cypress network requests | ||
Scenario: Intercept network requests | ||
Given I visit "https://example.cypress.io/commands/network-requests" | ||
When I intercept URL "/comments/1" and stub body '{"body":"Test 1"}' | ||
And I click on button "Get Comment" | ||
Then I see text "Test 1" | ||
When I intercept URL "/comments/1" | ||
| auth | {"username":"user","password":"pass"} | | ||
| body | {"body":"Test 2"} | | ||
| headers | {"X-Requested-With":"exampleClient"} | | ||
| hostname | localhost | | ||
| https | true | | ||
| method | GET | | ||
| middleware | false | | ||
| path | /api/commands/intercept?foo=bar | | ||
| pathname | /api/commands/intercept | | ||
| port | 8080 | | ||
| query | {"foo":"bar"} | | ||
| resourceType | fetch | | ||
| times | 1 | | ||
And I click on button "Get Comment" | ||
Then I see text "Test 2" |
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,30 @@ | ||
Feature: Cypress querying | ||
Scenario: Placeholder | ||
Given I visit "https://example.cypress.io/commands/querying" | ||
When I find elements by placeholder text "Name" | ||
Then I count 1 element | ||
When I find element by placeholder text "Name" | ||
Then I count 1 element | ||
When I find inputs by placeholder text "Name" | ||
Then I count 1 element | ||
When I find input by placeholder text "Name" | ||
Then I count 1 element | ||
|
||
Scenario: Test ID | ||
Given I visit "https://example.cypress.io/commands/querying" | ||
Then I see test ID "test-example" | ||
And I do not see test ID "test-invalid" | ||
When I find elements by test ID "test-example" | ||
Then I count 1 element | ||
When I find element by test ID "test-example" | ||
Then I count 1 element | ||
And I click on test ID "test-example" | ||
|
||
Scenario: Role | ||
Given I visit "https://example.cypress.io/commands/querying" | ||
When I find elements by role "button" | ||
Then I see element exists | ||
When I find element by role "button" | ||
Then I see element is visible | ||
And I see role "button" | ||
And I do not see role "tooltip" |
18 changes: 18 additions & 0 deletions
18
cypress/e2e/cypress/example/commands/spies-stubs-clocks.feature
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,18 @@ | ||
Feature: Cypress spies, stubs, clocks | ||
Scenario: Timers | ||
Given I visit "https://example.cypress.io/commands/spies-stubs-clocks" | ||
When I use fake timers | ||
And I set system time to 1234567890000 | ||
And I click on text "Click for current time!" | ||
Then I see text "1234567890" | ||
When I reload the page | ||
And I set system time to "2020-02-02" | ||
And I click on text "Click for current time!" | ||
Then I see text "1580601600" | ||
When I advance timers by 300 milliseconds | ||
And I advance timers by 1 millisecond | ||
And I advance timers by 3 seconds | ||
And I advance timers by 1 second | ||
And I use real timers | ||
And I click on text "Click for current time!" | ||
Then I do not see text "15806016000" |
Oops, something went wrong.