Checks that the current page doesn't contain the text specified.
Give a locator as the second parameter to match a specific region.
php
dontSee('Login'); // I can suppose user is already logged in
$I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page
$I->dontSee('Sign Up','//body/h1'); // with XPath
?>
<?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('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 $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 that frontpage works'); $I->see('Welcome'); $I->see('CodeIgniter'); $I->dontSee('Error');
$I->see('Email cannot be blank.'); $I->see('First Name cannot be blank.'); $I->see('Username cannot be blank.'); $I->see('Password cannot be blank.'); $I->see('Confirm Password cannot be blank.'); // signup with invalid email $I->amOnPage('/account/account/signUp'); $I->fillField('AccountSignUp_first_name', 'demo_first_name'); $I->fillField('AccountSignUp_last_name', 'demo_last_name'); $I->fillField('AccountSignUp_email', 'demo!mailinator.com'); $I->fillField('AccountSignUp_username', 'demo'); $I->fillField('AccountSignUp_password', 'demo123'); $I->fillField('AccountSignUp_confirm_password', 'demo123'); $I->click('Sign Up'); $I->see('Please fix the following input errors:'); $I->dontSee('Email cannot be blank.'); $I->dontSee('First Name cannot be blank.'); $I->dontSee('Username cannot be blank.'); $I->dontSee('Password cannot be blank.'); $I->dontSee('Confirm Password cannot be blank.'); $I->dontSee('Password cannot be blank.'); $I->see('Email is not a valid email address.'); // signup with mismatching password $I->amOnPage('/account/account/signUp'); $I->fillField('AccountSignUp_first_name', 'demo_first_name'); $I->fillField('AccountSignUp_last_name', 'demo_last_name'); $I->fillField('AccountSignUp_email', '*****@*****.**'); $I->fillField('AccountSignUp_username', 'demo'); $I->fillField('AccountSignUp_password', 'demo123'); $I->fillField('AccountSignUp_confirm_password', 'demo321'); $I->click('Sign Up');
$I->amOnPage('/account/account/login'); $I->see('Username'); $I->see('Password'); $I->see('Remember me next time'); // login with empty details $I->amOnPage('/account/account/login'); $I->click('Login'); $I->see('Please fix the following input errors:'); $I->see('Username cannot be blank.'); $I->see('Password cannot be blank.'); // login with empty password $I->amOnPage('/account/account/login'); $I->fillField('AccountLogin_username', 'admin'); $I->click('Login'); $I->see('Please fix the following input errors:'); $I->dontSee('Username cannot be blank.'); $I->see('Password cannot be blank.'); // login with empty username $I->amOnPage('/account/account/login'); $I->fillField('AccountLogin_password', 'admin'); $I->click('Login'); $I->see('Please fix the following input errors:'); $I->see('Username cannot be blank.'); $I->dontSee('Password cannot be blank.'); // login with correct username $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.'); // check login name
$I->wait(2); $I->click('Publish', '#publishing-action'); $I->see('Post Published'); $I->seeCheckboxIsChecked('#pubcode_' . $authcode['name']); } $I->amGoingTo('Log Out so we can check that the content is password protected'); $WP->logout(); $I->amGoingTo('Test the protected content'); foreach ($pubcodes[$a] as $authcode) { $I->amOnPage('/'); $I->click('Test Post for ' . $authcode['description']); $I->see('Enter your username and password below'); $I->fillField('log', $sample_accounts[$a]['username']); $I->fillField('pwd', $sample_accounts[$a]['password']); $I->click('Log In'); $I->see($sample_accounts[$a]['expected_results'][$authcode['name']]); $WP->logout(); } $I->amGoingTo('Log in as admin'); $WP->admin_login(); $I->amGoingTo('Delete the ' . $a . ' pubcodes'); $I->amOnPage($plugins['auth']['admin_page']); foreach ($pubcodes[$a] as $authcode) { $I->amGoingTo('Delete ' . $authcode['name']); $I->click('#delete_' . $authcode['name']); $I->acceptPopup(); $I->waitForJS('return jQuery.active == 0', 5); $I->dontSee($authcode['description']); } $WP->logout(); }
/** * Test we see expected content in page after authentication. * * @param WebGuy $I * The Guy object being used to test. * * @env misconfigured */ public function dontSeeContentAfterFailedAuthentication(WebGuy $I) { $I->amOnPage(self::HTTP_AUTH_PROTECTED_PATH); $I->dontSee(self::HTTP_AUTH_EXPECTED_PROTECTED_PAGE_CONTENT); }
<?php /** * this acceptance test expects the path http://localhost/winkform/ to point to the directory /example/ * All input elements are inside the TestForm and rendered in the example. */ $I = new WebGuy($scenario); $I->wantTo('see the test form'); $I->amOnPage('/'); $I->see('form', '#container'); // no errors or warnings must be displayed $I->dontSee('error'); $I->dontSee('Error'); $I->dontSee('Warning'); $I->dontSee('warning'); // address field $I->wantTo('check the address field'); $I->see('.address'); $I->seeElement('label[for=address-postal-code]'); $I->seeElement('input#address-postal-code'); $I->seeInField('input#address-postal-code', 'postal code'); $I->see('focus', 'script'); // chained dropdowns $I->wantTo('check the chained dropdowns'); $I->seeElement('select#one'); $I->see('chainedTo', 'script');
<?php $I = new WebGuy($scenario); $I->wantTo('make sure the page editor user cannot see any content types except pages'); $I->loginAs($users['pagewriter']); $I->see('View Pages'); $I->dontSee('Edit Entries'); $I->dontSee('Edit Kitchensinks'); $I->dontSee('Edit Dummies');