本文整理汇总了PHP中FunctionalTester::amGoingTo方法的典型用法代码示例。如果您正苦于以下问题:PHP FunctionalTester::amGoingTo方法的具体用法?PHP FunctionalTester::amGoingTo怎么用?PHP FunctionalTester::amGoingTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FunctionalTester
的用法示例。
在下文中一共展示了FunctionalTester::amGoingTo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testChangePassword
public function testChangePassword(FunctionalTester $I)
{
$I->amGoingTo('test the change password functionality');
// Create one user
$user = Commons::createUser();
$I->amGoingTo('login a user');
$loginPage = LoginPage::openBy($I);
$loginPage->login(Commons::TEST_EMAIL, Commons::TEST_PASSWORD);
$changePasswordPage = ChangePasswordPage::openBy($I);
$I->see('Change password');
$I->seeElement('#changepasswordform-newpassword');
$I->seeElement('#changepasswordform-newpasswordrepeat');
$I->dontSeeElement('#changepasswordform-email');
$I->dontSeeElement('#changepasswordform-oldpassword');
$I->amGoingTo('try to change the password with two different passwords for the new password and the new password repeat fields');
$changePasswordPage->changePassword('123123', '234234');
$I->expect('the form will catch the difference');
$I->see('The new passwords are not the same.');
$I->amGoingTo('test adding new password with length lower than the default length');
$changePasswordPage->changePassword('123', '123');
$I->expect('the form will warn the user');
$I->see('New password should contain at least 6 characters');
$I->see('New password repeat should contain at least 6 characters');
$I->amGoingTo('change the password of the user properly');
$changePasswordPage->changePassword('Nik)lay!23', 'Nik)lay!23');
$I->expect('that this time everything will be ok and the user will be redirected to the home page');
$user->refresh();
$I->assertNotNull($user->password_changed_at);
$I->seeInCurrentUrl('/');
}
示例2: getNoErrorIfAssetsAreDumped
public function getNoErrorIfAssetsAreDumped(FunctionalTester $I)
{
$I->bootKernelWith('customized');
$I->runCommand('maba_webpack.command.setup');
$I->seeFileFound(__DIR__ . '/Fixtures/package.json');
$I->seeFileFound(__DIR__ . '/Fixtures/app/config/webpack.config.js');
$I->runCommand('maba_webpack.command.compile');
$I->seeCommandStatusCode(0);
$I->seeInCommandDisplay('webpack');
$I->dontSeeInCommandDisplay('error');
$I->amOnPage('/customized');
$I->canSeeResponseCodeIs(200);
$I->dontSee('Manifest file not found');
$I->seeInSource('<link rel="stylesheet" id="css1" href="/assets/');
$href = $I->grabAttributeFrom('link#css1', 'href');
preg_match('#/assets/(.*)#', $href, $matches);
$I->seeFileFound(__DIR__ . '/Fixtures/web/assets/' . $matches[1]);
$I->openFile(__DIR__ . '/Fixtures/web/assets/' . $matches[1]);
$I->canSeeInThisFile('.green');
$I->canSeeInThisFile('.red');
$I->canSeeInThisFile('-ms-fullscreen a.css');
$I->amGoingTo('Check if less file was compiled');
$I->canSeeInThisFile('color: #123456');
$I->canSeeInThisFile('-ms-fullscreen a.less');
$I->amGoingTo('Check if sass file was compiled');
$I->canSeeInThisFile('color: #654321');
$I->canSeeInThisFile('-ms-fullscreen a.scss');
$I->amGoingTo('Check if cat.png was included');
$I->canSeeInThisFile('background: url(/assets/');
$I->seeInSource('<link rel="stylesheet" id="css2" href="/assets/');
$href = $I->grabAttributeFrom('link#css2', 'href');
preg_match('#/assets/(.*)#', $href, $matches);
$I->seeFileFound(__DIR__ . '/Fixtures/web/assets/' . $matches[1]);
$I->openFile(__DIR__ . '/Fixtures/web/assets/' . $matches[1]);
$I->canSeeInThisFile('color: #123456');
$I->seeInSource('<script src="/assets/');
$src = $I->grabAttributeFrom('script', 'src');
preg_match('#/assets/(.*)#', $src, $matches);
$I->seeFileFound(__DIR__ . '/Fixtures/web/assets/' . $matches[1]);
$I->openFile(__DIR__ . '/Fixtures/web/assets/' . $matches[1]);
$I->canSeeInThisFile('additional-asset-content');
$I->canSeeInThisFile('additional asset B');
$I->canSeeInThisFile('app-asset-content');
$I->dontSeeInThisFile('featureA-content');
$I->dontSeeInThisFile('featureB-content');
$I->seeInSource('<img src="/assets/');
$src = $I->grabAttributeFrom('img', 'src');
preg_match('#/assets/(.*)#', $src, $matches);
$I->seeFileFound(__DIR__ . '/Fixtures/web/assets/' . $matches[1]);
$I->seeFileIsSmallerThan(__DIR__ . '/Fixtures/web/assets/' . $matches[1], __DIR__ . '/Fixtures/src/Resources/assets/cat.png');
}
示例3: testResetPassword
public function testResetPassword(FunctionalTester $I)
{
$user = Commons::createUnconfirmedUser();
$token = Commons::createTokenForUser($user->id);
$I->amGoingTo('test that the reset password functionality is working properly');
$I->amGoingTo('to confirm the email for the user');
PasswordResetPage::openBy($I, ['code' => $token->code]);
$I->expectTo('see successful reset');
$I->dontSeeRecord(Token::className(), ['user_id' => $user->id]);
$I->expectTo('see the user is sent to the change password form');
$I->see('Change password');
$I->seeElement('#changepasswordform-newpassword');
$I->seeElement('#changepasswordform-newpasswordrepeat');
}
示例4: FunctionalTester
<?php
$I = new FunctionalTester($scenario);
$I->wantTo('I am Admin and Update Company Mau');
$I->dontSeeAuthentication();
$I->amLoggedAs(['email' => 'admin@admin.com', 'password' => 'admin']);
$I->seeAuthentication();
//When
$id = $I->haveRecord('companys', ['name' => 'Maur', 'partner_id' => '2', 'currency_id' => '3', 'fiscalRegimen_id' => '2']);
//And
$I->amOnPage('/settings/company/' . $id);
//then
$I->see('Edit');
//When
$I->click('Edit');
$I->seeCurrentUrlEquals('/settings/company/' . $id . '/edit');
$I->seeInField('name', 'Maur');
$I->seeInField('partner_id', '2');
$I->seeInField('currency_id', '3');
$I->seeInField('fiscalRegimen_id', '2');
//And
$I->amGoingTo('Change name of Maur to Association_Mau');
$form = ['name' => 'Association_Mau', 'partner_id' => '3', 'currency_id' => '2', 'fiscalRegimen_id' => '1'];
示例5: FunctionalTester
<?php
/* @var $scenario Codeception\Scenario */
$I = new FunctionalTester($scenario);
/* TESTING CREATE EMPLOYEE */
$I->wantTo('Memastikan "Create Employee" bekerja');
$I->amOnPage(['employee/create']);
$I->amGoingTo('submit form dengan data input kosong');
$I->click('button[type="submit"]');
$I->expectTo('Validasi eror muncul!');
$I->see('Name cannot be blank.');
$I->see('Age cannot be blank.');
$I->amGoingTo('submit form dengan data');
$I->fillField('input[name="Employee[name]"]', 'Hafid');
$I->fillField('input[name="Employee[age]"]', '30');
$I->click('button[type="submit"]');
$I->expectTo('ada data Hafid di tabel employee');
$I->seeRecord('\\app\\models\\Employee', ['name' => 'Hafid']);
示例6: FunctionalTester
<?php
$I = new FunctionalTester($scenario);
$I->wantTo('visit all pages');
$I->amGoingTo('visit the home page');
$I->amOnPage('/');
$I->seeResponseCodeIs(200);
$I->see('Nope');
$I->amGoingTo('visit the getting started page');
$I->amOnPage('/getting-started');
$I->seeResponseCodeIs(200);
$I->see('Introduction');
$I->see('Installation');
$I->amGoingTo('visit the statistics page');
$I->amOnPage('/stats');
$I->seeResponseCodeIs(200);
$I->see('Total Pokes');
$I->see('Total Devices');
示例7: FunctionalTester
<?php
$I = new FunctionalTester($scenario);
$I->wantTo('I am Admin and Update partner Mario');
$I->dontSeeAuthentication();
$I->amLoggedAs(['email' => 'admin@admin.com', 'password' => 'admin']);
$I->seeAuthentication();
//When
$id = $I->haveRecord('partners', ['name' => 'Mario', 'country_id' => 1, 'state_id' => 1, 'city_id' => 1]);
//And
$I->amOnPage('/partners/' . $id);
//then
$I->see('Edit');
//When
$I->click('Edit');
$I->seeCurrentUrlEquals('/partners/' . $id . '/edit');
$I->seeInField('name', 'Mario');
$I->seeInField('country_id', 1);
$I->seeInField('state_id', 1);
$I->seeInField('city_id', 1);
//And
$I->amGoingTo('Change name of Mario to Mariano');
$form = ['name' => 'Mariano', 'country_id' => 1, 'state_id' => 1, 'city_id' => 1];
$I->submitForm('//form', $form, 'Save');
示例8: FunctionalTester
<?php
use yii\helpers\Url;
$I = new FunctionalTester($scenario);
$I->wantTo('ensure that confirmation works');
$I->amGoingTo('check that error is showed when token expired');
$token = $I->getFixture('token')->getModel('expired_confirmation');
$I->amOnPage(Url::toRoute(['/user/registration/confirm', 'id' => $token->user_id, 'code' => $token->code]));
$I->see('We are sorry but your confirmation token is out of date');
$I->amGoingTo('check that user get confirmed');
$token = $I->getFixture('token')->getModel('confirmation');
$I->amOnPage(Url::toRoute(['/user/registration/confirm', 'id' => $token->user_id, 'code' => $token->code]));
$I->see('You have successfully confirmed your email address. You may sign in using your credentials now');
$I->see('Logout');
示例9: FunctionalTester
<?php
$I = new FunctionalTester($scenario);
$I->am('a CMS admin');
$I->wantTo('create a new section');
// When
$I->amOnPage('admin/sections');
// And
$I->click('Add a new section');
// Then
$I->seeCurrentUrlEquals('/admin/sections/create');
$I->see('New section', 'h1');
$I->amGoingTo('Omit the name field in order to submit an invalid form');
// When
$I->fillField('Slug URL', 'our-company');
$I->click('Create section');
// Then
$I->expectTo('See the form again with the errors');
$I->seeCurrentUrlEquals('/admin/sections/create');
$I->seeInField('slug_url', 'our-company');
$I->see('The name field is required', '.error');
$I->amGoingTo('Fill a valid form');
// When
$I->fillField('Name', 'Our company');
$I->fillField('Slug URL', 'our-company');
$I->selectOption('type', 'blog');
$I->selectOption('menu', 1);
$I->fillField('menu_order', 2);
$I->selectOption('published', 0);
// And
$I->click('Create section');
示例10: FunctionalTester
<?php
$I = new FunctionalTester($scenario);
$I->am('a CMS admin');
$I->wantTo('paginate the sections results');
$I->amGoingTo('Go to page 1');
// When
$sections = $I->haveSections(16);
// And
$I->amOnPage('/admin/sections');
// Then
$I->see('There are 16 sections, showing page 1 of 2');
$I->expectTo('see the first section');
$I->see($sections->first()->name, 'tbody tr:first-child td.name');
$I->expect('not to see the last section');
$I->dontSee($sections->last()->name);
$I->expectTo('see the page 2 link');
$I->see('2', '.pagination a');
$I->amGoingTo('go to page 2');
// When
$I->click('2', '.pagination a');
// Then
$I->expectTo('see the pagination parameter in the URL');
$I->seeCurrentUrlEquals('/admin/sections?page=2');
$I->expect('not to see the first section');
$I->dontSee($sections->first()->name);
$I->expectTo('see the last section');
$I->see($sections->last()->name);
$I->expectTo('See the section #15 as first item on page 2');
$I->see($sections->get(15)->name, 'tbody tr:first-child td.name');
$I->amGoingTo('go back to page 1');
示例11:
// And
$I->amOnPage('admin/sections/' . $id);
// Then
$I->see('Edit section', '.btn-edit');
// When
$I->click('Edit section');
// Then
$I->seeCurrentUrlEquals('/admin/sections/' . $id . '/edit');
$I->see('Edit section "Our company"', 'h1');
$I->seeInField('name', 'Our company');
$I->seeInField('slug_url', 'our-company');
$I->seeInField('menu_order', 2);
$I->seeOptionIsSelected('published', 0);
$I->seeOptionIsSelected('menu', 1);
$I->seeOptionIsSelected('type', 'Page');
$I->amGoingTo('Submit an invalid form');
// When
$I->fillField('name', '');
// And
$I->click('Update section');
// Then
$I->expectTo('see the form back with data and errors');
$I->seeCurrentUrlEquals('/admin/sections/' . $id . '/edit');
$I->seeInField('name', '');
$I->seeInField('slug_url', 'our-company');
$I->see('The name field is required', '.error');
$I->amGoingTo('Submit a valid form');
// When
$I->fillField('name', 'Who we are');
$I->selectOption('published', 1);
// And
示例12: FunctionalTester
/**
* Created by PhpStorm.
* User: bill
* Date: 26.01.15
* Time: 11:31
*/
use app\tests\codeception\_pages\mobile\number\CreatePage;
use app\modules\mobile\models\Number;
use app\modules\mobile\models\Document;
use app\modules\directory\models\Employee;
$I = new FunctionalTester($scenario);
$I->wantTo("ensure that creation Number model works");
$owner = $I->grabRecord(Employee::className(), ['id' => 1]);
$newDocument = 'file1.jpg';
$number = '9876543210';
$I->amGoingTo("prepare database.");
Document::deleteAll(['filename' => $newDocument]);
Number::deleteAll(['number' => $number]);
$page = CreatePage::openBy($I);
$I->dontSeeElement("input[type=file]");
$I->dontSeeElement("#documents-panel-body");
$I->dontSeeElement("#history-panel-body");
$page->submit(['number' => $number, 'ownerName' => $owner->fullName, 'ownerPost' => $owner->post, 'operatorId' => 'operator2', 'destination' => Number::DESTINATION_MODEM, 'limit' => "1000", 'options' => [Number::OPTION_ACCOUNTING, Number::OPTION_DIRECTORY], 'comment' => 'This is comment of testing number.']);
$I->SeeRecord(Number::className(), ['number' => $number, 'ownerId' => 1, 'operatorId' => 'operator2', 'destination' => Number::DESTINATION_MODEM, 'limit' => 1000, 'options' => [Number::OPTION_ACCOUNTING, Number::OPTION_DIRECTORY], 'history' => [['ownerId' => 'employee1', 'rentDate' => time()]], 'comment' => 'This is comment of testing number.']);
$I->see("Номер успешно создан", '.alert-success');
$I->seeInField($page->fieldSelector('ownerName'), $owner->fullName);
$I->seeInField($page->fieldSelector('ownerPost'), $owner->posts[1]);
$I->seeOptionIsSelected($page->fieldSelector('operatorId'), "Оператор 2");
$I->seeOptionIsSelected($page->fieldSelector('destination'), Number::DESTINATION_MODEM);
$I->seeCheckboxIsChecked($page->fieldSelector(Number::OPTION_ACCOUNTING));
$I->seeCheckboxIsChecked($page->fieldSelector(Number::OPTION_DIRECTORY));
示例13: FunctionalTester
<?php
$I = new FunctionalTester($scenario);
$I->wantTo('check application versioning');
$I->dontSeeFileFound('src/version');
$I->seeFileFound('version');
$I->openFile('version');
$I->dontSeeInThisFile('dev');
$I->dontSeeInThisFile('dirty');
$version = file_get_contents('version');
$I->amGoingTo('check version visiblity in modal');
$I->expectTo('see application version ' . $version);
$I->amOnPage('/user/security/login');
$I->see($version, '.modal-body');
示例14: FunctionalTester
<?php
$I = new FunctionalTester($scenario);
$I->am('registered common user');
$I->wantTo('perform authentication actions');
// When
$I->amOnPage('login');
// Then
$I->see('Log in', 'h2');
$I->see('Username', 'label');
$I->see('Password', 'label');
$I->see('Remember me', 'label');
$I->seeElement('input', ['value' => 'Log in', 'class' => 'btn btn-primary btn-block']);
$I->amGoingTo('fill an invalid user in order to see the errors');
// When
$I->fillField('username', 'admin');
$I->fillField('password', '12345');
// And
$I->click('Log in', 'input[type=submit]');
// Then
$I->expectTo('see an error message');
$I->seeCurrentUrlEquals('/login');
$I->seeInField('username', 'admin');
$I->see('Invalid data', '.alert-danger');
$I->haveRecord('users', ['first_name' => 'System', 'last_name' => 'Administrator', 'username' => 'admin', 'password' => Hash::make('secret'), 'email' => 'dacosta.dev@nucleogps.com', 'remember_token' => null]);
$I->amGoingTo('full a valid user and see the result');
// When
$I->fillField('password', 'secret');
// And
$I->click('Log in', 'input[type=submit]');
// Then
示例15: FunctionalTester
<?php
$I = new FunctionalTester($scenario);
$I->amGoingTo('check version visiblity');
$I->seeFileFound('/app/version');
$version = file_get_contents('/app/version');
$I->expectTo('see application version ' . $version);
$I->amOnPage('/en-us');
$I->see($version);