From f639e74ce7406d20a7764db952438da03f5f7a9d Mon Sep 17 00:00:00 2001 From: Prital Patel Date: Wed, 29 Jun 2016 22:24:35 +0530 Subject: [PATCH 1/2] Fix the issue #37 --- .../Step/Acceptance/Administrator/Content.php | 16 +++--- .../Step/Acceptance/Administrator/User.php | 54 ++++++++----------- tests/acceptance/content.feature | 10 ++-- tests/acceptance/users.feature | 38 ++++++------- 4 files changed, 53 insertions(+), 65 deletions(-) diff --git a/tests/_support/Step/Acceptance/Administrator/Content.php b/tests/_support/Step/Acceptance/Administrator/Content.php index 4290a648ce..3c6c9ddc72 100644 --- a/tests/_support/Step/Acceptance/Administrator/Content.php +++ b/tests/_support/Step/Acceptance/Administrator/Content.php @@ -37,12 +37,12 @@ public function iSaveAnArticle() } /** - * @Then I wait for the title :title and see the message :message + * @Then I should see the :arg1 message */ - public function iShouldSeeTheMessage($title, $message) + public function iShouldSeeTheMessage($message) { $I = $this; - $I->waitForPageTitle($title); + $I->waitForText($message, 60, AdminPage::$systemMessageContainer); $I->see($message, AdminPage::$systemMessageContainer); } @@ -68,13 +68,13 @@ public function iFeatureTheContentWithTitle() } /** - * @Then I save and see the :arg1 message + * @When I save an article */ - /*public function iSaveAndSeeTheMessage($message) + /*public function iSavearticle() { $I = $this; - $I->waitForPageTitle($message, AdminPage::$systemMessageContainer); - $I->see($message, AdminPage::$systemMessageContainer); + $I->clickToolbarButton('save'); + }*/ /** @@ -109,7 +109,7 @@ public function iSaveTheArticle() } /** - * @Given I have article with name :arg1 + * @Given I have article with name :title */ public function iHaveArticleWithName($title) { diff --git a/tests/_support/Step/Acceptance/Administrator/User.php b/tests/_support/Step/Acceptance/Administrator/User.php index 58621f85b3..89dbee4c00 100644 --- a/tests/_support/Step/Acceptance/Administrator/User.php +++ b/tests/_support/Step/Acceptance/Administrator/User.php @@ -33,7 +33,7 @@ public function iCreateNewUser($name, $username, $password, $email) } /** - * @When I Save the user + * @When I Save the user */ public function iSaveTheUser() { @@ -42,12 +42,12 @@ public function iSaveTheUser() } /** - * @Then I should wait for the title :title and see the message :message + * @Then I should see the :arg1 message */ - public function iSeeTheMessage($title, $message) + public function iSeeTheMessage($message) { $I = $this; - $I->waitForPageTitle($title); + $I->waitForText($message, 60, AdminPage::$systemMessageContainer); $I->see($message, AdminPage::$systemMessageContainer); } @@ -80,13 +80,13 @@ public function iAssignedNameAndUserGroup($name, $userGroup) /** * @Then I should wait for :arg1 title and see the :arg2 message */ - public function iShouldDisplayTheMessage($title, $message) + /*public function iShouldDisplayTheMessage($title, $message) { $I = $this; $I->clickToolbarButton('Save & Close'); $I->waitForPageTitle($title); $I->see($message, AdminPage::$systemMessageContainer); - } + }*/ /** * @Given I have a user with user name :username @@ -110,14 +110,14 @@ public function iBlockTheUser() } /** - * @Then I wait for the title :title and see the message :message + * @Then I should see the user block message :arg1 */ - public function iShouldSeeTheUserBlockMessage($title, $message) + /*public function iShouldSeeTheUserBlockMessage($message) { $I = $this; - $I->waitForPageTitle($title); + $I->waitForText($message, 60, AdminPage::$systemMessageContainer); $I->see($message, AdminPage::$systemMessageContainer); - } + }*/ /** * @Given I have a blocked user with user name :username @@ -137,7 +137,6 @@ public function iHaveABlockedUserWithUserName($username) public function iUnblockTheUser() { $I = $this; - $I->waitForPageTitle('Users'); $I->clickToolbarButton('unblock'); } @@ -168,13 +167,13 @@ public function iDeleteTheUser($username) /** * @Then I confirm the user should have been deleted by getting the title :title and see the message :message */ - public function iConfirmTheUserDeleteSucessfully($title, $message) + /*public function iConfirmTheUserDeleteSucessfully($title, $message) { $I = $this; $I->checkForPhpNoticesOrWarnings(); $I->waitForPageTitle($title); $I->see($message, AdminPage::$systemMessageContainer); - } + }*/ /** * @Given There is an user link @@ -226,7 +225,7 @@ public function iSetAssignedUserGroupAsAnAdministrator() $I->click('Assigned User Groups'); $I->checkOption('#1group_7'); } - + /** * @Then Login in backend with username :username and password :password */ @@ -298,16 +297,6 @@ public function iSaveTheGroup() $I->clickToolbarButton('Save & Close'); } - /** - * @Then I should wait for :title title and see the message :message - */ - public function iShouldSeeTheMessage($title, $message) - { - $I = $this; - $I->waitForPageTitle($title); - $I->see($message, AdminPage::$systemMessageContainer); - } - /** * @Given I search and select the Group with name :grouptitle */ @@ -330,7 +319,6 @@ public function iSetGroupTitleAsA($GroupTitle) $I->fillField(UserManagerPage::$title, $GroupTitle); } - /** * @When I Delete the Group :arg1 */ @@ -348,13 +336,13 @@ public function iDeleteTheGroup($GroupTitle) /** * @Then I confirm the group should have been deleted by getting the title :title and see the message :message */ - public function iDeleteUserGroup($title, $message) + /*public function iDeleteUserGroup($title, $message) { $I = $this; $I->checkForPhpNoticesOrWarnings(); $I->waitForPageTitle($title); $I->see($message, AdminPage::$systemMessageContainer); - } + }*/ /** * @Given There is a add viewing access level link @@ -388,12 +376,12 @@ public function iSaveTheAccessLevel() /** * @Then I wait for the title :title see the message :message */ - public function iShouldBeSeeTheMessage($title, $message) + /*public function iShouldBeSeeTheMessage($title, $message) { $I = $this; $I->waitForPageTitle($title); $I->see($message, AdminPage::$systemMessageContainer); - } + }*/ /** * @Given I search and select the Access Level with name :leveltitle @@ -420,11 +408,11 @@ public function iSetAccessLevelTitleAsA($LevelTitle) /** * @When I save Access Level */ - public function iSaveAccessLevel() + /*public function iSaveAccessLevel() { $I = $this; $I->clickToolbarButton('Save & Close'); - } + }*/ /** * @When I Delete the Access level :leveltitle @@ -443,13 +431,13 @@ public function iDeleteTheAccessLeVel($LevelTitle) /** * @Then I confirm the Access Level have been deleted by getting the title :title and see the message :message */ - public function iDeleteAccessLevel($title, $message) + /*public function iDeleteAccessLevel($title, $message) { $I = $this; $I->checkForPhpNoticesOrWarnings(); $I->waitForPageTitle($title); $I->see($message, AdminPage::$systemMessageContainer); - } + }*/ /** * @Given There is a User link */ diff --git a/tests/acceptance/content.feature b/tests/acceptance/content.feature index 439275b2fe..6a7c8031bb 100644 --- a/tests/acceptance/content.feature +++ b/tests/acceptance/content.feature @@ -12,26 +12,26 @@ Feature: content Given There is a add content link When I create new content with field title as "My_Article" and content as a "This is my first article" And I save an article - Then I wait for the title "Articles" and see the message "Article successfully saved." + Then I should see the "Article successfully saved." message Scenario: Feature an Article Given I search and select content article with title "My_Article" When I featured the article - Then I wait for the title "Articles" and see the message "1 article featured." + Then I should see the "1 article featured." message Scenario: Modify an article Given I select the content article with title "My_Article" And I set access level as a "Registered" When I save the article - Then I wait for the title "Articles" and see the message "Article successfully saved." + Then I should see the "Article successfully saved." message Scenario: Unpublish an article Given I have article with name "My_Article" When I unpublish the article - Then I wait for title "Articles" and see the unpublish message "1 article unpublished." + Then I should see the "1 article unpublished." message Scenario: Trash an article Given I have "My_Article" content article which needs to be Trash When I Trash the article - Then I wait for the title "Articles" and see article trash message "1 article trashed." + Then I should see the "1 article trashed." message diff --git a/tests/acceptance/users.feature b/tests/acceptance/users.feature index 4d95435c17..db5864ad08 100644 --- a/tests/acceptance/users.feature +++ b/tests/acceptance/users.feature @@ -16,41 +16,41 @@ Feature: users Scenario: Create a add new user Given There is a add user link When I create new user with fields Name "register", Login Name "register", Password "register" and Email "register@gmail.com" - And I Save the user - Then I should wait for the title "Users" and see the message "User successfully saved." + And I Save the user + Then I should see the "User successfully saved." message Scenario: Edit user Given I search and select the user with user name "register" When I set name as an "Editor" and User Group as "Editor" - And I Save the user - Then I should wait for the title "Users" and see the message "User successfully saved." + And I Save the user + Then I should see the "User successfully saved." message Scenario: Block a User Given I have a user with user name "register" When I block the user - Then I wait for the title "Users" and see the message "User blocked." + Then I should see the "User blocked." message - Scenario: Unblock user - Given I have a blocked user with user name "register" - When I unblock the user - Then I wait for the title "Users" and see the message "User enabled." +# Scenario: Unblock user +# Given I have a blocked user with user name "register" +# When I unblock the user +# Then I should see the "User enabled." message Scenario: Delete user Given I have a user with user name "Editor" When I Delete the user "Editor" - Then I confirm the user should have been deleted by getting the title "Users" and see the message "1 user successfully deleted." + Then I should see the "1 user successfully deleted." message Scenario: Create super admin and login into the backend Given There is a add user link And I fill a super admin with fields Name "prital", Login Name "prital", Password "prital", and Email "prital@gmail.com" When I set assigned user group as an Administrator - And I Save the user + And I Save the user Then Login in backend with username "prital" and password "prital" Scenario: Create User without username fails Given There is a add user link When I don't fill Login Name but fulfill remaining mandatory fields: Name "piyu", Password "piyu" and Email "piyu@gmail.com" - And I Save the user + And I Save the user Then I see the title "Users: New" But I see the alert error "Invalid field: Login Name" @@ -58,35 +58,35 @@ Feature: users Given There is a add new group link When I fill Group Title as a "Gsoc" And I save the Group - Then I should wait for "Users: Groups" title and see the message "Group successfully saved." + Then I should see the "Group successfully saved." message Scenario: Edit group Given I search and select the Group with name "Gsoc" And I set group Title as a "Gsoc_admin" When I save the Group - Then I should wait for "Users: Groups" title and see the message "Group successfully saved." + Then I should see the "Group successfully saved." message Scenario: Delete Group Given I search and select the Group with name "Gsoc_admin" When I Delete the Group "Gsoc_admin" - Then I confirm the group should have been deleted by getting the title "Users: Groups" and see the message "1 User Group successfully deleted." + Then I should see the "1 User Group successfully deleted." message Scenario: Create ACL level Given There is a add viewing access level link When I fill Level Title as a "joomla" and set Access as a public And I save the Access Level - Then I wait for the title "Users: Viewing Access Levels" see the message "Access level successfully saved." + Then I should see the "Access level successfully saved." message Scenario: Edit ACL Given I search and select the Access Level with name "joomla" And I set Access Level title as a "Gsoc_joomla" - When I save Access Level - Then I wait for the title "Users: Viewing Access Levels" and see the message "Access level successfully saved." + When I save the Access Level + Then I should see the "Access level successfully saved." message Scenario: Delete ACL Given I search and select the Access Level with name "Gsoc_joomla" When I Delete the Access level "Gsoc_joomla" - Then I confirm the Access Level have been deleted by getting the title "Users: Viewing Access Levels" and see the message "1 View Access Level successfully removed." + Then I should see the "1 View Access Level successfully removed." message Scenario: User settings (Allow user registration) Given There is a User link From 9dd70e7be00faa01a1910d7ec3e94715cf9417a5 Mon Sep 17 00:00:00 2001 From: Prital Patel Date: Wed, 29 Jun 2016 22:34:05 +0530 Subject: [PATCH 2/2] Remove the commented code --- .../Step/Acceptance/Administrator/Content.php | 12 +-- .../Step/Acceptance/Administrator/User.php | 84 ------------------- 2 files changed, 1 insertion(+), 95 deletions(-) diff --git a/tests/_support/Step/Acceptance/Administrator/Content.php b/tests/_support/Step/Acceptance/Administrator/Content.php index 3c6c9ddc72..6d752020d9 100644 --- a/tests/_support/Step/Acceptance/Administrator/Content.php +++ b/tests/_support/Step/Acceptance/Administrator/Content.php @@ -67,16 +67,6 @@ public function iFeatureTheContentWithTitle() $I->clickToolbarButton('featured'); } - /** - * @When I save an article - */ - /*public function iSavearticle() - { - $I = $this; - $I->clickToolbarButton('save'); - - }*/ - /** * @Given I select the content article with title :arg1 */ @@ -169,4 +159,4 @@ public function iSeeArticleTrashMessage($title, $message) $I->waitForPageTitle($title); $I->see($message, AdminPage::$systemMessageContainer); } -} \ No newline at end of file +} diff --git a/tests/_support/Step/Acceptance/Administrator/User.php b/tests/_support/Step/Acceptance/Administrator/User.php index 89dbee4c00..24d22b1e14 100644 --- a/tests/_support/Step/Acceptance/Administrator/User.php +++ b/tests/_support/Step/Acceptance/Administrator/User.php @@ -77,17 +77,6 @@ public function iAssignedNameAndUserGroup($name, $userGroup) $I->checkOption('#1group_4'); } - /** - * @Then I should wait for :arg1 title and see the :arg2 message - */ - /*public function iShouldDisplayTheMessage($title, $message) - { - $I = $this; - $I->clickToolbarButton('Save & Close'); - $I->waitForPageTitle($title); - $I->see($message, AdminPage::$systemMessageContainer); - }*/ - /** * @Given I have a user with user name :username */ @@ -109,16 +98,6 @@ public function iBlockTheUser() $I->clickToolbarButton('unpublish'); } - /** - * @Then I should see the user block message :arg1 - */ - /*public function iShouldSeeTheUserBlockMessage($message) - { - $I = $this; - $I->waitForText($message, 60, AdminPage::$systemMessageContainer); - $I->see($message, AdminPage::$systemMessageContainer); - }*/ - /** * @Given I have a blocked user with user name :username */ @@ -140,16 +119,6 @@ public function iUnblockTheUser() $I->clickToolbarButton('unblock'); } - /** - * @Then I should see the user unblock message :message - */ - /*public function iShouldSeeTheUserUnblockMessage($message) - { - $I = $this; - $I->waitForPageTitle($message, AdminPage::$systemMessageContainer); - $I->see($message, AdminPage::$systemMessageContainer); - }*/ - /** * @When I Delete the user :username */ @@ -164,17 +133,6 @@ public function iDeleteTheUser($username) $I->acceptPopup(); } - /** - * @Then I confirm the user should have been deleted by getting the title :title and see the message :message - */ - /*public function iConfirmTheUserDeleteSucessfully($title, $message) - { - $I = $this; - $I->checkForPhpNoticesOrWarnings(); - $I->waitForPageTitle($title); - $I->see($message, AdminPage::$systemMessageContainer); - }*/ - /** * @Given There is an user link */ @@ -333,17 +291,6 @@ public function iDeleteTheGroup($GroupTitle) $I->acceptPopup(); } - /** - * @Then I confirm the group should have been deleted by getting the title :title and see the message :message - */ - /*public function iDeleteUserGroup($title, $message) - { - $I = $this; - $I->checkForPhpNoticesOrWarnings(); - $I->waitForPageTitle($title); - $I->see($message, AdminPage::$systemMessageContainer); - }*/ - /** * @Given There is a add viewing access level link */ @@ -373,16 +320,6 @@ public function iSaveTheAccessLevel() $I->clickToolbarButton('Save & Close'); } - /** - * @Then I wait for the title :title see the message :message - */ - /*public function iShouldBeSeeTheMessage($title, $message) - { - $I = $this; - $I->waitForPageTitle($title); - $I->see($message, AdminPage::$systemMessageContainer); - }*/ - /** * @Given I search and select the Access Level with name :leveltitle */ @@ -405,15 +342,6 @@ public function iSetAccessLevelTitleAsA($LevelTitle) $I->fillField(UserManagerPage::$title, $LevelTitle); } - /** - * @When I save Access Level - */ - /*public function iSaveAccessLevel() - { - $I = $this; - $I->clickToolbarButton('Save & Close'); - }*/ - /** * @When I Delete the Access level :leveltitle */ @@ -428,16 +356,6 @@ public function iDeleteTheAccessLeVel($LevelTitle) $I->acceptPopup(); } - /** - * @Then I confirm the Access Level have been deleted by getting the title :title and see the message :message - */ - /*public function iDeleteAccessLevel($title, $message) - { - $I = $this; - $I->checkForPhpNoticesOrWarnings(); - $I->waitForPageTitle($title); - $I->see($message, AdminPage::$systemMessageContainer); - }*/ /** * @Given There is a User link */ @@ -484,6 +402,4 @@ public function iShouldBeSeeTheLinkCreateAnAccountInFrontend() $I = $this; $I->click(['class' => 'brand visible-desktop visible-tablet']); } - - }