/** * Comparing a div, that change it's size */ public function seeVisualChangesAfterSizeChanges(WebGuy $I, $scenario) { $I->amOnPage("/VisualCeption/notSameSize.php"); $I->seeVisualChanges("getRedDiv", "div"); $I->wait(1); // the test has to be called twice for comparison on the travis server $I->amOnPage("/VisualCeption/notSameSize.php"); $I->seeVisualChanges("getRedDiv", "div"); }
public function dontSeeVisualChangesAndHideElement(WebGuy $I, $scenario) { $I->amOnPage("/VisualCeption/seeVisualChanges.php"); $I->dontSeeVisualChanges("hideTheBlock", "body", "#theblock"); $I->wait(1); // the test has to be called twice for comparison on the travis server $I->amOnPage("/VisualCeption/seeVisualChanges.php"); $I->dontSeeVisualChanges("hideTheBlock", "body", array("#theblock")); }
/** * 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 for requirement 130 of SLC * @param WebGuy $I [description] */ public function gebruikerKoppelenAanCursus(\WebGuy $I) { $I->amOnPage('/login'); $I->see('Uren'); $I->fillField('Username', 'slc'); $I->fillField('Password', 'slc'); $I->click('Login'); $I->amOnPage('/slc/3'); $I->amOnPage('/slc/3/course/students/1'); $I->click('Voeg toe'); $I->amOnPage('/slc/3/course/students/1'); $I->see('student'); }
/** * 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'); }
/** * fail the test. lookup is current image is written */ public function writeCurrentImageFile(WebGuy $I, $scenario) { $I->amOnPage("/VisualCeption/seeVisualChanges.php"); $I->dontSeeVisualChanges("currentImageIdentifier", "#theblock"); $I->wait(2); // the test has to be called twice for comparison on the travis server // expect failing the test $I->amOnPage("/VisualCeption/seeVisualChanges.php"); try { $I->dontSeeVisualChanges("currentImageIdentifier", "#theblock"); } catch (ImageDeviationException $exception) { $currentImagePath = $exception->getCurrentImage(); if (!is_file($exception->getCurrentImage())) { throw new \PHPUnit_Framework_ExpectationFailedException("The screenshot was not saved successfully."); } } }
/** * Test for requirement 50 of student * @param WebGuy $I [description] * @return [type] [description] */ public function profielInzienStudent(\WebGuy $I) { $I->amOnPage('/login'); $I->see('Uren'); $I->fillField('Username', 'student'); $I->fillField('Password', 'student'); $I->click('Login'); $I->amOnPage('/student/1'); $I->see('Student Page'); $I->wantTo('Profiel Inzien'); $I->click('Profiel'); $I->amOnPage('/student/1/profiel'); $I->see('student'); $I->see('I12R'); }
<?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 /** * 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('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('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 $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 /** * 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-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');
<?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 /** * * @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('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 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('/'); $I->see('Hello demo-activate'); // logout
<?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('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 $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 /** * * @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'));
$I->reloadPage(); $I->see($question, '.question'); $I->click("Bid on this Contract"); $I->see("New Bid", "h5"); $I->fillField("bid[approach]", "Approach."); $I->fillField("bid[previous_work]", "Previous work."); $I->fillField("bid[employee_details]", "Employee details."); $I->click("Submit Bid"); $I->see("Thanks for submitting your bid."); $I->see("Approach.", 'p'); $I->see("Previous work.", 'p'); $I->see("Employee details.", 'p'); $I->click("Sign Out"); /** Officer Sanity **/ $I = new WebGuy($scenario); $I->amOnPage('/signin'); /* Officer login succeeds */ $I->fillField('email', '*****@*****.**'); $I->fillField('password', 'password'); $I->click('button.btn'); $I->see('My Projects', 'h4'); $I->amOnPage("/notifications"); $I->see("{$vendorName} has submitted a bid", ".line1"); $I->click("submitted a bid"); $I->see("Bid from", "h1"); $I->click("(view profile)"); $I->see("Contact Name"); $I->see("SAM.gov"); $I->see("DSBS"); $I->click('Projects'); $I->see('My Projects', 'h4');
<?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 /** * AuditFieldController Test * * @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 AuditFieldController works'); $I->amOnPage('audit/field/index'); $I->see('Fields'); $I->see('Search');
<?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); $I->wantTo('ensure that about works'); $I->amOnPage('?r=site/about'); $I->see('About', 'h1');
<?php $I = new WebGuy($scenario); /* Vendor login with wrong password fails */ $I->amOnPage('/signin'); $I->fillField('email', '*****@*****.**'); $I->fillField('password', 'wrongpassword'); $I->click('button.btn'); $I->see('Login incorrect', '.alert'); $I = new WebGuy($scenario); /* Vendor login succeeds */ $I->fillField('email', '*****@*****.**'); $I->fillField('password', 'password'); $I->click('button.btn'); $I->see('Projects', 'h4'); /* Signout works */ $I->click('Sign Out'); $I->see('RFP-EZ Marketplace'); /* Officer login wrong password fails */ $I->amOnPage('/signin'); $I->fillField('email', '*****@*****.**'); $I->fillField('password', 'wrongpassword'); $I->click('button.btn'); $I->see('Login incorrect', '.alert'); /* Then officer login works */ $I->fillField('email', '*****@*****.**'); $I->fillField('password', 'password'); $I->click('button.btn'); $I->see('My Projects', 'h4');
public function _after(WebGuy $I) { $I->amOnPage('/logout'); }