diff --git a/tests/behat.common.yml b/tests/behat.common.yml index fa659f5..746897b 100644 --- a/tests/behat.common.yml +++ b/tests/behat.common.yml @@ -62,9 +62,6 @@ default: Footer: ".region-footer" Search: "#search-form" Panopoly Magic Style Settings: "#panels-edit-style-settings-form #edit-general-settings" - subcontexts: - paths: - - "./profiles/panopoly" # Setup for Google Chrome only tests. chrome: diff --git a/tests/features/contentpage.feature b/tests/features/contentpage.feature index 76ae053..98f9516 100644 --- a/tests/features/contentpage.feature +++ b/tests/features/contentpage.feature @@ -23,7 +23,7 @@ Feature: Add content page @api @javascript @panopoly_pages @local_files Scenario: Add a Featured Image with incorrect dimensions When I attach the file "test-sm.png" to "files[field_featured_image_und_0]" - And I wait 5 seconds + And I wait 2 seconds Then I should see "The specified file test-sm.png could not be uploaded. The image is too small; the minimum dimensions are 300x200 pixels." @api @javascript @panopoly_pages @local_files @@ -35,7 +35,7 @@ Feature: Add content page | Editor | plain_text | | body[und][0][value] | Testing body | And I attach the file "test-lg.png" to "files[field_featured_image_und_0]" - And I wait 5 seconds + And I wait 2 seconds Then I should not see "The specified file test-lg.png could not be uploaded. The image is too small; the minimum dimensions are 300x200 pixels." When I fill in "Alt Text" with "Panopoly rocks" #And I press "Publish" diff --git a/tests/features/hidden_view_mode_options.feature b/tests/features/hidden_view_mode_options.feature index 62cd6b1..410d214 100644 --- a/tests/features/hidden_view_mode_options.feature +++ b/tests/features/hidden_view_mode_options.feature @@ -31,7 +31,7 @@ Feature: Hidden view mode options And I run drush "vdel" "panopoly_magic_hidden_view_mode_options -y" And I visit "/admin/panopoly/settings/panopoly_magic" When I click "Show Advanced" - And I fill in "Hidden view mode options" with "diff_standard" + And I fill in "Hidden view mode options" with "full\nteaser\nfeatured\ndiff_standard" And I press "Save configuration" Given I am viewing a landing page When I customize this page with the Panels IPE @@ -40,7 +40,10 @@ Feature: Hidden view mode options And I click "View: Magic View Modes: Fields" in the "CTools modal" region Then I should see "Configure new View: Magic View Modes: Fields" When I select the radio button "Content" - Then I should not see the radio button "Revision comparison" + Then I should not see the radio button "Full content" + And I should not see the radio button "Teaser" + And I should not see the radio button "Featured" + And I should not see the radio button "Revision comparison" And I should see the radio button "RSS" And I should see the radio button "Search index" And I should see the radio button "Search result" diff --git a/tests/features/wysiwyg_media.feature b/tests/features/wysiwyg_media.feature index 434a2b0..80346c3 100644 --- a/tests/features/wysiwyg_media.feature +++ b/tests/features/wysiwyg_media.feature @@ -114,7 +114,7 @@ Feature: Add media using the rich text editor # We need to set the alt/title text differently in the two steps that ask # for it - so, that we can test that the 2nd overrides. When I fill in the following: - | Alt Text | Alt & some > character's < | + | Alt Text | Alt & some > "character's" < | | Title Text | Title & some > "character's" < | And I press "Save" When I wait 2 seconds @@ -125,14 +125,14 @@ Feature: Add media using the rich text editor When I press "edit-submit" # See the image with the 2nd alt text. Then I should see the "img" element in the "Bryant Content" region - And I should see the image alt "Alt & some > character's <" in the "Bryant Content" region + And I should see the image alt "Alt & some > \"character's\" <" in the "Bryant Content" region # Next, we edit the node again, so we can verify that the second # alt text will load when editing the image again. When I click "Edit" in the "Tabs" region And I click the "img" element in the "edit-body-und-0-value" WYSIWYG editor And I click the "Add media" button in the "edit-body-und-0-value" WYSIWYG editor And I switch to the frame "mediaStyleSelector" - Then the "Alt Text" field should contain "Alt & some > character's <" + Then the "Alt Text" field should contain "Alt & some > \"character's\" <" And the "Title Text" field should contain "Title & some > \"character's\" <" And I switch out of all frames diff --git a/tests/steps/panopoly_test.behat.inc b/tests/steps/panopoly_test.behat.inc index 50b9a3b..af79cbf 100644 --- a/tests/steps/panopoly_test.behat.inc +++ b/tests/steps/panopoly_test.behat.inc @@ -150,6 +150,18 @@ class TestSubContext extends RawDrupalContext implements DrupalSubContextInterfa } /** + * Convert escaped characters in arguments. + * + * @Transform :value + * @Transform :text + */ + public function escapeTextArguments($argument) { + $argument = str_replace('\\"', '"', $argument); + $argument = str_replace('\n', "\n", $argument); + return $argument; + } + + /** * Copies the provided file into the site's files directory. * * @Given the managed file :filename @@ -494,7 +506,7 @@ class TestSubContext extends RawDrupalContext implements DrupalSubContextInterfa /** * Asserts that an image is present and not broken. * - * @Then I should see an image in the :region region$/ + * @Then I should see an image in the :region region */ public function assertValidImageRegion($region) { $regionObj = $this->getRegion($region); @@ -538,17 +550,20 @@ class TestSubContext extends RawDrupalContext implements DrupalSubContextInterfa /** - * @Then I should see the image alt :alt in the :region region + * @Then I should see the image alt :text in the :region region + * @Then /^I should see the image alt "(?P(?:[^"]|\\")*)" in the "(?P[^"]*)"(?:| region)$/ + * + * NOTE: We specify a regex to allow escaped quotes in the alt text. */ - public function assertAltRegion($alt, $region) { + public function assertAltRegion($text, $region) { $regionObj = $this->getRegion($region); $element = $regionObj->find('css', 'img'); $tmp = $element->getAttribute('alt'); - if ($alt == $tmp) { - $result = $alt; + if ($text == $tmp) { + $result = $text; } if (empty($result)) { - throw new \Exception(sprintf('No alt text matching "%s" in the "%s" region on the page %s', $alt, $region, $this->getSession()->getCurrentUrl())); + throw new \Exception(sprintf('No alt text matching "%s" in the "%s" region on the page %s', $text, $region, $this->getSession()->getCurrentUrl())); } }