Inheritance: extends Codeception\Actor
示例#1
0
 /**
  * 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);
 }
示例#4
0
 /**
  * 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');
 }
示例#5
0
 /**
  * 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');
 }
 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');
 }
示例#7
0
 /**
  * 
  * @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)');
 }
 /**
  * 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"));
 }
 /**
  * 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.");
         }
     }
 }
<?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:"));
示例#12
0
<?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 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'));
示例#14
0
<?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('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');
示例#16
0
<?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('*****@*****.**');
示例#17
0
<?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('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('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');
示例#20
0
<?php

use tests\_pages\ContactPage;
$I = new WebGuy($scenario);
$I->wantTo('ensure that contact works');
$contactPage = ContactPage::openBy($I);
$I->see('Contact', 'h1');
$I->amGoingTo('submit contact form with no data');
$contactPage->submit([]);
$I->expectTo('see validations errors');
$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->amGoingTo('submit contact form with not correct email');
$contactPage->submit(['name' => 'tester', 'email' => 'tester.email', 'subject' => 'test subject', 'body' => 'test content', 'verifyCode' => 'testme']);
$I->expectTo('see that email adress is wrong');
$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->amGoingTo('submit contact form with correct data');
$contactPage->submit(['name' => 'tester', 'email' => '*****@*****.**', 'subject' => 'test subject', 'body' => 'test content', 'verifyCode' => 'testme']);
if (method_exists($I, 'wait')) {
    $I->wait(3);
    // only for selenium
}
$I->dontSeeElement('#contact-form');
示例#21
0
 public function _after(WebGuy $I)
 {
     $I->amOnPage('/logout');
 }
示例#22
0
文件: LoginCept.php 项目: ajb/rfpez
<?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('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

/**
* 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);
示例#25
0
<?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');
示例#26
0
<?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');
示例#27
0
<?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

/**
 * 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');
示例#29
0
<?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('log into the backend as Admin');
$I->loginAs($users['admin']);
$I->see('Dashboard');