From f639e74ce7406d20a7764db952438da03f5f7a9d Mon Sep 17 00:00:00 2001 From: Prital Patel Date: Wed, 29 Jun 2016 22:24:35 +0530 Subject: [PATCH 1/6] 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/6] 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']); } - - } From da4ff772eb9952cbccc5be4f2c3a3b6a7b4767ee Mon Sep 17 00:00:00 2001 From: Prital Patel Date: Wed, 29 Jun 2016 23:05:26 +0530 Subject: [PATCH 3/6] Every page object have the $url property --- .../Administrator/ArticleManagerPage.php | 2 +- .../Acceptance/Administrator/LoginPage.php | 2 +- .../Acceptance/Administrator/UserAclPage.php | 2 +- .../Administrator/UserGroupPage.php | 2 +- .../Administrator/UserManagerPage.php | 2 +- .../Step/Acceptance/Administrator/Content.php | 10 +++---- .../Step/Acceptance/Administrator/User.php | 26 +++++++++---------- 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/tests/_support/Page/Acceptance/Administrator/ArticleManagerPage.php b/tests/_support/Page/Acceptance/Administrator/ArticleManagerPage.php index 2b65fc5f64..d735430aeb 100644 --- a/tests/_support/Page/Acceptance/Administrator/ArticleManagerPage.php +++ b/tests/_support/Page/Acceptance/Administrator/ArticleManagerPage.php @@ -15,6 +15,6 @@ class ArticleManagerPage extends AdminPage public static $iconSearch = ['class' => 'icon-search']; - public static $pageURL = "/administrator/index.php?option=com_content&view=articles"; + public static $url = "/administrator/index.php?option=com_content&view=articles"; } diff --git a/tests/_support/Page/Acceptance/Administrator/LoginPage.php b/tests/_support/Page/Acceptance/Administrator/LoginPage.php index 3b4a5a7c0c..a5b3b63269 100644 --- a/tests/_support/Page/Acceptance/Administrator/LoginPage.php +++ b/tests/_support/Page/Acceptance/Administrator/LoginPage.php @@ -13,5 +13,5 @@ class LoginPage extends AdminPage public static $loginButton = ['css' => 'button[data-tests="log in"]']; - public static $pageURL = "/administrator/index.php"; + public static $url = "/administrator/index.php"; } \ No newline at end of file diff --git a/tests/_support/Page/Acceptance/Administrator/UserAclPage.php b/tests/_support/Page/Acceptance/Administrator/UserAclPage.php index d97299fc00..080f8ae889 100644 --- a/tests/_support/Page/Acceptance/Administrator/UserAclPage.php +++ b/tests/_support/Page/Acceptance/Administrator/UserAclPage.php @@ -6,6 +6,6 @@ class UserAclPage extends AdminPage { // include url of current page - public static $aclPageURL = 'administrator/index.php?option=com_users&view=levels'; + public static $url = 'administrator/index.php?option=com_users&view=levels'; } diff --git a/tests/_support/Page/Acceptance/Administrator/UserGroupPage.php b/tests/_support/Page/Acceptance/Administrator/UserGroupPage.php index edcdad65a4..03095aae91 100644 --- a/tests/_support/Page/Acceptance/Administrator/UserGroupPage.php +++ b/tests/_support/Page/Acceptance/Administrator/UserGroupPage.php @@ -6,7 +6,7 @@ class UserGroupPage extends AdminPage { // include url of current page - public static $groupPageURL = 'administrator/index.php?option=com_users&view=groups'; + public static $url = 'administrator/index.php?option=com_users&view=groups'; } diff --git a/tests/_support/Page/Acceptance/Administrator/UserManagerPage.php b/tests/_support/Page/Acceptance/Administrator/UserManagerPage.php index 7b64e2f7b9..20c349ca83 100644 --- a/tests/_support/Page/Acceptance/Administrator/UserManagerPage.php +++ b/tests/_support/Page/Acceptance/Administrator/UserManagerPage.php @@ -21,5 +21,5 @@ class UserManagerPage extends AdminPage public static $title = ['id' => 'jform_title']; - public static $pageURL = "administrator/index.php?option=com_users&view=users"; + public static $url = "administrator/index.php?option=com_users&view=users"; } diff --git a/tests/_support/Step/Acceptance/Administrator/Content.php b/tests/_support/Step/Acceptance/Administrator/Content.php index 6d752020d9..fdc2349362 100644 --- a/tests/_support/Step/Acceptance/Administrator/Content.php +++ b/tests/_support/Step/Acceptance/Administrator/Content.php @@ -12,7 +12,7 @@ class Content extends \AcceptanceTester public function thereIsAAddContentLink() { $I = $this; - $I->amOnPage(ArticleManagerPage::$pageURL); + $I->amOnPage(ArticleManagerPage::$url); $I->clickToolbarButton('New'); } @@ -52,7 +52,7 @@ public function iShouldSeeTheMessage($message) public function iSearchAndSelectContentArticleWithTitle($title) { $I = $this; - $I->amOnPage(ArticleManagerPage::$pageURL); + $I->amOnPage(ArticleManagerPage::$url); $I->fillField(ArticleManagerPage::$filterSearch, $title); $I->click(ArticleManagerPage::$iconSearch); $I->checkAllResults(); @@ -73,7 +73,7 @@ public function iFeatureTheContentWithTitle() public function iSelectTheContentArticleWithTitle($title) { $I = $this; - $I->amOnPage(ArticleManagerPage::$pageURL); + $I->amOnPage(ArticleManagerPage::$url); $I->fillField(ArticleManagerPage::$filterSearch, $title); $I->click(ArticleManagerPage::$iconSearch); $I->checkAllResults(); @@ -104,7 +104,7 @@ public function iSaveTheArticle() public function iHaveArticleWithName($title) { $I = $this; - $I->amOnPage(ArticleManagerPage::$pageURL); + $I->amOnPage(ArticleManagerPage::$url); $I->fillField(ArticleManagerPage::$filterSearch, $title); $I->click(ArticleManagerPage::$iconSearch); $I->checkAllResults(); @@ -135,7 +135,7 @@ public function iSeeArticleUnpublishMessage($title, $message) public function iHaveContentArticleWhichNeedsToBeTrash($title) { $I = $this; - $I->amOnPage(ArticleManagerPage::$pageURL); + $I->amOnPage(ArticleManagerPage::$url); $I->fillField(ArticleManagerPage::$filterSearch, $title); $I->click(ArticleManagerPage::$iconSearch); $I->checkAllResults(); diff --git a/tests/_support/Step/Acceptance/Administrator/User.php b/tests/_support/Step/Acceptance/Administrator/User.php index 24d22b1e14..6cec19bdfd 100644 --- a/tests/_support/Step/Acceptance/Administrator/User.php +++ b/tests/_support/Step/Acceptance/Administrator/User.php @@ -15,7 +15,7 @@ class User extends \AcceptanceTester public function thereIsAAddUserLink() { $I = $this; - $I->amOnPage(UserManagerPage::$pageURL); + $I->amOnPage(UserManagerPage::$url); $I->clickToolbarButton('New'); } @@ -57,7 +57,7 @@ public function iSeeTheMessage($message) public function iSearchAndSelectTheUserWithUserName($username) { $I = $this; - $I->amOnPage(UserManagerPage::$pageURL); + $I->amOnPage(UserManagerPage::$url); $I->fillField(UserManagerPage::$filterSearch, $username); $I->click(UserManagerPage::$iconSearch); $I->checkAllResults(); @@ -83,7 +83,7 @@ public function iAssignedNameAndUserGroup($name, $userGroup) public function iHaveAUserWithUserName($username) { $I = $this; - $I->amOnPage(UserManagerPage::$pageURL); + $I->amOnPage(UserManagerPage::$url); $I->fillField(UserManagerPage::$filterSearch, $username); $I->click(UserManagerPage::$iconSearch); $I->checkAllResults(); @@ -104,7 +104,7 @@ public function iBlockTheUser() public function iHaveABlockedUserWithUserName($username) { $I = $this; - $I->amOnPage(UserManagerPage::$pageURL); + $I->amOnPage(UserManagerPage::$url); $I->fillField(UserManagerPage::$filterSearch, $username); $I->click(UserManagerPage::$iconSearch); $I->checkAllResults(); @@ -125,7 +125,7 @@ public function iUnblockTheUser() public function iDeleteTheUser($username) { $I = $this; - $I->amOnPage(UserManagerPage::$pageURL); + $I->amOnPage(UserManagerPage::$url); $I->fillField(UserManagerPage::$filterSearch, $username); $I->click(UserManagerPage::$iconSearch); $I->checkAllResults(); @@ -139,7 +139,7 @@ public function iDeleteTheUser($username) public function thereIsAnUserLink() { $I = $this; - $I->amOnPage(UserManagerPage::$pageURL); + $I->amOnPage(UserManagerPage::$url); } /** @@ -233,7 +233,7 @@ public function iSeeTheAlertError($error) public function thereIsAAddNewGroupLink() { $I = $this; - $I->amOnPage(UserGroupPage::$groupPageURL); + $I->amOnPage(UserGroupPage::$url); $I->clickToolbarButton('New'); } @@ -261,7 +261,7 @@ public function iSaveTheGroup() public function iSearchAndSelectTheGroupWithName($GroupTitle) { $I = $this; - $I->amOnPage(UserGroupPage::$groupPageURL); + $I->amOnPage(UserGroupPage::$url); $I->fillField(UserManagerPage::$filterSearch, $GroupTitle); $I->click(UserManagerPage::$iconSearch); $I->checkAllResults(); @@ -283,7 +283,7 @@ public function iSetGroupTitleAsA($GroupTitle) public function iDeleteTheGroup($GroupTitle) { $I = $this; - $I->amOnPage(UserGroupPage::$groupPageURL); + $I->amOnPage(UserGroupPage::$url); $I->fillField(UserManagerPage::$filterSearch, $GroupTitle); $I->click(UserManagerPage::$iconSearch); $I->checkAllResults(); @@ -297,7 +297,7 @@ public function iDeleteTheGroup($GroupTitle) public function thereIsAAddViewingAccessLevelLink() { $I = $this; - $I->amOnPage(UserAclPage::$aclPageURL); + $I->amOnPage(UserAclPage::$url); $I->clickToolbarButton('New'); } @@ -326,7 +326,7 @@ public function iSaveTheAccessLevel() public function iSearchAndSelectTheAccessLevelWithName($LevelTitle) { $I = $this; - $I->amOnPage(UserAclPage::$aclPageURL); + $I->amOnPage(UserAclPage::$url); $I->fillField(UserManagerPage::$filterSearch, $LevelTitle); $I->click(UserManagerPage::$iconSearch); $I->checkAllResults(); @@ -348,7 +348,7 @@ public function iSetAccessLevelTitleAsA($LevelTitle) public function iDeleteTheAccessLeVel($LevelTitle) { $I = $this; - $I->amOnPage(UserAclPage::$aclPageURL); + $I->amOnPage(UserAclPage::$url); $I->fillField(UserManagerPage::$filterSearch, $LevelTitle); $I->click(UserManagerPage::$iconSearch); $I->checkAllResults(); @@ -362,7 +362,7 @@ public function iDeleteTheAccessLeVel($LevelTitle) public function thereIsAUserLink() { $I = $this; - $I->amOnPage(UserManagerPage::$pageURL); + $I->amOnPage(UserManagerPage::$url); } /** From d96912fcd7b4c03f688933b5ba8f5f2b488dd6c4 Mon Sep 17 00:00:00 2001 From: javier gomez Date: Thu, 30 Jun 2016 13:17:00 +0200 Subject: [PATCH 4/6] Move administrator login to the current page object pattern --- .../modules/mod_login/tmpl/default.php | 6 ++-- tests/_support/AcceptanceTester.php | 31 ---------------- .../Administrator/ControlPanelPage.php | 13 +++++++ .../Page/Acceptance/Administrator/Login.php | 36 ------------------- .../Acceptance/Administrator/LoginPage.php | 15 +++++--- .../Step/Acceptance/Administrator/Login.php | 30 ++++++++++++++++ .../Acceptance/Installation/Installation.php | 18 ++++++++++ tests/acceptance/administratorlogin.feature | 4 +-- tests/acceptance/content.feature | 4 +-- tests/acceptance/users.feature | 4 +-- 10 files changed, 81 insertions(+), 80 deletions(-) create mode 100644 tests/_support/Page/Acceptance/Administrator/ControlPanelPage.php delete mode 100644 tests/_support/Page/Acceptance/Administrator/Login.php create mode 100644 tests/_support/Step/Acceptance/Administrator/Login.php create mode 100644 tests/_support/Step/Acceptance/Installation/Installation.php diff --git a/administrator/modules/mod_login/tmpl/default.php b/administrator/modules/mod_login/tmpl/default.php index fab9dbbca1..6e57835773 100644 --- a/administrator/modules/mod_login/tmpl/default.php +++ b/administrator/modules/mod_login/tmpl/default.php @@ -25,7 +25,7 @@ - + @@ -41,7 +41,7 @@ - + @@ -84,7 +84,7 @@
-
diff --git a/tests/_support/AcceptanceTester.php b/tests/_support/AcceptanceTester.php index 4b8a896cb1..688358af3a 100644 --- a/tests/_support/AcceptanceTester.php +++ b/tests/_support/AcceptanceTester.php @@ -21,37 +21,6 @@ class AcceptanceTester extends \Codeception\Actor { use _generated\AcceptanceTesterActions; - /** - * Install joomla CMS - * - * @Given Joomla CMS is installed - */ - public function joomlaCMSIsInstalled() - { - // throw new \Codeception\Exception\Incomplete("Step `Joomla CMS is installed` is not defined"); - } - - /** - * @When Login into Joomla administrator with username :arg1 and password :arg1 - */ - public function loginIntoJoomlaAdministrator($username, $password) - { - $I = $this; - $I->amOnPage('administrator/'); - $I->fillField(LoginPage::$usernameField, $username); - $I->fillField(LoginPage::$passwordField, $password); - $I->click(LoginPage::$loginButton); - } - - /** - * @Then I see administrator dashboard - */ - public function iSeeAdministratorDashboard() - { - $I = $this; - $I->waitForText(AdminPage::$controlPanelText, 4, AdminPage::$pageTitle); - } - /** * Method is to set Wait for page title * diff --git a/tests/_support/Page/Acceptance/Administrator/ControlPanelPage.php b/tests/_support/Page/Acceptance/Administrator/ControlPanelPage.php new file mode 100644 index 0000000000..b64d4e7b96 --- /dev/null +++ b/tests/_support/Page/Acceptance/Administrator/ControlPanelPage.php @@ -0,0 +1,13 @@ + 'page-title']; +} \ No newline at end of file diff --git a/tests/_support/Page/Acceptance/Administrator/Login.php b/tests/_support/Page/Acceptance/Administrator/Login.php deleted file mode 100644 index cfa824648b..0000000000 --- a/tests/_support/Page/Acceptance/Administrator/Login.php +++ /dev/null @@ -1,36 +0,0 @@ -amOnPage('administrator/'); - $I->fillField(['css' => 'input[data-tests="username"]'], $username); - $I->fillField(['css' => 'input[data-tests="password"]'], $password); - $I->click(['css' => 'button[data-tests="log in"]']); - } - - /** - * @Then I see administrator dashboard - */ - public function iSeeAdministratorDashboard() - { - $I = $this; - $I->waitForPageTitle('Control Panel', 4); - } -} diff --git a/tests/_support/Page/Acceptance/Administrator/LoginPage.php b/tests/_support/Page/Acceptance/Administrator/LoginPage.php index a5b3b63269..3dd32204f8 100644 --- a/tests/_support/Page/Acceptance/Administrator/LoginPage.php +++ b/tests/_support/Page/Acceptance/Administrator/LoginPage.php @@ -5,12 +5,19 @@ class LoginPage extends AdminPage { + /** + * @var array Locator for username login form textfield + */ public static $usernameField = ['css' => 'input[data-tests="username"]']; - + + /** + * @var array Locator for password login form textfield + */ public static $passwordField = ['css' => 'input[data-tests="password"]']; - - public static $pageTitle = ['class' => 'page-title']; - + + /** + * @var array Locator for Log in button + */ public static $loginButton = ['css' => 'button[data-tests="log in"]']; public static $url = "/administrator/index.php"; diff --git a/tests/_support/Step/Acceptance/Administrator/Login.php b/tests/_support/Step/Acceptance/Administrator/Login.php new file mode 100644 index 0000000000..ad89a1f4df --- /dev/null +++ b/tests/_support/Step/Acceptance/Administrator/Login.php @@ -0,0 +1,30 @@ +amOnPage('administrator/'); + $I->fillField(LoginPage::$usernameField, $username); + $I->fillField(LoginPage::$passwordField, $password); + $I->click(LoginPage::$loginButton); + } + + /** + * @Then I should see the administrator dashboard + */ + public function iShouldSeeTheAdministratorDashboard() + { + $I = $this; + $I->waitForPageTitle(ControlPanelPage::$pageTitle, 60, ControlPanelPage::$pageTitleContext); + $I->see(ControlPanelPage::$pageTitle, ControlPanelPage::$pageTitleContext); + } +} \ No newline at end of file diff --git a/tests/_support/Step/Acceptance/Installation/Installation.php b/tests/_support/Step/Acceptance/Installation/Installation.php new file mode 100644 index 0000000000..22e7e4bcff --- /dev/null +++ b/tests/_support/Step/Acceptance/Installation/Installation.php @@ -0,0 +1,18 @@ +assertFileExists('tests/joomla-cms3/configuration.php'); + } +} \ No newline at end of file diff --git a/tests/acceptance/administratorlogin.feature b/tests/acceptance/administratorlogin.feature index 138c74bf38..93e3132b58 100644 --- a/tests/acceptance/administratorlogin.feature +++ b/tests/acceptance/administratorlogin.feature @@ -5,5 +5,5 @@ Feature: administrator login Scenario: Login in Administrator Given Joomla CMS is installed - When Login into Joomla administrator with username "admin" and password "admin" - Then I see administrator dashboard \ No newline at end of file + When I Login into Joomla administrator with username "admin" and password "admin" + Then I should see the administrator dashboard diff --git a/tests/acceptance/content.feature b/tests/acceptance/content.feature index 6a7c8031bb..d185829367 100644 --- a/tests/acceptance/content.feature +++ b/tests/acceptance/content.feature @@ -5,8 +5,8 @@ Feature: content Background: Given Joomla CMS is installed - When Login into Joomla administrator with username "admin" and password "admin" - Then I see administrator dashboard + When I Login into Joomla administrator with username "admin" and password "admin" + Then I should see the administrator dashboard Scenario: Create an Article Given There is a add content link diff --git a/tests/acceptance/users.feature b/tests/acceptance/users.feature index db5864ad08..cd9c849578 100644 --- a/tests/acceptance/users.feature +++ b/tests/acceptance/users.feature @@ -5,8 +5,8 @@ Feature: users Background: Given Joomla CMS is installed - When Login into Joomla administrator with username "admin" and password "admin" - Then I see administrator dashboard + When I Login into Joomla administrator with username "admin" and password "admin" + Then I should see the administrator dashboard Scenario: Verify available tabs in com_users Given There is an user link From f79d24147b6b447b826157f2b581b279ad506933 Mon Sep 17 00:00:00 2001 From: javier gomez Date: Thu, 30 Jun 2016 14:05:14 +0200 Subject: [PATCH 5/6] Remove Given Joomla CMS is installed --- .../Step/Acceptance/Administrator/Login.php | 1 + .../Acceptance/Installation/Installation.php | 18 ------------------ tests/acceptance.suite.dist.yml | 3 +-- tests/acceptance/administratorlogin.feature | 1 - tests/acceptance/content.feature | 3 +-- tests/acceptance/users.feature | 3 +-- 6 files changed, 4 insertions(+), 25 deletions(-) delete mode 100644 tests/_support/Step/Acceptance/Installation/Installation.php diff --git a/tests/_support/Step/Acceptance/Administrator/Login.php b/tests/_support/Step/Acceptance/Administrator/Login.php index ad89a1f4df..39e76c99fa 100644 --- a/tests/_support/Step/Acceptance/Administrator/Login.php +++ b/tests/_support/Step/Acceptance/Administrator/Login.php @@ -20,6 +20,7 @@ public function loginIntoJoomlaAdministrator($username, $password) /** * @Then I should see the administrator dashboard + * @When I see the administrator dashboard */ public function iShouldSeeTheAdministratorDashboard() { diff --git a/tests/_support/Step/Acceptance/Installation/Installation.php b/tests/_support/Step/Acceptance/Installation/Installation.php deleted file mode 100644 index 22e7e4bcff..0000000000 --- a/tests/_support/Step/Acceptance/Installation/Installation.php +++ /dev/null @@ -1,18 +0,0 @@ -assertFileExists('tests/joomla-cms3/configuration.php'); - } -} \ No newline at end of file diff --git a/tests/acceptance.suite.dist.yml b/tests/acceptance.suite.dist.yml index b28adc8165..0ce25d06f7 100644 --- a/tests/acceptance.suite.dist.yml +++ b/tests/acceptance.suite.dist.yml @@ -35,7 +35,6 @@ error_level: "E_ALL & ~E_STRICT & ~E_DEPRECATED" gherkin: contexts: default: - - AcceptanceTester - - Step\Acceptance\Administrator\User - Page\Acceptance\Administrator\Login + - Step\Acceptance\Administrator\User - Step\Acceptance\Administrator\Content \ No newline at end of file diff --git a/tests/acceptance/administratorlogin.feature b/tests/acceptance/administratorlogin.feature index 93e3132b58..f50c3c7adb 100644 --- a/tests/acceptance/administratorlogin.feature +++ b/tests/acceptance/administratorlogin.feature @@ -4,6 +4,5 @@ Feature: administrator login I need to have a control panel Scenario: Login in Administrator - Given Joomla CMS is installed When I Login into Joomla administrator with username "admin" and password "admin" Then I should see the administrator dashboard diff --git a/tests/acceptance/content.feature b/tests/acceptance/content.feature index d185829367..c2669a7aef 100644 --- a/tests/acceptance/content.feature +++ b/tests/acceptance/content.feature @@ -4,9 +4,8 @@ Feature: content I need to create modify trash publish and Unpublish content article Background: - Given Joomla CMS is installed When I Login into Joomla administrator with username "admin" and password "admin" - Then I should see the administrator dashboard + And I see the administrator dashboard Scenario: Create an Article Given There is a add content link diff --git a/tests/acceptance/users.feature b/tests/acceptance/users.feature index cd9c849578..42f214bc04 100644 --- a/tests/acceptance/users.feature +++ b/tests/acceptance/users.feature @@ -4,9 +4,8 @@ Feature: users I need to create edit block unblock and delete user Background: - Given Joomla CMS is installed When I Login into Joomla administrator with username "admin" and password "admin" - Then I should see the administrator dashboard + And I see the administrator dashboard Scenario: Verify available tabs in com_users Given There is an user link From 9f6e6e7ff033c6a6c2c177b8c2b327853cbce588 Mon Sep 17 00:00:00 2001 From: Prital Patel Date: Thu, 30 Jun 2016 23:36:24 +0530 Subject: [PATCH 6/6] Fix background scenarios and acceptance.suits.yml to run login scenarios --- tests/_support/Page/Acceptance/Administrator/LoginPage.php | 6 +++--- tests/_support/Step/Acceptance/Administrator/Login.php | 1 - tests/acceptance.suite.dist.yml | 3 ++- tests/acceptance/content.feature | 2 +- tests/acceptance/users.feature | 7 +------ 5 files changed, 7 insertions(+), 12 deletions(-) diff --git a/tests/_support/Page/Acceptance/Administrator/LoginPage.php b/tests/_support/Page/Acceptance/Administrator/LoginPage.php index 3dd32204f8..4e05057800 100644 --- a/tests/_support/Page/Acceptance/Administrator/LoginPage.php +++ b/tests/_support/Page/Acceptance/Administrator/LoginPage.php @@ -8,17 +8,17 @@ class LoginPage extends AdminPage /** * @var array Locator for username login form textfield */ - public static $usernameField = ['css' => 'input[data-tests="username"]']; + public static $usernameField = ['id' => 'mod-login-username']; /** * @var array Locator for password login form textfield */ - public static $passwordField = ['css' => 'input[data-tests="password"]']; + public static $passwordField = ['id' => 'mod-login-password']; /** * @var array Locator for Log in button */ - public static $loginButton = ['css' => 'button[data-tests="log in"]']; + public static $loginButton = 'Log in'; public static $url = "/administrator/index.php"; } \ No newline at end of file diff --git a/tests/_support/Step/Acceptance/Administrator/Login.php b/tests/_support/Step/Acceptance/Administrator/Login.php index 39e76c99fa..ad89a1f4df 100644 --- a/tests/_support/Step/Acceptance/Administrator/Login.php +++ b/tests/_support/Step/Acceptance/Administrator/Login.php @@ -20,7 +20,6 @@ public function loginIntoJoomlaAdministrator($username, $password) /** * @Then I should see the administrator dashboard - * @When I see the administrator dashboard */ public function iShouldSeeTheAdministratorDashboard() { diff --git a/tests/acceptance.suite.dist.yml b/tests/acceptance.suite.dist.yml index 0ce25d06f7..5b62543e8b 100644 --- a/tests/acceptance.suite.dist.yml +++ b/tests/acceptance.suite.dist.yml @@ -37,4 +37,5 @@ gherkin: default: - Page\Acceptance\Administrator\Login - Step\Acceptance\Administrator\User - - Step\Acceptance\Administrator\Content \ No newline at end of file + - Step\Acceptance\Administrator\Content + - Step\Acceptance\Administrator\Login \ No newline at end of file diff --git a/tests/acceptance/content.feature b/tests/acceptance/content.feature index c2669a7aef..3fc4308ac3 100644 --- a/tests/acceptance/content.feature +++ b/tests/acceptance/content.feature @@ -5,7 +5,7 @@ Feature: content Background: When I Login into Joomla administrator with username "admin" and password "admin" - And I see the administrator dashboard + Then I should see the administrator dashboard Scenario: Create an Article Given There is a add content link diff --git a/tests/acceptance/users.feature b/tests/acceptance/users.feature index 42f214bc04..31ac304b7c 100644 --- a/tests/acceptance/users.feature +++ b/tests/acceptance/users.feature @@ -5,7 +5,7 @@ Feature: users Background: When I Login into Joomla administrator with username "admin" and password "admin" - And I see the administrator dashboard + Then I should see the administrator dashboard Scenario: Verify available tabs in com_users Given There is an user link @@ -29,11 +29,6 @@ Feature: users When I block the user 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 should see the "User enabled." message - Scenario: Delete user Given I have a user with user name "Editor" When I Delete the user "Editor"