diff --git a/.gitignore b/.gitignore index 19ab14c416..9faa430049 100644 --- a/.gitignore +++ b/.gitignore @@ -26,7 +26,6 @@ tests/codeception/_output/* tests/codeception/vendor/* tests/codeception/testingsite* tests/codeception/tests/acceptance.suite.yml -tests/codeception/tests/acceptance/*Tester.php tests/codeception/tests/functional/*Tester.php tests/codeception/tests/unit/*Tester.php diff --git a/RoboFile.php b/RoboFile.php index ba3cf01c0a..1d5022cece 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -274,6 +274,15 @@ public function runTests($opts = ['use-htaccess' => false, 'env' => 'desktop']) ->stopOnFail(); $this->taskCodecept($pathToCodeception) + ->arg('--steps') + ->arg('--debug') + ->arg('--fail-fast') + ->arg('--env ' . $opts['env']) + ->arg('tests/acceptance/users.feature') + ->run() + ->stopOnFail(); + + /* $this->taskCodecept($pathToCodeception) ->arg('--steps') ->arg('--debug') ->arg('--fail-fast') @@ -289,7 +298,7 @@ public function runTests($opts = ['use-htaccess' => false, 'env' => 'desktop']) ->arg('--env ' . $opts['env']) ->arg('tests/acceptance/frontend/') ->run() - ->stopOnFail(); + ->stopOnFail();*/ /* // Uncomment this lines if you need to debug selenium errors diff --git a/tests/_support/AcceptanceTester.php b/tests/_support/AcceptanceTester.php index 4c7dcbb6d6..1b7f1cb3ba 100644 --- a/tests/_support/AcceptanceTester.php +++ b/tests/_support/AcceptanceTester.php @@ -1,5 +1,8 @@ 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 + * + * @param string $title Page Title text + * @param integer $timeout timeout time + * + * @return void + */ + public function waitForPageTitle($title, $timeout = 60) + { + $I = $this; + $I->waitForText($title, $timeout, AdminPage::$pageTitle); + } + + /** + * Function to check for PHP Notices or Warnings + * + * @param string $page Optional, if not given checks will be done in the current page + * + * @note: doAdminLogin() before + */ + public function checkForPhpNoticesOrWarnings($page = null) + { + $I = $this; + + if ($page) + { + $I->amOnPage($page); + } + + $I->dontSeeInPageSource('Notice:'); + $I->dontSeeInPageSource('Notice:'); + $I->dontSeeInPageSource('Warning:'); + $I->dontSeeInPageSource('Warning:'); + $I->dontSeeInPageSource('Strict standards:'); + $I->dontSeeInPageSource('Strict standards:'); + $I->dontSeeInPageSource('The requested page can\'t be found'); + } + + /** + * Function to select Toolbar buttons in Joomla! Admin Toolbar Panel + * + * @param string $button The full name of the button + * + * @return void + */ + public function clickToolbarButton($button) + { + $I = $this; + $input = strtolower($button); + + // @todo Needs to find way to work with different window size. + $screenSize = explode("x", $this->getConfiguration('window_size')); + + if ($screenSize[0] <= 480) + { + $I->click('Toolbar'); + } + + switch ($input) + { + case "new": + $I->click(['xpath' => "//div[@id='toolbar-new']//button"]); + break; + case "edit": + $I->click(['xpath' => "//div[@id='toolbar-edit']//button"]); + break; + case "publish": + $I->click(['xpath' => "//div[@id='toolbar-publish']//button"]); + break; + case "unpublish": + $I->click(['xpath' => "//div[@id='toolbar-unpublish']//button"]); + break; + case "archive": + $I->click(['xpath' => "//div[@id='toolbar-archive']//button"]); + break; + case "check-in": + $I->click(['xpath' => "//div[@id='toolbar-checkin']//button"]); + break; + case "batch": + $I->click(['xpath' => "//div[@id='toolbar-batch']//button"]); + break; + case "rebuild": + $I->click(['xpath' => "//div[@id='toolbar-refresh']//button"]); + break; + case "trash": + $I->click(['xpath' => "//div[@id='toolbar-trash']//button"]); + break; + case "save": + $I->click(['xpath' => "//div[@id='toolbar-apply']//button"]); + break; + case "save & close": + $I->click(['xpath' => "//div[@id='toolbar-save']//button"]); + break; + case "save & new": + $I->click(['xpath' => "//div[@id='toolbar-save-new']//button"]); + break; + case "cancel": + $I->click(['xpath' => "//div[@id='toolbar-cancel']//button"]); + break; + case "options": + $I->click(['xpath' => "//div[@id='toolbar-options']//button"]); + break; + case "empty trash": + $I->click(['xpath' => "//div[@id='toolbar-delete']//button"]); + break; + case "unblock": + $I->click(['xpath' => "//div[@id='toolbar-unblock']//button"]); + break; + case "delete": + $I->click(['xpath' => "//div[@id='toolbar-delete']//button"]); + break; + case "featured": + $I->click(['xpath' => "//div[@id='toolbar-featured']//button"]); + break; + } + } + + /** + * Function to select all the item in the Search results in Administrator List + * + * Note: We recommend use of checkAllResults function only after searchForItem to be sure you are selecting only the desired result set + * + * @return void + */ + public function checkAllResults() + { + $I = $this; + $this->comment("Selecting Checkall button"); + $I->click(['xpath' => "//thead//input[@name='checkall-toggle' or @name='toggle']"]); + } + + /** + * Selects an option in a Chosen Selector based on its id + * + * @param string $selectId The id of the