private function append_token_to_reset_password_route(FunctionalTester $I) { // get reset token $password_reset = $I->grabRecord('password_resets', ['email' => self::EMAIL]); // fill password reset form $I->amOnPage('/password/reset/' . $password_reset->token); }
private function grabUser(FunctionalTester $I) { return $I->grabRecord('users', ['id' => $this->user->id]); }
<?php $I = new FunctionalTester($scenario); $I->resetEmails(); //setup $I->am('a user'); $I->wantTo('activate my email adress'); $I->amAuthenticatedWithCredentials(); $I->canSeeAuthentication(); $I->amOnPage('/confirmation'); //action //step1 $I->click('#submit-mail-code'); //step2 $I->seeInLastEmail('*****@*****.**'); $I->seeInLastEmail('Confirmation Code'); //step3 $I->seeRecord('users_confirmations', ['user_id' => 1, 'type' => 'mail']); //step4 $code = $I->grabRecord('users_confirmations', ['user_id' => 1, 'type' => 'mail']); $I->amOnPage('/confirmation/mail/' . $code->confirmation_code); $I->dontSee('#submit-mail-code'); $I->seeRecord('users_profiles', ['user_id' => 1, 'mail_confirmed' => 1]);
<?php $I = new FunctionalTester($scenario); $I->expectTo('have a usere in the database'); $I->haveRecord('users', ['username' => 'verem', 'password' => 'danverem', 'email' => '*****@*****.**', 'profile_state' => 0]); $I->expectTo('have a logged in user'); $user = $I->grabRecord('users', ['username' => 'verem']); $I->amLoggedAs(['username' => $user->username, 'id' => $user->id, 'password' => $user->password]); $I->wantTo('test if chops is posting to database'); $I->amOnAction('ChopsController@create'); $I->seeInCurrentUrl('/create'); $I->see('What\'s that special meal you just ate today'); $I->fillField('name', 'edikaikong'); $I->attachFile('image', 'julia.jpeg'); $I->fillField('about', 'This food is the best dish in the country'); $I->click('submitButton'); $I->seeInCurrentUrl('/chops');
<?php /** * 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);
public function it_successfully_changes_password_from_password_change_form(FunctionalTester $I) { $email = '*****@*****.**'; //Existing record in DB $resetRecord = $I->grabRecord('password_resets', ['email' => $email]); $I->amOnPage(PasswordChangePage::$PAGE_PLAIN . $resetRecord->token); $I->fillField('email', $email); $I->fillField('password', '123456'); $I->fillField('password_confirmation', '123456'); $I->submitForm(PasswordChangePage::$formId, [], PasswordChangePage::$submit); $I->see('Password successfully reset. You can now login.'); }
<?php $I = new FunctionalTester($scenario); $I->wantTo('remind my password'); $user = $I->haveRecord('users', ['name' => 'Joe Doe', 'email' => '*****@*****.**', 'password' => bcrypt('123'), 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'is_confirm' => 1]); $I->amOnPage('/Password'); $I->fillField('email', '*****@*****.**'); $I->click('button[type=submit]'); $I->see('Na podany adres e-mail wysłane zostały dalsze instrukcje'); $I->seeRecord('password_resets', ['email' => '*****@*****.**']); $record = $I->grabRecord('password_resets', ['email' => '*****@*****.**']); $I->amOnPage('Password/reset/' . $record->token); $I->fillField('email', '*****@*****.**'); $I->fillField('password', '1234'); $I->fillField('password_confirmation', '1234'); $I->click('button[type=submit]'); $I->see('Hasło zostało prawidłowo ustawione');