Skip to content
This repository has been archived by the owner on Jul 1, 2022. It is now read-only.

Behat tests for paragraphs #133

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion behat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ default:
autoload: false
region_map:
header: '#page-head'
content: '#main-content'
header_area: '#edit-group-header-area'
content: '.main-region'
content_area: '#edit-group-content-area'
sidebar: '.sidebar-rigeon'
sidebar_area: '#edit-group-sidebar-area'
footer: 'footer'
dropdown_menu: 'ul.nav.dropdown-menu'
selectors:
Expand Down
24 changes: 24 additions & 0 deletions tests/features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,28 @@ public function iCreateItemInTheMenu($menu_item, $menu_name) {
$element->findButton('Save')->click();
}

/**
* Quickly adding existing media to the field.
*
* Supported values have format like "media:1".
*
* @Given /^I fill media field "([^"]*)" with "([^"]*)"$/
*/
public function iFillMediaFieldWith($field, $value) {
$this->getSession()->getPage()->find('css',
'input[id="' . $field . '"]')->setValue($value);
}

/**
* Wait some amount of seconds.
*
* @param int $seconds
* Amount of seconds when nothing to happens.
*
* @Given /^(?:|I )wait (\d+) seconds$/
*/
public function waitSeconds($seconds) {
sleep($seconds);
}

}
Binary file added tests/features/menus_and_blocks/childcare.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/features/menus_and_blocks/menus.feature
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Feature: Menus

Scenario: Create footer menu right item and check
Given I am logged in as a user with the "Administrator" role
And I create an item "JOIN" in the "footer-menu-center" menu
And I create an item "JOIN" in the "footer-menu-right" menu
When I am an anonymous user
And I go to homepage
Then I should see "JOIN" in the "footer"
Expand Down
108 changes: 108 additions & 0 deletions tests/features/paragraphs/static_paragraphs.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
@openy @api
Feature: Static Paragraphs
Check that static paragraphs can be created and displayed

Background: Create basic landing page
Given I am logged in as a user with the "Administrator" role
And I go to "/node/add/landing_page"
And I fill in "Title" with "Landing"
And I select "One Column" from "Layout"

Scenario: Create Small Banner
When I press "Add Small Banner" in the "header_area"
And I fill in the following:
|Headline | MY SMALL BANNER |
And I fill media field "edit-field-prgf-image-target-id" with "media:1"
And I select "Green" from "Color"
And I press "Save and publish"
Then I should see "MY SMALL BANNER"
And I should see a ".banner-image img" element

Scenario: Create Banner
When I press "Add Banner" in the "header_area"
When I fill in the following:
|Headline | MY BANNER |
|Description | Enjoy the OpenY |
|URL | http://openymca.org |
|Link text | Read about OpenY |
And I fill media field "edit-field-prgf-image-target-id" with "media:1"
And I press "Save and publish"
Then I should see the heading "MY BANNER"
And I should see the text "Enjoy the OpenY"
And I should see a ".banner-image img" element
And I should see the link "Read about OpenY"

Scenario: Create Gallery
When I press "Add Gallery" in the "header_area"
And I fill in the following:
| Headline | My Gallery |
| Description | The description is here. |
| URL | http://openymca.org |
| Link text | Read about OpenY |
And I fill media field "edit-field-prgf-images-target-id" with "media:1 media:3"
And I press "Save and publish"
Then I should see the heading "My Gallery"
And I should see "The description is here."
And I should see ".carousel img"
And I should see the link "Read about OpenY"

Scenario: Create Simple Content
When I press "Add Simple content" in the "content_area"
And I fill in "Content" with "Simple text is here."
And I press "Save and publish"
Then I should see "Simple text is here."

Scenario: Create Grid Content
When I press "Add Grid Content"
And I select "2 items per row" from "Style"
And I fill in the following:
| Headline | We Appreciate Your Support |
| Icon Class | flag |
| Description | Every year, we rely on donations. |
| URL | /donate |
| Link text | Donate |
And I press "Save and publish"
Then I should see the heading "We Appreciate Your Support"
And I should see a "i.fa-flag" element
And I should see "Every year, we rely on donations."
And I should see the link "Donate"

Scenario: Create Promo Card
When I press "Add Promo Card" in the "sidebar_area"
And I fill in "Title" with "Promo" in the "sidebar_area"
And I fill in the following:
| Headline | OpenY is free to try! |
| Description | Setup a website and see how it works. |
| URL | http://openymca.org |
| Link text | Go! |
And I press "Save and publish"
Then I should see the heading "Promo"
And I should see the heading "OpenY is free to try!"
And I should see "Setup a website and see how it works."
And I should see the link "Go!"

Scenario: Create Story Card
When I press "Add Story Card" in the "sidebar_area"
And I fill in "Title" with "New Story" in the "sidebar_area"
And I fill in the following:
| Headline | I discovered OpenY. And that looks great! |
| URL | http://openymca.org |
| Link text| Discover OpenY |
And I press "Save and publish"
Then I should see the heading "New Story"
And I should see "I discovered OpenY. And that looks great!"
And I should see the link "Discover OpenY"

Scenario: Create Teaser
When I press "Add Teaser" in the "content_area"
And I fill in "Title" with "My Teaser" in the "content_area"
And I fill in the following:
| Description | Lorem ipsum dolor sit. |
| URL | /test |
| Link text | Test link |
And I fill media field "edit-field-prgf-image-target-id" with "media:1"
And I press "Save and publish"
Then I should see the heading "My Teaser"
And I should see "Lorem ipsum dolor sit."
And I should see a ".subprogram-listing-item img" element
And I should see the link "Test link"