Checks that the current page contains the given string.
Specify a locator as the second parameter to match a specific region.
php
see('Logout'); // I can suppose user is logged in
$I->see('Sign Up','h1'); // I can suppose it's a signup page
$I->see('Sign Up','//body/h1'); // with XPath
?>
/** * 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 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 $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 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); 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 /** * 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 $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');
<?php $I = new WebGuy($scenario); $I->wantTo('ensure that about works'); $I->amOnPage('?r=site/about'); $I->see('About', 'h1');
$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'); $I->click('API for SBA.gov Dynamic Small Business Search'); $I->see('Bids awaiting review', 'h5'); $I->see($vendorName, '.bid[data-vendor-company-name=' . $vendorName . ']'); $I->click('a[href*=comments]'); $I->see('Add Comment', 'h5');
<?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');
* * @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 update works'); // check we are not logged in $I->amOnPage('/'); $I->see('Hello guest'); // login $I->amOnPage('/account/account/login'); $I->fillField('AccountLogin_username', 'admin'); $I->fillField('AccountLogin_password', 'admin'); $I->click('Login'); $I->see('You have successfully logged in.'); // update details with empty fields $I->amOnPage('/account/account/update'); $I->fillField('AccountUpdate_first_name', ''); $I->fillField('AccountUpdate_last_name', ''); $I->fillField('AccountUpdate_email', ''); $I->fillField('AccountUpdate_username', ''); $I->click('Save'); $I->see('Please fix the following input errors:'); $I->see('Email cannot be blank.');
<?php $I = new WebGuy($scenario); $I->wantTo('be denied "publish" permissions on Pages as pagewriter user'); $I->loginAs($users['pagewriter']); $I->see('New Page'); $I->click('New Page'); $I->see('Actions for this Page'); $I->fillField('title', 'A page I made'); $I->fillField('teaser', 'Woop woop woop! Crazy nice stuff inside!'); $I->fillField('body', 'Take it, take it! I have three more of these!'); // make sure the page cannot be published by setting its status in the // edit form $I->dontSeeInField('status', 'Published'); // let's save this page anyway, because we'll be needing it... $I->click('Save Page'); // also check that the "publish page" context menu option isn't shown $I->amOnPage('bolt'); $I->dontSee('Publish Page');
<?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 variable is caught'); $I->amOnPage('site/undefinedVariable'); $I->see('PHP notice'); $I->see('Undefined variable: undefined_variable'); $I->canSeeInDatabase('audit_error', array('code' => '500', 'type' => 'PHP notice', 'message' => 'Undefined variable: undefined_variable'));
* * @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 sign up works'); // check we are not logged in $I->amOnPage('/'); $I->see('Hello guest'); // check the form is there $I->amOnPage('/account/account/signUp'); $I->see('First Name'); $I->see('Last Name'); $I->see('Email'); $I->see('Username'); $I->see('Password'); $I->see('Confirm Password'); // signup with empty details $I->amOnPage('/account/account/signUp'); $I->click('Sign Up'); $I->see('Please fix the following input errors:'); $I->see('Email cannot be blank.'); $I->see('First Name cannot be blank.'); $I->see('Username cannot be blank.');
<?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('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); $I->wantTo('create and edit Pages as pagewriter user'); $I->loginAs($users['pagewriter']); $I->see('New Page'); $I->click('New Page'); $I->see('Actions for this Page'); $I->fillField('title', 'A page I made'); $I->fillField('teaser', 'Woop woop woop! Crazy nice stuff inside!'); $I->fillField('body', 'Take it, take it! I have three more of these!'); $I->click('Save Page'); $I->see('A page I made'); $I->see('Woop woop woop');
<?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 /** * 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');
$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); $option = 'Euro'; $I->selectOption("#currency_id", $option); $option = '500+'; $I->selectOption("#size_id", $option); $option = 'Aerospace'; $I->selectOption("#industry_id", $option); //----private notes $I->fillField('#private_notes', 'Test Note Note Notes'); //-----------------------Form is Finished-- $I->click('Save'); $I->seeInCurrentUrl('/clients/'); $I->dontSeeInCurrentUrl('/users/'); $I->dontSeeInCurrentUrl('/user/'); $I->see('Details'); $I->see('Contacts'); $I->see('*****@*****.**'); $I->seeInDatabase('contacts', ['email' => '*****@*****.**']); $I->seeInDatabase('contacts', ['email' => '*****@*****.**']); $I->seeInDatabase('contacts', ['email' => '*****@*****.**']); $I->seeInDatabase('clients', array('currency_id' => 3, 'name' => 'Some User', 'address1' => 'Test Address 1', 'address2' => 'Test Address 2 APPTMT SUITE', 'city' => 'Zaporozhe', 'state' => 'Test Province', 'postal_code' => 'postcode 123455677', 'work_phone' => '+308123456789', 'private_notes' => 'Test Note Note Notes', 'payment_terms' => 7, 'industry_id' => 3, 'size_id' => 6)); //$I->seeInDatabase('clients', ['email' => '*****@*****.**']);
<?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 /** * * @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'));
* * @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 $I->amOnPage('/account/account/logout');
<?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('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)');
<?php $I = new WebGuy($scenario); $I->wantTo("Ensure the search function works"); $I->amOnPage('/'); $I->submitForm('#searchform', array('search' => 'pl')); $I->see('PLAATJES');
<?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 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-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');