diff --git a/drupal-org-dev.make b/drupal-org-dev.make index ae39aaf..a4e572e 100644 --- a/drupal-org-dev.make +++ b/drupal-org-dev.make @@ -24,7 +24,7 @@ projects[panopoly_theme][download][branch] = 7.x-1.x projects[panopoly_magic][version] = 1.x-dev projects[panopoly_magic][subdir] = panopoly projects[panopoly_magic][download][type] = git -projects[panopoly_magic][download][revision] = 682cc47 +projects[panopoly_magic][download][revision] = f7ba789 projects[panopoly_magic][download][branch] = 7.x-1.x projects[panopoly_widgets][version] = 1.x-dev diff --git a/drupal-org.make b/drupal-org.make index ae39aaf..a4e572e 100644 --- a/drupal-org.make +++ b/drupal-org.make @@ -24,7 +24,7 @@ projects[panopoly_theme][download][branch] = 7.x-1.x projects[panopoly_magic][version] = 1.x-dev projects[panopoly_magic][subdir] = panopoly projects[panopoly_magic][download][type] = git -projects[panopoly_magic][download][revision] = 682cc47 +projects[panopoly_magic][download][revision] = f7ba789 projects[panopoly_magic][download][branch] = 7.x-1.x projects[panopoly_widgets][version] = 1.x-dev diff --git a/tests/behat/behat.template.yml b/tests/behat/behat.template.yml index 463988e..7601e89 100644 --- a/tests/behat/behat.template.yml +++ b/tests/behat/behat.template.yml @@ -17,6 +17,9 @@ default: Bryant Sidebar: ".bryant-sidebar" Bryant Flipped Content: ".bryant-flipped-content" Bryant Flipped Sidebar: ".bryant-flipped-sidebar" + # For Panels / Panopoly specific regions. + CTools modal: "#modalContent" + Live preview: "fieldset.widget-preview" # These are the regions for responsive_bartik. Header: ".region-header" Featured: ".region-featured" diff --git a/tests/behat/behat.travis.yml b/tests/behat/behat.travis.yml index be75731..12e86b8 100644 --- a/tests/behat/behat.travis.yml +++ b/tests/behat/behat.travis.yml @@ -19,6 +19,9 @@ default: Bryant Sidebar: ".bryant-sidebar" Bryant Flipped Content: ".bryant-flipped-content" Bryant Flipped Sidebar: ".bryant-flipped-sidebar" + # For Panels / Panopoly specific regions. + CTools modal: "#modalContent" + Live preview: "fieldset.widget-preview" # These are the regions for responsive_bartik. Header: ".region-header" Featured: ".region-featured" diff --git a/tests/behat/features/bootstrap/FeatureContext.php b/tests/behat/features/bootstrap/FeatureContext.php index b24e690..e0c2218 100644 --- a/tests/behat/features/bootstrap/FeatureContext.php +++ b/tests/behat/features/bootstrap/FeatureContext.php @@ -67,6 +67,24 @@ class FeatureContext extends DrupalContext } /** + * @Given /^Panopoly magic live previews are automatic$/ + * + * Enable live previews via Panopoly Magic. + */ + public function enableAutomaticPanopolyMagicLivePreview() { + $this->getDriver('drush')->vset('panopoly_magic_live_preview 1 --yes'); + } + + /** + * @Given /^Panopoly magic live previews are manual$/ + * + * Enable live previews via Panopoly Magic. + */ + public function enableManualPanopolyMagicLivePreview() { + $this->getDriver('drush')->vset('panopoly_magic_live_preview 2 --yes'); + } + + /** * @Given /^(?:|I )wait(?:| for) (\d+) seconds?$/ * * Wait for the given number of seconds. ONLY USE FOR DEBUGGING! diff --git a/tests/behat/features/bootstrap/PanelsSubContext.php b/tests/behat/features/bootstrap/PanelsSubContext.php index a0564d2..593c8db 100644 --- a/tests/behat/features/bootstrap/PanelsSubContext.php +++ b/tests/behat/features/bootstrap/PanelsSubContext.php @@ -54,4 +54,14 @@ class PanelsSubContext extends BehatContext implements DrupalSubContextInterface $this->getSession()->getPage()->clickLink('Customize this page'); $this->waitForIPEtoActivate(); } + + /** + * @When /^(?:|I )wait for live preview to finish$/ + * + * Wait until the live preview to finish. + */ + public function waitForLivePreview() { + $this->getSession()->wait(5000, 'jQuery(".form-submit").value == "Save"'); + } + } diff --git a/tests/behat/features/contentlist_widget.feature b/tests/behat/features/contentlist_widget.feature index 2b60e92..6e4dc99 100644 --- a/tests/behat/features/contentlist_widget.feature +++ b/tests/behat/features/contentlist_widget.feature @@ -19,12 +19,12 @@ Feature: Add content list widget And I click "Add content list" Then I should see "Configure new Add content list" When I fill in the following: - | widget_title | Content Page List Asc 1 | - | items_per_page | 1 | -# | Display Type | Fields | + | exposed[widget_title] | Content Page List Asc 1 | + | items_per_page | 1 | +# | Display Type | Fields | When I select "Content Page" from "exposed[type]" - And I select "Asc" from "exposed[sort_order]" - And I select "Title" from "exposed[sort_by]" + And I select "Asc" from "sort_order" + And I select "Title" from "sort_by" And I press "edit-return" And I press "Save as custom" And I wait for the Panels IPE to deactivate @@ -34,4 +34,4 @@ Feature: Add content list widget When I customize this page with the Panels IPE And I click "Settings" in the "Bryant Sidebar" region Then I should see "Configure Add content list" - And the "exposed[sort_by]" field should contain "Title" + And the "sort_by" field should contain "Title" diff --git a/tests/behat/features/livepreview.feature b/tests/behat/features/livepreview.feature new file mode 100644 index 0000000..5eceffb --- /dev/null +++ b/tests/behat/features/livepreview.feature @@ -0,0 +1,157 @@ +Feature: Live preview + In order to do more WYSIWYG + As a site administrator + I need to be able to have a live preview of my changes to the widgets + + @api @javascript + Scenario: Automatic live preview should show changes immediately + Given I am logged in as a user with the "administrator" role + And Panopoly magic live previews are automatic + When I visit "/node/add/panopoly-page" + And I fill in the following: + | Title | Testing text title | + | Editor | plain_text | + | body[und][0][value] | Testing text body | + And I press "Publish" + Then the "h1" element should contain "Testing text title" + When I customize this page with the Panels IPE + And I click "Add new pane" + And I click "Add table" + Then I should see "Configure new Add table" + When I fill in "Title" with "Widget title" + And I wait for live preview to finish + Then I should see "Widget title" in the "Live preview" region + When I fill in "tablefield_0_cell_0_0" with "c-1-r-1" + And I wait for live preview to finish + Then I should see "c-1-r-1" in the "Live preview" region + When I fill in "tablefield_0_cell_0_1" with "c-2-r-1" + And I wait for live preview to finish + Then I should see "c-2-r-1" in the "Live preview" region + # Test that we can make the title into a link + Then I should not see the link "Widget title" in the "Live preview" region + When I check the box "Make title a link" + And I wait for live preview to finish + And I fill in "path" with "http://drupal.org" + And I wait for live preview to finish + Then I should see the link "Widget title" in the "Live preview" region + When I press "Save" in the "CTools modal" region + And I press "Save as custom" + And I wait for the Panels IPE to deactivate + Then I should see "Widget title" + And I should see the link "Widget title" + And I should see "c-1-r-1" + And I should see "c-2-r-1" + + @api @javascript + Scenario: Live preview should work with views + Given I am logged in as a user with the "administrator" role + And Panopoly magic live previews are automatic + When I visit "/node/add/panopoly-page" + And I fill in the following: + | Title | Testing title | + | Editor | plain_text | + | body[und][0][value] | Testing body | + And I press "Publish" + Then the "h1" element should contain "Testing title" + When I customize this page with the Panels IPE + And I click "Add new pane" + And I click "Add content list" + Then I should see "Configure new Add content list" + When I fill in "widget_title" with "Content list widget" + And I wait for live preview to finish + Then I should see "Content list widget" in the "Live preview" region + # @todo: we need to test switching the content type, but there's only + # one included with our demo data. + # Test changing the "Items to Show". + Then I should see the link "Testing title" in the "Live preview" region + And I should see the link "Content Demo" in the "Live preview" region + And I should see the link "Lovely Vegetables" in the "Live preview" region + When I fill in "items_per_page" with "1" + And I wait for live preview to finish + Then I should see the link "Testing title" in the "Live preview" region + And I should not see the link "Content Demo" in the "Live preview" region + And I should not see the link "Lovely Vegetables" in the "Live preview" region + # Test changing the sort order. + When I fill in "exposed[sort_order]" with "ASC" + And I wait for live preview to finish + Then I should not see the link "Testing title" in the "Live preview" region + And I should see the link "Vegetables are Great" in the "Live preview" region + # Test changing the sort by. + When I fill in "exposed[sort_by]" with "title" + And I wait for live preview to finish + Then I should not see the link "Vegetables are Great" in the "Live preview" region + And I should see the link "Content Demo" in the "Live preview" region + # Test changing the Display Type to "Content". + Then I should not see the link "Read more" in the "Live preview" region + When I select the radio button "Content" + And I wait for live preview to finish + Then I should see the link "Read more" in the "Live preview" region + # Test changing the Display Type to "Table". + When I select the radio button "Table" + And I wait for live preview to finish + # @todo: How do I test that there is a table there? + Then I should not see the link "Read more" in the "Live preview" region + # Test enabling the table header. + Then I should not see "Image" in the "Live preview" region + And I should not see "Title" in the "Live preview" region + And I should not see "Date" in the "Live preview" region + And I should not see "Posted by" in the "Live preview" region + When I fill in "header_type" with "titles" + And I wait for live preview to finish + Then I should see "Image" in the "Live preview" region + And I should see "Title" in the "Live preview" region + And I should see "Date" in the "Live preview" region + And I should see "Posted by" in the "Live preview" region + # Test removing each of the fields. + When I uncheck the box "fields_override[field_featured_image]" + And I wait for live preview to finish + Then I should not see "Image" in the "Live preview" region + When I uncheck the box "fields_override[title]" + And I wait for live preview to finish + Then I should not see "Title" in the "Live preview" region + When I uncheck the box "fields_override[created]" + And I wait for live preview to finish + Then I should not see "Date" in the "Live preview" region + When I uncheck the box "fields_override[name]" + And I wait for live preview to finish + Then I should not see "Posted by" in the "Live preview" region + + @api @javascript + Scenario: Manual live preview should show changes when requested + Given I am logged in as a user with the "administrator" role + And Panopoly magic live previews are manual + When I visit "/node/add/panopoly-page" + And I fill in the following: + | Title | Testing text title | + | Editor | plain_text | + | body[und][0][value] | Testing text body | + And I press "Publish" + Then the "h1" element should contain "Testing text title" + When I customize this page with the Panels IPE + And I click "Add new pane" + And I click "Add text" + Then I should see "Configure new Add text" + When I fill in "Title" with "Widget title" + Then I should not see "Widget title" in the "Live preview" region + When I press "Update Preview" + And I wait for live preview to finish + Then I should see "Widget title" in the "Live preview" region + + @api @javascript + Scenario: Automatic live preview should validation errors immediately + Given I am logged in as a user with the "administrator" role + And Panopoly magic live previews are automatic + When I visit "/node/add/panopoly-page" + And I fill in the following: + | Title | Testing title | + | Editor | plain_text | + | body[und][0][value] | Testing body | + And I press "Publish" + Then the "h1" element should contain "Testing title" + When I customize this page with the Panels IPE + And I click "Add new pane" + And I click "Add spotlight" + Then I should see "Configure new Add spotlight" + When I fill in "Description" with "Testing description" + And I wait for live preview to finish + Then I should see "Image field is required"