-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0704f69
commit 300b1b4
Showing
5 changed files
with
116 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Examples | ||
```gherkin | ||
Scenario: Move the mouse to a div to trigger a javascript event | ||
Given I am on "/animations" | ||
When I move my mouse to "Move mouse here" | ||
And I move my mouse to "button-with-id" | ||
Then I should not see "Content - 2" | ||
``` | ||
```gherkin | ||
Scenario: fill multiple form fields in one step | ||
Given I am on "/forms" | ||
When I fill in the following: | ||
username: johndoe | ||
password: mysecret | ||
And I type in field "first_name" the value "Foo" | ||
Then the "username" field should contain "johndoe" | ||
And the "password" field should contain "mysecret" | ||
``` | ||
|
||
```gherkin | ||
Scenario: Setting a radio button and checking the state | ||
Given I am on "/forms" | ||
When I press "Radio 1" | ||
Then the radiobutton "radio-1" is checked | ||
And the radiobutton "radio-2" is not checked | ||
``` | ||
|
||
## Screen resolutions | ||
Using a `Scenario Outline` in combination with screen resolutions | ||
is helpful when testing multiple browser states. By default | ||
the resolutions are used for which [Bootstrap 4 defines media queries](https://getbootstrap.com/docs/4.3/layout/overview/#responsive-breakpoints). | ||
See the [pytest bdd documentation](https://pytest-bdd.readthedocs.io/en/latest/#scenario-outlines) | ||
for more information. | ||
```gherkin | ||
Scenario Outline: Show index extra small | ||
Given I am using a <device> | ||
And I am on the homepage | ||
Then I should be on "/" | ||
And I should see "Index page" | ||
Examples: | ||
| device | | ||
| extra small device | | ||
| small device | | ||
| medium device | | ||
| large device | | ||
| extra large device | | ||
``` |
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,25 @@ | ||
# Getting started | ||
|
||
A number of common steps for combining pytest-bdd with pytest-splinter. | ||
|
||
## Installation | ||
|
||
```sh | ||
pip install pytest-bdd-splinter | ||
``` | ||
|
||
## Configuration | ||
Create or update your `conftest.py` file to import the steps from this | ||
library so that they are available within your feature files. | ||
|
||
```python | ||
from pytest_bdd_splinter import * # noqa | ||
``` | ||
|
||
The next step is to set a default base url, this can be done by creating the | ||
following fixture: | ||
```python | ||
@pytest.fixture(scope="session") | ||
def browser_base_url(): | ||
return "http://localhost:5000" | ||
``` |
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 @@ | ||
# All steps | ||
|
||
Most of these steps should be self explanatory. On the [examples | ||
page](examples.md) you can see more information abouth the steps. | ||
|
||
## Given | ||
- `#!gherkin Given I am on the homepage` | ||
- `#!gherkin Given I am on "/subpage/"` | ||
- `#!gherkin Given I am using a <device>` | ||
- `#!gherkin Given I am using a window size of <height>x<width>` | ||
- `#!gherkin Given I am using an extra small device` | ||
- `#!gherkin Given I am using a small device` | ||
- `#!gherkin Given I am using a medium device` | ||
- `#!gherkin Given I am using a large small device` | ||
- `#!gherkin Given I am using an extra large device` | ||
|
||
## When | ||
- `#!gherkin When I go to the homepage` | ||
- `#!gherkin When I reload the page` | ||
- `#!gherkin When I move backward one page` | ||
- `#!gherkin When I move forward one page` | ||
- `#!gherkin When I go to "/subpage/"` | ||
- `#!gherkin When I press "button-with-id"` | ||
- `#!gherkin When I move my mouse to "Move mouse here"` | ||
- `#!gherkin When I type in field "field-name" the value "the-value"` | ||
- `#!gherkin When I fill in the following:` (multi-line, see examples) | ||
|
||
## Then | ||
- `#!gherkin Then I should see "Content - 1"` | ||
- `#!gherkin Then the checkbox "checkbox-1" is checked` | ||
- `#!gherkin Then the checkbox "checkbox-1" is not checked` | ||
- `#!gherkin Then the radiobutton "radio-1" is checked` | ||
- `#!gherkin Then the radiobutton "radio-2" is not checked` |
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,9 @@ | ||
site_name: Pytest BDD Splinter | ||
nav: | ||
- index.md | ||
- overview.md | ||
- examples.md | ||
theme: material | ||
markdown_extensions: | ||
- codehilite | ||
- pymdownx.inlinehilite |
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