public function testDuplicateEmail(FunctionalTester $I) { $I->haveRecord('users', ['email' => $this->tester['email']]); $I->fillField('email', $this->tester['email']); $I->click('Register', 'button'); $I->seeFormErrorMessage('email', 'already been taken'); }
public function canEditMicroblog(FunctionalTester $I) { $fake = Factory::create(); $text = $fake->text(); $id = $I->haveRecord('microblogs', ['user_id' => $this->user->id, 'text' => $text, 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'score' => 0]); $I->amOnRoute('microblog.save', [$id]); $I->see($text); }
public function deleteMyRedirect(FunctionalTester $I) { $I->haveRecord('links', $this->linkRecord); LinksPage::of($I)->deleteLink(); $I->dontSeeRecord('links', $this->linkRecord); $I->seeCurrentUrlEquals(LinksPage::$URL); $I->dontSee('/' . $this->link['uri']); }
public function deletePost(FunctionalTester $I) { $id = $I->haveRecord('posts', $this->postAttributes); $I->amOnPage(PostsPage::$url); $I->see('Hello Universe'); PostsPage::of($I)->deletePost($id); $I->seeCurrentUrlEquals(PostsPage::$url); $I->dontSee('Hello Universe'); }
public function testLoginSuccsess(FunctionalTester $I) { $I->wantTo('login as a user'); $I->haveRecord('users', ['name' => 'john', 'email' => '*****@*****.**', 'password' => bcrypt('123456'), 'created_at' => new DateTime(), 'updated_at' => new DateTime()]); $I->amOnPage('auth/login'); $I->fillField('email', '*****@*****.**'); $I->fillField('password', '123456'); $I->click('Login'); $I->amOnPage('/'); $I->seeAuthentication(); }
public function loginUsingCredentials(FunctionalTester $I) { $I->dontSeeAuthentication(); $I->haveRecord('users', $this->userAttributes); $I->amLoggedAs(['email' => '*****@*****.**', 'password' => 'password']); $I->amOnPage(PostsPage::$url); $I->seeCurrentUrlEquals(PostsPage::$url); $I->seeAuthentication(); $I->logout(); $I->dontSeeAuthentication(); }
public function tryRegisterDesiredInputWithDefaultRole(FunctionalTester $I) { $I->haveRecord('roles', ['id' => 2, 'name' => 'Spectator', 'slug' => 'spectator', 'landing' => 'admin/profile', 'is_default' => true, 'created_at' => new DateTime(), 'updated_at' => new DateTime()]); $I->wantTo('Register a user with desired input'); $I->amOnPage('/register'); $I->fillField('username', 'usertest'); $I->fillField('email', '*****@*****.**'); $I->fillField('password', '123456'); $I->fillField('password_confirmation', '123456'); $I->click('button[type=submit]'); $I->seeRecord('users', ['username' => 'usertest']); $I->seeCurrentUrlEquals('/login'); }
public function _before(FunctionalTester $I) { $dt = new DateTime(); $I->haveRecord('roles', ['id' => 1, 'name' => 'Administrator', 'slug' => 'administrator', 'landing' => 'admin/dashboard', 'created_at' => new DateTime(), 'updated_at' => new DateTime()]); $I->haveRecord('users', ['id' => 1, 'username' => 'admin', 'email' => '*****@*****.**', 'password' => bcrypt('123456'), 'created_at' => new DateTime(), 'updated_at' => new DateTime()]); $I->haveRecord('users', ['id' => 2, 'username' => 'admin2', 'email' => '*****@*****.**', 'password' => bcrypt('123456'), 'created_at' => new DateTime(), 'updated_at' => new DateTime()]); $I->haveRecord('password_resets', ['email' => '*****@*****.**', 'token' => 'reset-token', 'created_at' => new DateTime()]); $I->haveRecord('password_resets', ['email' => '*****@*****.**', 'token' => 'reset-token2', 'created_at' => $dt->modify('-2 hour')]); $I->haveRecord('role_user', ['user_id' => 1, 'role_id' => 1]); $I->haveRecord('role_user', ['user_id' => 2, 'role_id' => 1]); }
public function _before(FunctionalTester $I) { $I->haveRecord('roles', ['id' => 1, 'name' => 'Administrator', 'slug' => 'administrator', 'landing' => 'admin/dashboard', 'created_at' => new DateTime(), 'updated_at' => new DateTime()]); $I->haveRecord('roles', ['id' => 2, 'name' => 'Spectator', 'slug' => 'spectator', 'landing' => 'admin/profile', 'created_at' => new DateTime(), 'updated_at' => new DateTime()]); $I->haveRecord('users', ['id' => 1, 'username' => 'admin', 'email' => '*****@*****.**', 'password' => bcrypt('123456'), 'created_at' => new DateTime(), 'updated_at' => new DateTime()]); $I->haveRecord('users', ['id' => 2, 'username' => 'spectator', 'email' => '*****@*****.**', 'password' => bcrypt('123456'), 'created_at' => new DateTime(), 'updated_at' => new DateTime()]); $I->haveRecord('role_user', ['user_id' => 1, 'role_id' => 1]); $I->haveRecord('role_user', ['user_id' => 2, 'role_id' => 2]); }
$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' => '*****@*****.**', '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 $I->seeCurrentUrlEquals(''); $I->see('You have arrived.', 'h1'); $I->see('Log out', 'a'); $I->seeAuthentication(); $I->amGoingTo('log out'); // When $I->click('Log out', 'a'); // Then $I->seeCurrentUrlEquals('/login');
<?php use Coyote\Actkey; $I = new FunctionalTester($scenario); $I->wantTo('confirm my email address'); $userId = 100001; $actkey = 'randomstring'; $I->haveRecord('users', ['id' => $userId, 'name' => 'Joe Doe', 'email' => '*****@*****.**', 'password' => bcrypt('123'), 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'is_confirm' => 0]); // uzywamy modelu poniewaz w tabeli nie ma klucza "id" Actkey::create(['actkey' => $actkey, 'user_id' => $userId]); $I->amOnPage("/User/Confirm/Email?id={$userId}&actkey={$actkey}"); $I->see('Adres e-mail został pozytywnie potwierdzony'); $I->dontSeeRecord('actkeys', ['actkey' => $actkey, 'user_id' => $userId]);
<?php $I = new FunctionalTester($scenario); $I->am('a Administrator see Partners'); $I->dontSeeAuthentication(); $I->amLoggedAs(['email' => '*****@*****.**', 'password' => 'admin']); $I->seeAuthentication(); $id = $I->haveRecord('partners', ['name' => 'Mario', 'country_id' => 1, 'state_id' => 1, 'city_id' => 1]); $I->amOnPage('/partners/' . $id); $I->see('Mario');
<?php $I = new FunctionalTester($scenario); $I->wantTo('I am Admin and Update Company Mau'); $I->dontSeeAuthentication(); $I->amLoggedAs(['email' => '*****@*****.**', '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'];
<?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 $I = new FunctionalTester($scenario); $I->wantTo('login as a user'); $I->haveRecord('users', ['name' => 'Joe Doe', 'email' => '*****@*****.**', 'password' => bcrypt('123'), 'created_at' => new DateTime(), 'updated_at' => new DateTime()]); $I->amOnPage('/Login'); $I->fillField('name', 'Joe Doe'); $I->fillField('password', '123'); $I->click('button[type=submit]'); $I->amOnPage('/'); $I->seeAuthentication(); $I->see('Joe Doe', '.dropdown-username');
<?php $I = new FunctionalTester($scenario); $I->wantTo('I am Admin and Delete a new currency'); $I->dontSeeAuthentication(); $I->amLoggedAs(['email' => '*****@*****.**', 'password' => 'admin']); $I->seeAuthentication(); $I->amOnPage('/settings/currency/create'); //when $form = ['name' => 'Mau', 'symbol' => '@']; //And $id = $I->haveRecord('currencys', ['name' => 'Mau', 'symbol' => '@']); //And $I->amOnPage('/settings/currency/' . $id); //then $I->see('Delete'); //When $I->submitForm('//form', ['id' => $id], 'Delete'); $I->seeCurrentUrlEquals('/settings/currency');
// only empty name $I->amGoingTo('test name validation'); $I->fillField('slug', 'libro'); $I->fillField('active', 1); $I->click('Create'); $I->dontSeeRecord('categories', ['slug' => 'libro', 'active' => 1]); $I->seeCurrentUrlEquals('/categories/create'); $I->see('The name field is required', '.error'); $I->seeInField('slug', 'libro'); $I->dontSee('The slug field is required'); // all form filled $I->fillField('name', 'Libro'); $I->fillField('slug', 'libro'); $I->fillField('active', 1); $I->click('Create'); $I->haveRecord('categories', ['name' => 'Libro', 'slug' => 'libro', 'active' => 1]); $I->seeCurrentUrlEquals('/categories'); $I->seeInTitle('All categories'); $I->see('Libro', 'td'); $I->see('libro', 'td'); $I->see('Si', 'td'); $I->see('Edit', '.btn-edit'); $I->see('Delete', '.btn-delete'); // name is unique $I->amGoingTo('validate if name is unique'); $I->amOnPage('/categories/create'); $I->fillField('name', 'Libro'); $I->fillField('slug', 'libro'); $I->click('Create'); $I->dontSeeRecord('categories', ['name' => 'Libro', 'slug' => 'libro', 'active' => 0]); $I->seeCurrentUrlEquals('/categories/create');
<?php $I = new FunctionalTester($scenario); $I->am('an user'); $I->wantTo('Update a group'); $I->haveRecord('users_groups', ['name' => 'test_group', 'path' => '/var/www/test', 'organization_id' => '1', 'created_at' => '2015-05-08 00:00:00', 'updated_at' => '2015-05-08 00:00:00']); //setup $I->amAuthenticatedWithCredentials(); $I->amOnPage(action('UsersManagementController@index')); $I->click("//*[text()[contains(.,'test_group')]]/following-sibling::td[4]/a[1]"); $I->click("Editer"); //modify user $I->fillField(['name' => 'name'], 'test_groups_2'); $I->click('submit-osjs-groups-create'); $I->amOnPage(action('UsersManagementController@index')); $I->see('test_groups_2');
<?php $I = new FunctionalTester($scenario); $I->wantTo('I am Admin and Delete a new user'); $I->dontSeeAuthentication(); $I->amLoggedAs(['email' => '*****@*****.**', 'password' => 'admin']); $I->seeAuthentication(); $I->amOnPage('/settings/users/create'); //when $form = ['name' => 'Jorge', 'email' => '*****@*****.**', 'password' => '123456', 'password_confirmation' => '123456']; //And $id = $I->haveRecord('users', ['name' => 'Jorge', 'email' => '*****@*****.**']); //And $I->amOnPage('/settings/users/' . $id); //then $I->see('Delete'); //When $I->submitForm('//form', ['id' => $id], 'Delete'); $I->seeCurrentUrlEquals('/settings/users'); $I->see('was delete');
<?php $I = new FunctionalTester($scenario); $I->resetEmails(); //setup $I->am('a user'); $I->wantTo('activate my email adress with expired code'); $I->amAuthenticatedWithCredentials(); $I->canSeeAuthentication(); $I->haveRecord('users_confirmations', ['type' => 'mail', 'confirmation_code' => 'KGcClDwrpbZn2XwHJbBTcqf28GrY5O', 'user_id' => 1, 'created_at' => '2015-05-08 00:00:00', 'updated_at' => '2015-05-08 00:00:00']); //step4 $code = $I->grabRecord('users_confirmations', ['user_id' => 1, 'type' => 'mail']); $I->amOnPage('/confirmation/mail/' . $code->confirmation_code); $I->seeElement('#submit-mail-code'); $I->dontSeeRecord('users_profiles', ['user_id' => 1, 'mail_confirmed' => 1]);
public function loginUsingCredentials(FunctionalTester $I) { $I->dontSeeAuthentication(); $I->haveRecord('users', $this->userAttributes); $I->amLoggedAs(['email' => '*****@*****.**', 'password' => 'password']); }
<?php $I = new FunctionalTester($scenario); $I->resetEmails(); //setup $I->am('a user'); $I->wantTo('activate my phone number with expired code'); $I->amAuthenticatedWithCredentials(); $I->haveRecord('users_confirmations', ['type' => 'phone', 'confirmation_code' => '1234', 'user_id' => 1, 'created_at' => '2015-05-08 00:00:00', 'updated_at' => '2015-05-08 00:00:00']); //action //step 1 $code = $I->grabRecord('users_confirmations', ['user_id' => 1, 'type' => 'phone']); //step2 $I->amOnPage('/confirmation/phone'); $I->fillField(['name' => 'code'], $code->confirmation_code); $I->click('submit-confirmation-code'); //step5 $I->seeCurrentUrlEquals('/confirmation'); $I->seeElement('#submit-phone-code'); $I->dontSeeRecord('users_profiles', ['user_id' => 1, 'phone_confirmed' => 1]);
<?php $I = new FunctionalTester($scenario); $I->wantTo('test if chops can be displayed on the home page after posting'); $I->expectTo('have a registered user in the database'); $user_id = $I->haveRecord('users', ['username' => 'John Doe', 'password' => 'johndope', 'email' => '*****@*****.**', 'profile_state' => 0]); $I->expectTo('have a chops record in the database'); $I->haveRecord('chops', ['chops_name' => 'A new name', 'about' => 'About this chops', 'user_id' => $user_id, 'likes' => 0]); $I->expectTo('have the action take place in the controller'); $I->amOnAction('ChopsController@index'); $I->seeInCurrentUrl('/chops'); $I->see('About this chops'); $I->see('A new name');
<?php $I = new FunctionalTester($scenario); $I->am('a Administrator see Users'); $I->dontSeeAuthentication(); $I->amLoggedAs(['email' => '*****@*****.**', 'password' => 'admin']); $I->seeAuthentication(); $id = $I->haveRecord('users', ['name' => 'Mario', 'email' => '*****@*****.**']); $I->amOnPage('/settings/users/' . $id); $I->see('Mario'); $I->see('*****@*****.**');
<?php $I = new FunctionalTester($scenario); $I->am('an user'); $I->wantTo('Add an user to a group'); //setup $I->amAuthenticatedWithCredentials(); $I->haveRecord('users_groups', ['name' => 'group_test', 'organization_id' => '1', 'created_at' => '2015-05-08 00:00:00', 'updated_at' => '2015-05-08 00:00:00']); $I->amOnPage(action('UsersManagementController@index')); $I->canSee('group_test'); $I->click('submit-usergroup-enable'); $I->canSeeElement('.alert-success');
public function _before(FunctionalTester $I) { $email = 'admin+' . str_random(8) . '@stellardestiny.online'; $I->haveRecord('users', ['name' => 'admin', 'email' => $email, 'status' => 1, 'password' => bcrypt('password'), 'created_at' => new DateTime(), 'updated_at' => new DateTime()]); $I->amLoggedAs(['email' => $email, 'password' => 'password']); }
<?php $I = new FunctionalTester($scenario); $I->wantTo('register a user from index page'); $I->expectTo('have a users in the database'); $I->amOnPage('/'); $I->haveRecord('users', ['email' => '*****@*****.**', 'username' => 'andelabendozy', 'password' => bcrypt('password'), 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'status' => TRUE, 'profile_state' => FALSE]); $I->submitForm('form#register', ['name' => 'prosper', 'email' => '*****@*****.**', 'password' => '12345678', 'password_confirmation' => '12345678']); $I->seeAuthentication(); $I->seeCurrentUrlEquals(''); $I->seeRecord('users', ['email' => '*****@*****.**']); $I->seeAuthentication(); $I->wantTo('logout'); $I->logout(); $I->dontSeeAuthentication();
<?php $I = new FunctionalTester($scenario); $I->am('a Administrator see Product'); $I->dontSeeAuthentication(); $I->amLoggedAs(['email' => '*****@*****.**', 'password' => 'admin']); $I->seeAuthentication(); $id = $I->haveRecord('products', ['name' => 'Fresca', 'description' => 'Fresca de 600 ml', 'purchasePrice' => 7, 'salePrice' => 9, 'qtyAvailable' => 20, 'incomingQty' => 12, 'virtualAvailable' => 32, 'ean13' => 'Fresca Coca-cola company', 'uom_id' => 4, 'partner_id' => 2]); $I->amOnPage('/products/' . $id); $I->see('Fresca'); $I->see('Fresca de 600 ml');
<?php $I = new FunctionalTester($scenario); $I->wantTo('flush old devices'); $piOne = ['ip' => '192.168.1.101', 'mac' => '11:22:33:44:55:66', 'name' => 'Awesome Pi One', 'created_at' => (new \Carbon\Carbon())->subHour()->toDateTimeString(), 'updated_at' => (new \Carbon\Carbon())->subHour()->toDateTimeString()]; $I->haveRecord('devices', $piOne); $piTwo = ['ip' => '192.168.1.102', 'mac' => '11:22:33:44:55:67', 'name' => 'Awesome Pi Two', 'created_at' => (new \Carbon\Carbon())->subHour()->toDateTimeString(), 'updated_at' => (new \Carbon\Carbon())->now()->toDateTimeString()]; $I->haveRecord('devices', $piTwo); $I->assertEquals(2, \PiFinder\Device::count()); $I->runConsoleCommand('pi:flush'); $I->assertEquals(1, \PiFinder\Device::count()); $I->dontSeeRecord('devices', $piOne); $I->seeRecord('devices', $piTwo);
<?php $I = new FunctionalTester($scenario); $I->wantTo('I am Admin and Update CertificateSats Mau'); $I->dontSeeAuthentication(); $I->amLoggedAs(['email' => '*****@*****.**', 'password' => 'admin']); $I->seeAuthentication(); //When $id = $I->haveRecord('certificatesats', ['name' => 'Benny', 'noSerie' => '123456', 'startDate' => '0000-00-00', 'endDate' => '0000-00-00']); //And $I->amOnPage('/settings/certificatesats/' . $id); //then $I->see('Edit'); //When $I->click('Edit'); $I->seeCurrentUrlEquals('/settings/certificatesats/' . $id . '/edit'); $I->seeInField('name', 'Benny'); $I->seeInField('noSerie', '123456'); $I->seeInField('startDate', '0000-00-00'); $I->seeInField('endDate', '0000-00-00'); //And $I->amGoingTo('Change name of Benny to Iggy2'); $form = ['name' => 'Iggy2', 'noSerie' => '1234567', 'startDate' => '2010-02-01', 'endDate' => '2019-04-01'];