| Class | Description |
|---|---|
| ConfigContext | Provides pre-built step definitions for interacting with Drupal config. |
| DrupalContext | Provides pre-built step definitions for interacting with Drupal. |
| DrushContext | Provides step definitions for interacting directly with Drush commands. |
| MailContext | Provides pre-built step definitions for interacting with mail. |
| MarkupContext | Extensions to the Mink Extension. |
| MessageContext | Provides step-definitions for interacting with Drupal messages. |
| MinkContext | Extensions to the Mink Extension. |
Provides pre-built step definitions for interacting with Drupal config.
@Given I set the configuration item :name with key :key to :value
Sets a configuration item.
Given I set the configuration item "system.site" with key "name" to "My Site"
Given I set the configuration item "system.performance" with key "css.preprocess" to "false"
Given I set the configuration item "system.site" with key "weight_select_max" to "50"
Given I set the configuration item "some.config" with key "nullable_key" to "null"
@Given I set the configuration item :name with key :key with the following values:
Sets complex configuration.
Given I set the configuration item "system.site" with key "page" with the following values:
| key | value |
| front | /node |
| 403 | /error |
Given I set the configuration item "some.config" with key "settings" with the following values:
| key | value |
| enabled | true |
| count | 5 |
| nested | {"foo": "bar", "baz": 1} |
Provides pre-built step definitions for interacting with Drupal.
@Given I am an anonymous user
Log the current user out so the session is anonymous.
Given I am an anonymous user
@Given I am not logged in
Log the current user out.
Given I am not logged in
@Given I am logged in as a user with the :role role(s)
Creates and authenticates a user with the given role(s).
Given I am logged in as a user with the "editor" role
Given I am logged in as a user with the "editor, admin" roles
@Given I am logged in as a/an :role
Creates and authenticates a user with the given single role.
Given I am logged in as an "editor"
@Given I am logged in as a user with the :role role(s) and I have the following fields:
Creates and authenticates a user with the given role(s) and given fields.
Given I am logged in as a user with the "editor" role and I have the following fields:
| field_user_name | John |
| field_user_surname | Smith |
@Given I am logged in as :name
Log in as an existing user by name.
Given I am logged in as "admin"
@Given I am logged in as a user with the :permissions permission(s)
Log in as a user with specific permissions.
Given I am logged in as a user with the "administer nodes" permission
Given I am logged in as a user with the "administer nodes, bypass node access" permissions
@Given I click :link in the :rowText row
Clicks a link in a table row containing given text.
Given I click "Edit" in the "My article" row
@Given I press :button in the :rowText row
Attempts to find a button in a table row containing giving text.
Given I press "Remove" in the "My article" row
@Given the cache has been cleared
Clear the Drupal cache.
Given the cache has been cleared
@Given I run cron
Run Drupal cron.
Given I run cron
@Given I am viewing a/an :type with the title :title
View content of the given type with the given title.
Given I am viewing an "article" with the title "Test article"
@Given I am viewing a/an :type content with the title :title
View content of the given type (with the explicit "content" word).
Given I am viewing an "article" content with the title "Test article"
@Given a/an :type with the title :title
Create content of the given type and visit it.
Given a "page" with the title "About us"
@Given a/an :type content with the title :title
Create content (with the explicit "content" word) and visit it.
Given a "page" content with the title "About us"
@Given I am viewing my :type with the title :title
Creates content authored by the current user.
Given I am viewing my "article" with the title "My article"
@Given I am viewing my :type content with the title :title
Creates content authored by the current user (with the "content" word).
Given I am viewing my "article" content with the title "My article"
@Given the following :type content:
Creates content of a given type.
Given the following "article" content:
| title | status |
| My article | 1 |
@Given I am viewing a/an :type with the following fields:
Creates content of the given type and visits it.
Given I am viewing an "article" with the following fields:
| title | My article |
| body | Lorem ipsum |
@Given I am viewing a/an :type content with the following fields:
Creates content (with explicit "content" word) and visits it.
Given I am viewing an "article" content with the following fields:
| title | My article |
| body | Lorem ipsum |
@Given I am viewing a/an :vocabulary term with the name :name
Creates a term on an existing vocabulary and visits it.
Given I am viewing a "tags" term with the name "Sports"
@Given a/an :vocabulary term with the name :name
Creates a term on an existing vocabulary without explicit visit phrasing.
Given an "categories" term with the name "News"
@Given the following users:
Creates multiple users.
Given the following users:
| name | mail | roles |
| Joe User | joe@example.com | editor |
@Given the following :vocabulary terms:
Creates one or more terms on an existing vocabulary.
Given the following "tags" terms:
| name |
| Sports |
| News |
@Given the/these (following )languages are available:
Creates one or more languages.
Given the/these (following )languages are available:
| languages |
| en |
| fr |
@Given the following :type entities:
Creates entities of a given type provided in a table.
Given the following "commerce_product" entities:
| title | type | status |
| TNT | product | 1 |
| Anvil | product | 1 |
@Given I wait for the batch job to finish
Wait for the Batch API to finish.
Given I wait for the batch job to finish
@Given the following item is in the system queue:
Creates a queue item. Defaults inputs if none are available.
Given the following item is in the system queue:
| name | my_queue |
| data | {"key":"value"} |
| created | 1700000000 |
| expire | 0 |
@When I log out
Log out the current user.
When I log out
@When (I )break
Pauses the scenario until the user presses a key.
When I break
@Then I should see the text :text in the :rowText row
Find text in a table row containing given text.
Then I should see the text :text in the :rowText row
@Then I should not see the text :text in the :rowText row
Asset text not in a table row containing given text.
Then I should not see the text :text in the :rowText row
@Then I should see the :link in the :rowText row
Asserts a link exists in a table row containing given text.
Then I should see the :link in the :rowText row
@Then I should not see the :link in the :rowText row
Asserts a link does not exist in a table row containing given text.
Then I should not see the :link in the :rowText row
@Then I should be able to edit the :type
Asserts that a given content type is editable.
Then I should be able to edit the :type
@Then I should be able to edit the :type content
Asserts that a given content type (with explicit "content") is editable.
Then I should be able to edit the :type content
Provides step definitions for interacting directly with Drush commands.
@Given I run drush :command
Run a Drush command.
Given I run drush "status"
@Given I run drush :command :arguments
Run a Drush command with arguments.
Given I run drush "pm:list" "--status=enabled"
Given I run drush "config:get" "system.site uuid --format=string"
@Given I run the failing drush command :command
Run a Drush command that is expected to fail.
Given I run the failing drush command "pm:uninstall no_such_module"
@Given I run the failing drush command :command :arguments
Run a Drush command with arguments that is expected to fail.
Given I run the failing drush command "pm:uninstall" "no_such_module"
@When I print the last drush output
Print the last Drush output.
When I print the last drush output
@Then the drush output should contain :output
Assert the Drush output contains a string.
Then the drush output should contain "Drupal version"
@Then the drush output should match :regex
Assert the Drush output matches a regular expression.
Then the drush output should match "/Drupal [0-9]+/"
@Then the drush output should not contain :output
Assert the Drush output does not contain a string.
Then the drush output should not contain "error"
Provides pre-built step definitions for interacting with mail.
@When I send the following mail:
Send a mail through the active Drupal driver.
When I send the following mail:
| to | user@example.com |
| subject | Test mail |
| body | Hello world |
@When I send the following email:
Send an email through the active Drupal driver.
When I send the following email:
| to | user@example.com |
| subject | Test email |
| body | Hello world |
@When I follow the link to :urlFragment from the mail
Follow a link from a mail body.
When I follow the link to "user/reset" from the mail
@When I follow the link to :urlFragment from the email
Follow a link from an email body.
When I follow the link to "user/reset" from the email
@When I follow the link to :urlFragment from the mail to :to
Follow a link from a mail body filtered by recipient.
When I follow the link to "user/reset" from the mail to "user@example.com"
@When I follow the link to :urlFragment from the email to :to
Follow a link from an email body filtered by recipient.
When I follow the link to "user/reset" from the email to "user@example.com"
@When I follow the link to :urlFragment from the mail with the subject :subject
Follow a link from a mail body filtered by subject.
When I follow the link to "user/reset" from the mail with the subject "Welcome"
@When I follow the link to :urlFragment from the email with the subject :subject
Follow a link from an email body filtered by subject.
When I follow the link to "user/reset" from the email with the subject "Welcome"
@When I follow the link to :urlFragment from the mail to :to with the subject :subject
Follow a link from a mail body filtered by recipient and subject.
When I follow the link to "user/reset" from the mail to "user@example.com" with the subject "Welcome"
@When I follow the link to :urlFragment from the email to :to with the subject :subject
Follow a link from an email body filtered by recipient and subject.
When I follow the link to "user/reset" from the email to "user@example.com" with the subject "Welcome"
@Then the following (e)mail(s) should have been sent:
Assert mail has been sent during the scenario.
Then the following mail should have been sent:
| to | body |
| user@example.com | Welcome to the site |
@Then the following (e)mail(s) should have been sent to :to:
Assert mail has been sent to a recipient during the scenario.
Then the following mail should have been sent to "user@example.com":
| body |
| Welcome to the site |
@Then the following (e)mail(s) should have been sent with the subject :subject:
Assert mail with a subject has been sent during the scenario.
Then the following mail should have been sent with the subject "Welcome":
| body |
| Welcome to the site |
@Then the following (e)mail(s) should have been sent to :to with the subject :subject:
Assert mail to a recipient with a subject has been sent.
Then the following mail should have been sent to "user@example.com" with the subject "Welcome":
| body |
| Welcome to the site |
@Then (a )(an )(e)mail(s) should have been sent with the attachment(s) :attachments
Assert mail with an attachment has been sent during the scenario.
Then an email should have been sent with the attachment "invoice.pdf"
Then an email should have been sent with the attachments "invoice.pdf,terms.pdf"
@Then (a )(an )(e)mail(s) should have been sent to :to with the attachment(s) :attachments
Assert mail to a recipient with an attachment has been sent.
Then an email should have been sent to "user@example.com" with the attachment "invoice.pdf"
@Then (a )(an )(e)mail(s) should have been sent with the subject :subject and the attachment(s) :attachments
Assert mail with a subject and an attachment has been sent.
Then an email should have been sent with the subject "Invoice" and the attachment "invoice.pdf"
@Then (a )(an )(e)mail(s) should have been sent to :to with the subject :subject and the attachment(s) :attachments
Assert mail to a recipient with a subject and an attachment has been sent.
Then an email should have been sent to "user@example.com" with the subject "Invoice" and the attachments "invoice.pdf,terms.pdf"
@Then the following new (e)mail(s) should have been sent:
Assert new mail has been sent since the last mail check.
Then the following new mail should have been sent:
| subject |
| Greetings |
@Then the following new (e)mail(s) should have been sent to :to:
Assert new mail to a recipient has been sent since the last mail check.
Then the following new mail should have been sent to "user@example.com":
| subject |
| Greetings |
@Then the following new (e)mail(s) should have been sent with the subject :subject:
Assert new mail with a subject has been sent since the last mail check.
Then the following new mail should have been sent with the subject "Greetings":
| body |
| Hello |
@Then the following new (e)mail(s) should have been sent to :to with the subject :subject:
Assert new mail to a recipient with a subject has been sent.
Then the following new mail should have been sent to "user@example.com" with the subject "Greetings":
| body |
| Hello |
@Then there should be a total of :count (e)mail(s) sent
Assert the count of mails sent during the scenario.
Then there should be a total of no mails sent
Then there should be a total of 2 mails sent
@Then there should be a total of :count (e)mail(s) sent to :to
Assert the count of mails sent to a recipient during the scenario.
Then there should be a total of no mails sent to "user@example.com"
Then there should be a total of 2 mails sent to "user@example.com"
@Then there should be a total of :count (e)mail(s) sent with the subject :subject
Assert the count of mails sent with a subject during the scenario.
Then there should be a total of no mails sent with the subject "Welcome"
Then there should be a total of 1 mail sent with the subject "Welcome"
@Then there should be a total of :count (e)mail(s) sent to :to with the subject :subject
Assert the count of mails sent to a recipient with a subject.
Then there should be a total of no mails sent to "user@example.com" with the subject "Welcome"
Then there should be a total of 1 mail sent to "user@example.com" with the subject "Welcome"
@Then there should be a total of :count new (e)mail(s) sent
Assert the count of new mails sent since the last mail check.
Then there should be a total of no new mails sent
Then there should be a total of 1 new mail sent
@Then there should be a total of :count new (e)mail(s) sent to :to
Assert the count of new mails sent to a recipient since the last check.
Then there should be a total of no new mails sent to "user@example.com"
Then there should be a total of 1 new mail sent to "user@example.com"
@Then there should be a total of :count new (e)mail(s) sent with the subject :subject
Assert the count of new mails sent with a subject since the last check.
Then there should be a total of no new mails sent with the subject "Welcome"
Then there should be a total of 1 new mail sent with the subject "Welcome"
@Then there should be a total of :count new (e)mail(s) sent to :to with the subject :subject
Assert the count of new mails sent to a recipient with a subject.
Then there should be a total of no new mails sent to "user@example.com" with the subject "Welcome"
Then there should be a total of 1 new mail sent to "user@example.com" with the subject "Welcome"
Extensions to the Mink Extension.
@Then I should see the button :button in the :region( region)
Checks if a button with id|name|title|alt|value exists in a region.
Then I should see the button "Submit" in the "content"
Then I should see the button "Submit" in the "content" region
@Then I should see the :button button in the :region( region)
Checks if a button (with the noun before "button") exists in a region.
Then I should see the "Submit" button in the "content"
Then I should see the "Submit" button in the "content" region
@Then I should not see the button :button in the :region( region)
Asserts that a button does not exists in a region.
Then I should not see the button "Delete" in the "sidebar"
Then I should not see the button "Delete" in the "sidebar" region
@Then I should not see the :button button in the :region( region)
Asserts a button (with noun before "button") does not exist in a region.
Then I should not see the "Delete" button in the "sidebar"
Then I should not see the "Delete" button in the "sidebar" region
@Then I should see the :tag element in the :region( region)
Assert an element exists in a region.
Then I should see the "h2" element in the "content"
Then I should see the "h2" element in the "content" region
@Then I should not see the :tag element in the :region( region)
Assert an element does not exist in a region.
Then I should not see the "h2" element in the "sidebar"
Then I should not see the "h2" element in the "sidebar" region
@Then I should see :text in the :tag element in the :region( region)
Assert text in an element within a region.
Then I should see "Welcome" in the "h2" element in the "content"
Then I should see "Welcome" in the "h2" element in the "content" region
@Then I should not see :text in the :tag element in the :region( region)
Assert text is not in an element within a region.
Then I should not see "Error" in the "div" element in the "content"
Then I should not see "Error" in the "div" element in the "content" region
@Then I should see the :tag element with the :attribute attribute set to :value in the :region( region)
Assert an element with a specific attribute value exists in a region.
Then I should see the "a" element with the "href" attribute set to "/about" in the "footer"
Then I should see the "a" element with the "href" attribute set to "/about" in the "footer" region
@Then I should see :text in the :tag element with the :attribute attribute set to :value in the :region( region)
Assert text in an element with a specific attribute value in a region.
Then I should see "About" in the "a" element with the "href" attribute set to "/about" in the "footer"
Then I should see "About" in the "a" element with the "href" attribute set to "/about" in the "footer" region
@Then I should see :text in the :tag element with the :property CSS property set to :value in the :region( region)
Assert text in an element with a specific CSS property value in a region.
Then I should see "Notice" in the "div" element with the "color" CSS property set to "red" in the "content"
Then I should see "Notice" in the "div" element with the "color" CSS property set to "red" in the "content" region
Provides step-definitions for interacting with Drupal messages.
Operates against the rendered page via Mink. CSS selectors are read from the nested 'selectors.messages:' map under 'Drupal\DrupalExtension', keyed by 'default', 'error', 'success' and 'warning'.
@Then I should see the error message( containing) :message
Checks if the current page contains the given error message.
Then I should see the error message "Username is required"
Then I should see the error message containing "Username"
@Then I should see the following error message(s):
Checks if the current page contains the given set of error messages.
Then I should see the following error messages:
| error messages |
| Username is required |
| Password is required |
@Then I should not see the error message( containing) :message
Checks if the current page does not contain the given error message.
Then I should not see the error message "Access denied"
Then I should not see the error message containing "Access"
@Then I should not see the following error messages:
Checks if the current page does not contain the given set error messages.
Then I should not see the following error messages:
| error messages |
| Access denied |
@Then I should see the success message( containing) :message
Checks if the current page contains the given success message.
Then I should see the success message "Article has been created"
Then I should see the success message containing "created"
@Then I should see the following success messages:
Checks if the current page contains the given set of success messages.
Then I should see the following success messages:
| success messages |
| Article has been created |
@Then I should not see the success message( containing) :message
Checks the page does not contain the given success message.
Then I should not see the success message "saved"
Then I should not see the success message containing "saved"
@Then I should not see the following success messages:
Checks the page does not contain the given set of success messages.
Then I should not see the following success messages:
| success messages |
| Changes saved |
@Then I should see the warning message( containing) :message
Checks if the current page contains the given warning message.
Then I should see the warning message "This action cannot be undone"
Then I should see the warning message containing "cannot be undone"
@Then I should see the following warning message(s):
Checks if the current page contains the given set of warning messages.
Then I should see the following warning messages:
| warning messages |
| This action cannot be undone |
@Then I should not see the warning message( containing) :message
Checks the page does not contain the given warning message.
Then I should not see the warning message "deprecated"
Then I should not see the warning message containing "deprecated"
@Then I should not see the following warning messages:
Checks the page does not contain the given set of warning messages.
Then I should not see the following warning messages:
| warning messages |
| deprecated |
@Then I should see the message( containing) :message
Checks if the current page contain the given message.
Then I should see the message "Changes saved"
Then I should see the message containing "saved"
@Then I should not see the message( containing) :message
Checks if the current page does not contain the given message.
Then I should not see the message "Access denied"
Then I should not see the message containing "denied"
Extensions to the Mink Extension.
@Given I am at :path
Visit a given path, and additionally check for HTTP response code 200.
Given I am at "/node/1"
@Given for :field I enter :value
Enter a value into a form field.
Given for "Title" I enter "My article"
@Given I enter :value for :field
Enter a value into a form field (alternative phrasing).
Given I enter "My article" for "Title"
@Given I press the :char key in the :field field
Press a key in a form field.
Given I press the "enter" key in the "Search" field
@Given I press :button in the :region( region)
Checks if a button exists and presses it.
Given I press "Submit" in the "sidebar"
Given I press "Submit" in the "sidebar" region
@Given I fill in :value for :field in the :region( region)
Fills in a form field with id|name|title|alt|value in the specified region.
Given I fill in "test" for "Search" in the "header"
Given I fill in "test" for "Search" in the "header" region
@Given I fill in :field with :value in the :region( region)
Fills in a form field (alternative phrasing) in the specified region.
Given I fill in "Search" with "test" in the "header" region
@Given I check :locator in the :region( region)
Checks if a checkbox exists and checks it.
Given I check "Published" in the "content"
Given I check "Published" in the "content" region
@Given I uncheck :checkbox in the :region( region)
Checks if a checkbox exists and unchecks it.
Given I uncheck "Promoted" in the "content"
Given I uncheck "Promoted" in the "content" region
@Given I check the box :checkbox
Check a checkbox.
Given I check the box "Published"
@Given I uncheck the box :checkbox
Uncheck a checkbox.
Given I uncheck the box "Promoted to front page"
@Given I wait for AJAX to finish
Wait for AJAX to finish.
Given I wait for AJAX to finish
@When I visit :path
Visit a given path without asserting any HTTP status.
When I visit "/node/1"
@When I click :link
Click a link by its text.
When I click "Read more"
@When I press the :button button
Presses button with specified id|name|title|alt|value.
When I press the "Save" button
@When I drag element :source onto element :target
Drag and drop one element onto another.
When I drag element "#draggable" onto element "#droppable"
@When I follow/click :link in the :region( region)
Follow a link in a specific region.
When I follow "Read more" in the "content"
When I follow "Read more" in the "content" region
When I click "Read more" in the "content" region
@When I select the radio button :label
Select a radio button.
When I select the radio button "Full HTML"
@When I select the radio button :label with the id :id
Select a radio button by id.
When I select the radio button "Full HTML" with the id "edit-format-full-html"
@When I :action details labelled :summary
Expand/collapse/toggle a
element by text.
text.
When I expand details labelled "Advanced settings"
When I collapse details labelled "Advanced settings"
When I click details labelled "Advanced settings"
When I expand details labelled "Advanced settings"
When I collapse details labelled "Advanced settings"
When I click details labelled "Advanced settings"
@Then I should see the link :link
Assert a link is visible on the page.
Then I should see the link "Log out"
@Then I should not see the link :link
Links are not loaded on the page.
Then I should not see the link "Log out"
@Then I should not visibly see the link :link
Links are loaded but not visually visible.
Then I should not visibly see the link "Skip to main content"
@Then I should see the heading :heading
Assert a heading is visible on the page.
Then I should see the heading "Welcome"
@Then I should not see the heading :heading
Assert a heading is not on the page.
Then I should not see the heading "Error"
@Then I should see the button :button
Assert a button is visible on the page.
Then I should see the button "Save"
@Then I should see the :button button
Assert a button (with the noun before "button") is visible on the page.
Then I should see the "Save" button
@Then I should not see the button :button
Assert a button is not on the page.
Then I should not see the button "Delete"
@Then I should not see the :button button
Assert a button (with the noun before "button") is not on the page.
Then I should not see the "Delete" button
@Then I should see the heading :heading in the :region( region)
Find a heading in a specific region.
Then I should see the heading "Latest news" in the "sidebar"
Then I should see the heading "Latest news" in the "sidebar" region
@Then I should see the :heading heading in the :region( region)
Find a heading (with the noun before "heading") in a specific region.
Then I should see the "Latest news" heading in the "sidebar"
Then I should see the "Latest news" heading in the "sidebar" region
@Then I should see the link :link in the :region( region)
Assert a link exists in a region.
Then I should see the link "About us" in the "footer"
Then I should see the link "About us" in the "footer" region
@Then I should not see the link :link in the :region( region)
Assert a link does not exist in a region.
Then I should not see the link "Admin" in the "footer"
Then I should not see the link "Admin" in the "footer" region
@Then I should see( the text) :text in the :region( region)
Assert text is visible in a region.
Then I should see "Welcome" in the "content"
Then I should see "Welcome" in the "content" region
Then I should see the text "Welcome" in the "content" region
@Then I should not see( the text) :text in the :region( region)
Assert text is not visible in a region.
Then I should not see "Error" in the "content"
Then I should not see "Error" in the "content" region
Then I should not see the text "Error" in the "content" region
@Then I should see the text :text
Assert text is visible on the page.
Then I should see the text "Welcome to Drupal"
@Then I should not see the text :text
Assert text is not visible on the page.
Then I should not see the text "Access denied"
@Then I should get a :code HTTP response
Assert the HTTP response code.
Then I should get a 200 HTTP response
@Then I should not get a :code HTTP response
Assert the HTTP response code is not a specific value.
Then I should not get a :code HTTP response