/** * Executes a search on Google's home page using return key. * * @covers SauceExtension */ public function testGoogleSearchResults() { $this->webGuy->am('Anonymous User'); $this->webGuy->wantTo('execute search on home page'); $this->webGuy->amOnPage('/'); $this->webGuy->canSeeInTitle('Google'); $this->webGuy->fillField('#gbqfq', 'dogecoin'); $this->webGuy->pressKey('#gbqfq', WebDriverKeys::ENTER); $this->webGuy->canSeeInField('input#gbqfq', 'dogecoin'); $this->webGuy->canSeeInTitle('dogecoin - Google Search'); }
/** * Test is home available * * @param AcceptanceTester $I */ public function backendLogin(AcceptanceTester $I) { $I = new WebGuy($scenario); $I->wantTo('see GitHub word in title '); $I->amOnPage('/'); $I->seeInTitle('GitHub'); }
public function testEditConfigWithCommit(WebGuy $I) { $I->wantTo('create new interface using commit all'); $this->_addInterface($I); $I->click('Append changes'); $I->seeNumberOfElements('form.addedForm', 1); $I->click('Commit all changes'); // see result CommonScenarios::checkNumberOfFlashes($I, 1); $I->seeNumberOfElements('.level-0.interface', 3); }
public function testEditConfigWithCommit(WebGuy $I) { $I->wantTo('create new transition function using commit all'); $this->_turingAddTransition($I, true, 2); $I->click('Append changes'); $I->seeNumberOfElements('form.addedForm', 1); $I->click('Commit all changes'); $I->waitForElementNotVisible('#ajax-spinner'); $I->wait(2); // see result CommonScenarios::checkNumberOfFlashes($I, 1); $I->canSeeNumberOfElements('.level-1.delta', 2); }
public function testEditConfig(WebGuy $I) { $I->wantTo('create new interface using submit button'); $inputValue = 'test-name' . time(); $I->click('.create-child[rel="--*--*?3!"]'); CommonScenarios::waitAndClickInTypeahead($I, 'group'); $I->waitForElement('input.value[name*="--*--*?3!--*?1!--*?1!"]'); $I->fillField('input.value[name*="--*--*?3!--*?1!--*?1!"]', $inputValue); $I->click('Create new node'); $I->waitForElementNotVisible('#ajax-spinner'); $I->wait(2); // $I->canSee($inputValue); CommonScenarios::checkNumberOfFlashes($I, 1); $I->canSee('group'); }
/** * * @param \WebGuy $I * @param \Codeception\Scenario $scenario */ public function testUserSignup($I, $scenario) { $I->wantTo('ensure that signup works'); $signupPage = SignupPage::openBy($I); $I->see('Please fill out the following fields to signup:'); $I->amGoingTo('submit signup form with no data'); $signupPage->submit([]); $I->expectTo('see validation errors'); $I->see('Username cannot be blank.'); $I->see('Email cannot be blank.'); $I->see('Password cannot be blank.'); $I->amGoingTo('submit signup form with not correct email'); $signupPage->submit(['username' => 'tester', 'email' => 'tester.email', 'password' => 'tester_password']); $I->expectTo('see that email adress is wrong'); $I->dontSee('Username cannot be blank.', '.help-inline'); $I->dontSee('Password cannot be blank.', '.help-inline'); $I->see('Email is not a valid email address.', '.help-block'); $I->amGoingTo('submit signup form with correct email'); $signupPage->submit(['username' => 'tester', 'email' => '*****@*****.**', 'password' => 'tester_password']); $I->expectTo('see that user logged in'); $I->see('Logout (tester)'); }
<?php $I = new WebGuy($scenario); $I->wantTo('call friends to try multi session'); $I->amOnPage('/info'); $jon = $I->haveFriend('jon'); $jon->does(function (WebGuy $I) { $I->amOnPage('/'); $I->seeInCurrentUrl('/'); }); $I->seeInCurrentUrl('/info');
<?php use common\tests\_pages\LoginPage; $I = new WebGuy($scenario); $I->wantTo('ensure login page works'); $loginPage = LoginPage::openBy($I); $I->amGoingTo('submit login form with no data'); $loginPage->login('', ''); $I->expectTo('see validations errors'); $I->see('Username cannot be blank.'); $I->see('Password cannot be blank.'); $I->amGoingTo('try to login with wrong credentials'); $I->expectTo('see validations errors'); $loginPage->login('admin', 'wrong'); $I->expectTo('see validations errors'); $I->see('Incorrect username or password.'); $I->amGoingTo('try to login with correct credentials'); $loginPage->login('erau', 'password_0'); $I->expectTo('see that user is logged'); $I->see('Logout (erau)'); $I->dontSee('Login'); $I->dontSee('Signup'); $I->click('Logout (erau)'); $I->dontSee('Logout (erau)'); $I->see('Login');
<?php /** * DefaultController Test * * @var $scenario \Codeception\Scenario * * @author Brett O'Donnell <*****@*****.**> * @author Zain Ul abidin <*****@*****.**> * @copyright 2013 Mr PHP * @link https://github.com/cornernote/yii-email-module * @license BSD-3-Clause https://raw.github.com/cornernote/yii-email-module/master/LICENSE * * @package yii-email-module */ $I = new WebGuy($scenario); $I->wantTo('ensure DefaultController works'); $I->amOnPage('email'); $I->see('You may use the following tools'); $I->click('Spool'); $I->see('Spools'); $I->click('Template'); $I->see('Templates'); $I->click('Email'); $I->see('You may use the following tools');
<?php $I = new WebGuy($scenario); $I->wantTo('base check rsg2-latest-images for picture '); // Direct call //$I->amOnPage('http://127.0.0.1/Joomla3x/index.php/rsg2-image-wall'); $I->amOnPage('/index.php/rsg2-image-wall'); $I->makeScreenshot('base-rsg2-image-wall'); // Where i want to be $I->see('RSG2 image wall');
<?php /** * Testing /clients/create form * For now do not tests all fields in Form. **/ $I = new WebGuy($scenario); $I->wantTo('Test Form:New Client. /clients/create'); $I->amOnPage('/'); $I->click('#startButton'); $I->amOnPage('/clients/create'); $I->click('Add contact'); $I->fillField('input#email0', '*****@*****.**'); $I->fillField('input#email1', '*****@*****.**'); $I->click('Remove contact'); $I->click('Add contact'); $I->fillField('input#email1', '*****@*****.**'); $I->seeInField('input#email0', '*****@*****.**'); $I->seeInField('input#email1', '*****@*****.**'); //-----------Fields done----- //add more fields $I->fillField('input#name', 'Some User'); $I->fillField('input#website', 'http://google.com'); $I->fillField('input#work_phone', '+308123456789'); $I->fillField('input#address1', 'Test Address 1'); $I->fillField('input#address2', 'Test Address 2 APPTMT SUITE'); $I->fillField('input#city', 'Zaporozhe'); $I->fillField('input#state', 'Test Province'); $I->fillField('input#postal_code', 'postcode 123455677'); $option = 'Net 7'; $I->selectOption("#payment_terms", $option);
<?php $I = new WebGuy($scenario); $I->wantTo('ensure that home page works'); $I->amOnPage(Yii::$app->homeUrl); $I->see('My Company'); $I->seeLink('About'); $I->click('About'); $I->see('This is the About page.');
<?php $I = new WebGuy($scenario); $I->wantTo('Ensure study year pages work'); $I->amOnPage('/leerjaar/1'); $I->see('LEERJAAR 1'); $I->amOnPage('/leerjaar/2'); $I->see('LEERJAAR 2'); $I->amOnPage('/leerjaar/3'); $I->see('LEERJAAR 3'); $I->amOnPage('/leerjaar/4'); $I->see('LEERJAAR 4');
<?php $I = new WebGuy($scenario); $I->wantTo('Ensure the subject page work'); $I->amOnPage('/leerjaar/1/onderwerp/3'); $I->see('PLAATJES'); $I->see('Categorie: Plaatjes'); $I->see('Test Plaatje 3'); $I->see('Test Plaatje 4');
<?php $I = new WebGuy($scenario); $I->wantTo('ensure that contact works'); $I->amOnPage('?r=site/contact'); $I->see('Contact', 'h1'); $I->submitForm('#contact-form', []); $I->see('Contact', 'h1'); $I->see('Name cannot be blank'); $I->see('Email cannot be blank'); $I->see('Subject cannot be blank'); $I->see('Body cannot be blank'); $I->see('The verification code is incorrect'); $I->submitForm('#contact-form', ['ContactForm[name]' => 'tester', 'ContactForm[email]' => 'tester.email', 'ContactForm[subject]' => 'test subject', 'ContactForm[body]' => 'test content', 'ContactForm[verifyCode]' => 'testme']); $I->dontSee('Name cannot be blank', '.help-inline'); $I->see('Email is not a valid email address.'); $I->dontSee('Subject cannot be blank', '.help-inline'); $I->dontSee('Body cannot be blank', '.help-inline'); $I->dontSee('The verification code is incorrect', '.help-inline'); $I->submitForm('#contact-form', ['ContactForm[name]' => 'tester', 'ContactForm[email]' => '*****@*****.**', 'ContactForm[subject]' => 'test subject', 'ContactForm[body]' => 'test content', 'ContactForm[verifyCode]' => 'testme']); $I->dontSeeElement('#contact-form'); $I->see('Thank you for contacting us. We will respond to you as soon as possible.');
<?php $I = new WebGuy($scenario); include 'constant.php'; $I->wantTo('Reset my password'); $I->amOnPage('/'); $I->click(LoginPopUp::$loginPopup); $I->waitForText('Create account'); $I->click(ForgotPopUp::$passwordLink); $I->waitForText('Forgot password'); $I->wait(1); $I->waitForElement(ForgotPopUp::$emailField); $I->seeElement(ForgotPopUp::$emailField); $I->seeElement(ForgotPopUp::$resetButton); $I->fillField(ForgotPopUp::$emailField, $email); $I->click(ForgotPopUp::$resetButton); $I->waitForText('Reset password link was sent on your e-mail address');
<?php /* * This file is part of the Webception package. * * (c) James Healey <*****@*****.**> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ $I = new WebGuy($scenario); $I->wantTo('check AJAX call when the Codeception log check fails.'); $I->sendGET('logs?test=log_fail'); $I->seeResponseContainsJson(array('ready' => false, 'error' => "The Codeception Log directory does not exist. Please check the following path exists:"));
<?php /** * * @var $scenario \Codeception\Scenario * * @author Brett O'Donnell <*****@*****.**> * @author Zain Ul abidin <*****@*****.**> * @copyright 2013 Mr PHP * @link https://github.com/cornernote/yii-audit-module * @license BSD-3-Clause https://raw.github.com/cornernote/yii-audit-module/master/LICENSE * * @package yii-audit-module */ $I = new WebGuy($scenario); $I->wantTo('ensure undefined function is caught'); $I->amOnPage('site/undefinedFunction'); $I->see('PHP error'); $I->see('Fatal error: Call to undefined function undefined_function()'); $I->canSeeInDatabase('audit_error', array('code' => '500', 'type' => 'PHP error', 'message' => 'Fatal error: Call to undefined function undefined_function()'));
<?php $I = new WebGuy($scenario); $I->wantTo('ensure that login works'); $I->amOnPage('?r=site/login'); $I->see('Application', 'h1'); $I->submitForm('#login-form', array()); $I->dontSee('Logout (admin)'); $I->see('Username cannot be blank'); $I->see('Password cannot be blank'); $I->submitForm('#login-form', array('LoginForm[username]' => 'admin', 'LoginForm[password]' => 'wrong')); $I->dontSee('Logout (admin)'); $I->see('Incorrect username or password'); $I->submitForm('#login-form', array('LoginForm[username]' => 'admin', 'LoginForm[password]' => 'admin')); $I->see('Logout (admin)');
/** * AccountAccountControllerActivate Test * * @var $scenario \Codeception\Scenario * * @author Brett O'Donnell <*****@*****.**> * @author Zain Ul abidin <*****@*****.**> * @copyright 2013 Mr PHP * @link https://github.com/cornernote/yii-account-module * @license BSD-3-Clause https://raw.github.com/cornernote/yii-account-module/master/LICENSE * * @package yii-account-module */ $I = new WebGuy($scenario); $I->wantTo('ensure AccountAccountController activate works'); // check we are not logged in $I->amOnPage('/'); $I->see('Hello guest'); // add user to the database $I->haveInDatabase('account_user', array('username' => 'demo-activate', 'password' => '$2a$13$.m7wlozeIJuRtKp01lR4peYybArVLdO6Pf1JsPSnX6eISL9GXDWBu', 'first_name' => 'demo-activate', 'last_name' => 'demo-activate', 'email' => '*****@*****.**', 'activated' => 0)); // add a token to the database $I->haveInDatabase('token', array('token' => '$2a$13$lRkdb6kwbIC9aGTkdei2h.NQNlZht9Bpdo2J0PqsJ3tHAFsYJNg7C', 'model_name' => 'AccountActivate', 'model_id' => 2, 'uses_allowed' => 1, 'uses_remaining' => 1, 'expires' => strtotime('+1day'), 'created' => time())); // check with invalid token $I->amOnPage('/account/account/activate/user_id/2/token/test-invalid-token'); $I->see('Invalid token.'); // reset password with empty details $I->amOnPage('/account/account/activate/user_id/2/token/test-token'); $I->see('Your account has been activated and you have been logged in.'); // check login $I->amOnPage('/');
<?php /** * * @var $scenario \Codeception\Scenario * * @author Brett O'Donnell <*****@*****.**> * @author Zain Ul abidin <*****@*****.**> * @copyright 2013 Mr PHP * @link https://github.com/cornernote/yii-audit-module * @license BSD-3-Clause https://raw.github.com/cornernote/yii-audit-module/master/LICENSE * * @package yii-audit-module */ $I = new WebGuy($scenario); $I->wantTo('ensure method call on non-object is caught'); $I->amOnPage('site/methodOnNonObject'); $I->see('PHP error'); $I->see('Fatal error: Call to a member function iAmNotAnObject() on a non-object'); $I->canSeeInDatabase('audit_error', array('code' => '500', 'type' => 'PHP error', 'message' => 'Fatal error: Call to a member function iAmNotAnObject() on a non-object'));
<?php $I = new WebGuy($scenario); $I->wantTo('call friend with steps to ask expert work'); $I->amOnPage('/info'); $john = $I->haveFriend('john', '\\WebGuy\\RootWatcherSteps'); $john->does(function (WebGuy\RootWatcherSteps $I) { $I->seeInRootPage('Welcome to test app!'); }); $I->seeInCurrentUrl('/info');
<?php $I = new WebGuy($scenario); include 'constant.php'; $I->wantTo('Register new user'); $I->amOnPage("/"); $I->see('Registration'); $I->see('Login'); $I->see('Genre'); $I->see('Stations'); $I->click(Registration::$registrationlink); $I->waitForText('Sign Up'); $I->see('Sign Up'); $I->seeElement(Registration::$username); $I->seeElement(Registration::$emailField); $I->seeElement(Registration::$passwordField); $I->seeElement(Registration::$confirmPasswordField); $I->seeElement(Registration::$registrationButton); $I->fillField(Registration::$username, $username); $I->fillField(Registration::$emailField, $email); $I->fillField(Registration::$passwordField, $pass); $I->fillField(Registration::$confirmPasswordField, $pass_conf); $I->click(Registration::$registrationButton);
<?php /** * EmailSpoolController Test * * @var $scenario \Codeception\Scenario * * @author Brett O'Donnell <*****@*****.**> * @author Zain Ul abidin <*****@*****.**> * @copyright 2013 Mr PHP * @link https://github.com/cornernote/yii-email-module * @license BSD-3-Clause https://raw.github.com/cornernote/yii-email-module/master/LICENSE * * @package yii-email-module */ $I = new WebGuy($scenario); $I->wantTo('ensure SpoolController works'); $I->amOnPage('email/spool/index'); $I->see('Spools'); $I->see('Search');
<?php $I = new WebGuy($scenario); $I->wantTo('base check rsg2-latest-galleries for picture '); // Direct call //$I->amOnPage('http://127.0.0.1/Joomla3x/index.php/rsg2-latest-galleries'); $I->amOnPage('/index.php/rsg2-latest-galleries'); $I->makeScreenshot('base-rsg2-latest-galleries'); // Where i want to be $I->see('RSG2 latest galleries');
<?php $I = new WebGuy($scenario); $I->wantTo('base check rsg2-random-images for picture '); // Direct call //$I->amOnPage('http://127.0.0.1/Joomla3x/index.php/rsg2-random-images'); $I->amOnPage('/index.php/rsg2-random-images'); $I->makeScreenshot('base-rsg2-random-images'); // Where i want to be $I->see('RSG2 random images');
<?php $I = new WebGuy($scenario); $I->wantTo("Ensure the search function works"); $I->amOnPage('/'); $I->submitForm('#searchform', array('search' => 'pl')); $I->see('PLAATJES');
<?php $I = new WebGuy($scenario); $I->wantTo('log into the backend as Admin'); $I->loginAs($users['admin']); $I->see('Dashboard');
<?php $I = new WebGuy($scenario); $I->wantTo('Ensure the index page works'); $I->amOnPage('/'); $I->see('LEERJAAR 1'); $I->see('LEERJAAR 2'); $I->see('LEERJAAR 3'); $I->see('LEERJAAR 4'); $I->see('CONTACT'); $I->see('*****@*****.**');
<?php $I = new WebGuy($scenario); $I->wantTo('base check rsg2-thumb-scroller for picture '); // Direct call //$I->amOnPage('http://127.0.0.1/Joomla3x/index.php/rsg2-thumb-scroller'); $I->amOnPage('/index.php/rsg2-thumb-scroller'); $I->makeScreenshot('base-rsg2-thumb-scroller'); // Where i want to be $I->see('RSG2 thumb scroller');