Skip to main content

Page regions

DrevOps\BehatSteps\Steps\Web\RegionTrait - Source, Example, Helpers

Interact with and assert against named page regions.

  • Click links, press buttons, fill fields and toggle checkboxes in a region.
  • Assert text, headings, links, buttons and elements within a region.

A region name resolves through the region Mink selector, which reads the regions: map in the extension configuration. Every step throws when the name is not mapped or the mapped selector matches nothing on the page.

Steps​

@When I follow the link :link in the region :region

Click a link within a region

When I follow the link "Read more" in the region "content"
@When I press the button :button in the region :region

Press a button within a region

When I press the button "Save" in the region "sidebar"
@When I fill in the field :field with :value in the region :region

Fill a field within a region

When I fill in the field "Search" with "test" in the region "header"
@When I check the checkbox :checkbox in the region :region

Check a checkbox within a region

When I check the checkbox "Published" in the region "content"
@When I uncheck the checkbox :checkbox in the region :region

Uncheck a checkbox within a region

When I uncheck the checkbox "Promoted" in the region "content"
@Then I should see the text :text in the region :region

Assert that the text of a region contains a string

Then I should see the text "Welcome" in the region "content"
@Then I should not see the text :text in the region :region

Assert that the text of a region does not contain a string

Then I should not see the text "Error" in the region "content"
@Then I should see the heading :heading in the region :region

Assert that a region contains the heading

Then I should see the heading "Latest news" in the region "sidebar"
@Then I should not see the heading :heading in the region :region

Assert that a region does not contain the heading

Then I should not see the heading "Admin" in the region "sidebar"
@Then I should see the link :link in the region :region

Assert that a region contains the link

Then I should see the link "About us" in the region "footer"
@Then I should not see the link :link in the region :region

Assert that a region does not contain the link

Then I should not see the link "Admin" in the region "footer"
@Then I should see the button :button in the region :region

Assert that a region contains the button

Then I should see the button "Save" in the region "content"
@Then I should not see the button :button in the region :region

Assert that a region does not contain the button

Then I should not see the button "Delete" in the region "content"
@Then the element :selector in the region :region should exist

Assert that a region contains an element matching the selector

Then the element "blockquote" in the region "content" should exist
@Then the element :selector in the region :region should not exist

Assert that a region contains no element matching the selector

Then the element "blockquote" in the region "content" should not exist
@Then the element :selector in the region :region should have the value :value

Assert that an element in a region has text exactly equal to a value

Then the element "h2" in the region "content" should have the value "News"
@Then the element :selector in the region :region should not have the value :value

Assert that no element in a region has text exactly equal to a value

Then the element "h2" in the region "content" should not have the value "News"
@Then the element :selector in the region :region should have the attribute :attribute with the value :value

Assert that an element in a region has the attribute value

Then the element "img" in the region "content" should have the attribute "alt" with the value "Logo"
@Then the element :selector with the text :text in the region :region should have the attribute :attribute with the value :value

Assert that an element in a region with the text has the attribute value

Then the element "a" with the text "Home" in the region "header" should have the attribute "href" with the value "/"
@Then the element :selector with the text :text in the region :region should have the CSS property :property with the value :value

Assert that an element in a region with the text has the CSS value

Then the element "span" with the text "New" in the region "content" should have the CSS property "color" with the value "rgb(255, 0, 0)"