Skip to content

Commit

Permalink
Add docs using mkdocs
Browse files Browse the repository at this point in the history
  • Loading branch information
mvantellingen committed Jun 22, 2019
1 parent 0704f69 commit 300b1b4
Show file tree
Hide file tree
Showing 5 changed files with 116 additions and 1 deletion.
48 changes: 48 additions & 0 deletions docs/examples.md
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 |
```
25 changes: 25 additions & 0 deletions docs/index.md
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"
```
33 changes: 33 additions & 0 deletions docs/overview.md
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`
9 changes: 9 additions & 0 deletions mkdocs.yml
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
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from setuptools import find_packages, setup

docs_require = ["sphinx>=1.4.0"]
docs_require = ["mkdocs>=1.0.4", "mkdocs-material==4.4.0"]

install_requires = ["pytest>=4.0.0", "pytest-bdd>=3.0.0", "pytest-splinter>=2.0.0"]

Expand Down

0 comments on commit 300b1b4

Please sign in to comment.