Gherkin++ v0.1.0 GitHub

Built-in words

Finding
Roles Roles with no name Field, Label Text Placeholder Alt Title TestId Containing Within, In
Doing
Click Double-click Hover Focus Check Uncheck Clear Fill Type Select Press Visit Reload Back Render
Checking
See Visible Hidden Checked Enabled Disabled Focused Empty Value Read Contain Not At Titled
Lists
Count Each, Every No, None
Steps
Given When Then And, But *
Other
I Print

Finding

Roles

Alertdialog, Application, Banner, Button, Cell, Checkbox, Columnheader, Combobox, Complementary, Contentinfo, Dialog, Directory, Document, Feed, Figure, Form, Grid, Gridcell, Group, Heading, Img, Link, List, Listbox, Main, Math, Meter, Menu, Menubar, Menuitem, Menuitemcheckbox, Menuitemradio, Navigation, Option, Progressbar, Radio, Radiogroup, Region, Row, Rowgroup, Rowheader, Scrollbar, Search, Searchbox, Separator, Slider, Spinbutton, Switch, Tab, Table, Tablist, Tabpanel, Textbox, Toolbar, Tooltip, Tree, Treegrid, Treeitem

Finds an element by its ARIA role and accessible name, which must match exactly.

Text | Pattern | Holding, Scope -> Elementtakes a "name" to look for, then Within something
Text | Pattern | Holding -> Elementtakes a "name" to look for
Scope -> Elementtakes Within something
-> Elementtakes nothing
When I Click the Button "Sign in"
Then I should See the Heading "Welcome back"
Then the Dialog should be Visible

Roles with no name

Alert, Article, Blockquote, Caption, Code, Definition, Deletion, Emphasis, Generic, Insertion, Listitem, Log, Marquee, Note, Paragraph, Presentation, Status, Strong, Subscript, Superscript, Term, Time, Timer

Finds an element by its ARIA role and the text inside it. These roles aren't named by their content.

Pattern | Holding, Scope -> Elementtakes Containing "some text" (an Alert has no name to match exactly), then Within something
Pattern | Holding -> Elementtakes Containing "some text" (an Alert has no name to match exactly)
Scope -> Elementtakes Within something
-> Elementtakes nothing
When I Click the Button "Destroy" Within the Listitem Containing "feed the cat"
Then the Alert Containing "Saved" should be Visible

Field, Label

Finds a form control by its label.

Text | Pattern, Scope -> Elementtakes a "name" to look for, then Within something
Text | Pattern -> Elementtakes a "name" to look for
When I Fill the Field "Email" with "will@example.com"
When I Check the Label "Remember me"

Text

Finds an element by its text.

Text | Pattern, Scope -> Elementtakes a "name" to look for, then Within something
Text | Pattern -> Elementtakes a "name" to look for
When I Click the Text "Forgot your password?"

Placeholder

Finds a form control by its placeholder.

Text | Pattern, Scope -> Elementtakes a "name" to look for, then Within something
Text | Pattern -> Elementtakes a "name" to look for
When I Fill the Placeholder "Search" with "kale"

Alt

Finds an image by its alt text.

Text | Pattern, Scope -> Elementtakes a "name" to look for, then Within something
Text | Pattern -> Elementtakes a "name" to look for
Then I should See the Alt "Company logo"

Title

Finds an element by its title.

Text | Pattern, Scope -> Elementtakes a "name" to look for, then Within something
Text | Pattern -> Elementtakes a "name" to look for
When I Hover the Title "Settings"

TestId

Finds an element by its test id. A last resort: it stands out in review.

Text | Pattern, Scope -> Elementtakes a "name" to look for, then Within something
Text | Pattern -> Elementtakes a "name" to look for
When I Click the TestId "chart-bar-3"

Containing

Matches part of a name or text, ignoring case, or an element with another inside it.

Text -> Patterntakes some text
Element -> Holdingtakes something on the page
When I Click the Button "Remove" Within the Row Containing "Kale"
Then I should See the Row Containing the Button "Undo"

Within, In

Looks inside another element.

Element -> Scopetakes something on the page to look inside
When I Click the Link "Help" Within the Navigation
When I Click the Button "Close" In the Dialog

Doing

Click

Clicks an element.

Element ->takes something on the page
When I Click the Button "Sign in"

Double-click

Double-clicks an element.

Element ->takes something on the page
When I Double-click the Text "buy milk"

Hover

Moves the mouse over an element.

Element ->takes something on the page
When I Hover the Button "Share"

Focus

Focuses an element.

Element ->takes something on the page
When I Focus the Field "Email"

Check

Checks a checkbox or radio button.

Element ->takes something on the page
When I Check the Checkbox "Terms"

Uncheck

Unchecks a checkbox.

Element ->takes something on the page
When I Uncheck the Checkbox "Newsletter"

Clear

Empties a field.

Element ->takes something on the page
When I Clear the Field "Search"

Fill

Fills a field, replacing what was in it. Given a table, fills each field by its label.

Element, Text ->takes something on the page, then some text
Text, Element ->takes some text, then something on the page
Table ->takes a table
When I Fill the Field "Email" with "will@example.com"
When I Fill "hunter2" into the Field "Password"
When I Fill in the form:
  | Email    | will@example.com |
  | Password | hunter2          |

Type

Types into a field one key at a time, as a person would.

Element, Text ->takes something on the page, then some text
Text, Element ->takes some text, then something on the page
When I Type "kale" into the Field "Search"

Select

Chooses an option in a select box.

Element, Text ->takes something on the page, then some text
Text, Element ->takes some text, then something on the page
When I Select "Blue" in the Combobox "Colour"

Press

Presses a key, on an element or on the page.

Text, Element ->takes a "Key" to press, then something on the page
Text ->takes a "Key" to press
When I Press "Enter"
When I Press "Escape" in the Dialog

Visit

Only in Playwright's files

Goes to a path on the app, or a URL.

Text ->takes a "/path" or URL
Given I Visit "/"

Reload

Only in Playwright's files

Reloads the page.

->takes nothing
When I Reload the page

Back

Only in Playwright's files

Goes back, as the browser's back button does.

->takes nothing
When I go Back

Render

Only in Testing Library's files

Renders what the test's gpp template has in a ${…}, like a React element.

Component ->takes a component, as ${…}
Given I Render ${<Editor title="" />}

Checking

See

Checks an element is visible, or some text anywhere on the page.

Element -> Checktakes something on the page
Text | Pattern -> Checktakes some text
Then I should See the Heading "Welcome back"
Then I should See "Saved"

Visible

Checks an element is visible.

-> Matchertakes nothing
Then the Dialog "Cookies" should be Visible

Hidden

Checks an element is hidden, or not there.

-> Matchertakes nothing
Then the Dialog "Cookies" should be Hidden

Checked

Checks a checkbox or radio button is checked.

-> Matchertakes nothing
Then the Checkbox "Terms" should be Checked

Enabled

Checks an element is enabled.

-> Matchertakes nothing
Then the Button "Save" should be Enabled

Disabled

Checks an element is disabled.

-> Matchertakes nothing
Then the Button "Save" should be Disabled

Focused

Checks an element has focus.

-> Matchertakes nothing
Then the Field "Email" should be Focused

Empty

Checks an element has no text, or a field no value.

-> Matchertakes nothing
Then the Field "Search" should be Empty

Value

Checks a field's value.

Text | Pattern -> Matchertakes some text
Then the Field "Email" should have the Value "will@example.com"

Read

Checks an element's whole text. Given a table, checks what everything found reads, in order.

Text | Pattern -> Matchertakes some text
Table -> Matchertakes a table of one column
Then the Status should Read "2 items left"
Then the Listitem should Read:
  | buy some cheese |
  | feed the cat    |

Contain

Checks part of an element's text.

Text | Pattern -> Matchertakes some text
Then the Alert should Contain "saved"

Not

Turns a check around.

Matcher -> Matchertakes a check
Check -> Checktakes a check
Then I should Not See the Button "Delete"
Then the Checkbox "Terms" should Not be Checked

At

Only in Playwright's files

Checks the page's path, or its whole URL.

Text -> Checktakes a "/path" or URL
Then I should be At "/dashboard"

Titled

Only in Playwright's files

Checks the page's title.

Text | Pattern -> Checktakes some text
Then the page should be Titled "Dashboard"

Lists

Count

Checks how many elements a query finds.

Number, Element -> Checktakes how many there should be, then something on the page
Then I should Count 3 Row Within the Table

Each, Every

Checks every element a query finds. Fails if it finds none.

Element, Matcher -> Checktakes something on the page, then a check
Then Each Checkbox "Bought" should be Checked

No, None

Checks no element a query finds passes. Passes if it finds none.

Element, Matcher -> Checktakes something on the page, then a check
Then No Checkbox "Bought" should be Checked

Steps

Given

Starts a step that sets the scene.

Step, Mode -> Modetakes a step, then a Given, When or Then above it
Step -> Modetakes a step
Given I Check the Checkbox "Remember me"

When

Starts a step that does something.

Step, Mode -> Modetakes a step, then a Given, When or Then above it
Step -> Modetakes a step
When I Click the Button "Add"

Then

Starts a step that checks something.

Step, Mode -> Modetakes a step, then a Given, When or Then above it
Step -> Modetakes a step
Then I should See "Added"

And, But

Starts a step like the one above it. A scenario can't start with one.

Step, Mode -> Modetakes a step, then a Given, When or Then above it
Then I should See "Added"
And I should Not See "Empty"

*

Starts a step like the one above it, or, first, a step of no kind.

Step, Mode -> Modetakes a step, then a Given, When or Then above it
Step -> Modetakes a step
* I Click the Button "Add"

Other

I

Does nothing, so a step can read as a sentence.

->takes nothing
When I Click the Button "Add"

Print

Prints a value, for debugging.

Any ->takes a value
When I Print the Button "Save"