public function _before(FunctionalTester $I) { $this->tester = ['name' => 'Tester', 'email' => 'tester+' . str_random(8) . '@stellardestiny.online', 'password' => 'password']; $I->amOnPage('/'); $I->click('Register'); $I->seeCurrentUrlEquals('/auth/register'); }
public function cantCreateDuplicateKeyEntry(FunctionalTester $I) { $I->am('an equipment team member'); $I->wantTo('make sure I cant create duplicate entries'); //Load and login a known member $I->loginEquipmentTeamMember(); $I->amOnPage('/equipment'); $I->canSee('Record a new item'); $name = $this->faker->word; $slug = substr($this->faker->slug, 0, 10); //First item $I->click('Record a new item'); $I->fillField('Name', $name); $I->fillField('Slug', $slug); $I->click('Save'); $I->seeCurrentUrlEquals('/equipment/' . $slug . '/edit'); /* //Second item $I->click('Record a new item'); $I->fillField('Name', $name); $I->fillField('Key', $slug); $I->assertTrue( $I->seeExceptionThrown('BB\Exceptions\FormValidationException', function() use ($I){ $I->click('Save'); }) ); */ }
/** @test */ public function should_correctly_route_to_index(FunctionalTester $I) { // given .. I am on index page $I->amOnPage('/'); // then ... I should see correct route $I->seeCurrentUrlEquals('/'); }
public function openPageByRoute(FunctionalTester $I) { $I->amOnRoute('front.contact'); $I->see('Contact Us'); $I->see('Send us a message and let us know how we can help.'); $I->seeCurrentUrlEquals('/contact-us'); }
/** * @param FunctionalTester $I * * @return void */ public function redirectToLogin(FunctionalTester $I) { $I->wantTo('be redirected to login page.'); $I->amOnAction('HomeController@getDashboard'); $I->dontSeeAuthentication(); $I->see('Login'); $I->seeCurrentUrlEquals(''); }
public function trySigninWithInvalidCredentials(FunctionalTester $I) { $I->wantTo('Login as user with invalid credentials'); $I->dontSeeAuthentication(); $I->amOnPage('/login'); $I->fillField('identifier', 'spectator'); $I->fillField('password', 'invalid'); $I->click('button[type=submit]'); $I->seeCurrentUrlEquals('/login'); $I->dontSeeAuthentication(); }
public function requireAuthenticationForRoute(FunctionalTester $I) { $I->dontSeeAuthentication(); $I->amOnPage('/secure'); $I->seeCurrentUrlEquals('/auth/login'); $I->see('Login'); $I->amLoggedAs(User::firstOrNew($this->userAttributes)); $I->amOnPage('/secure'); $I->seeResponseCodeIs(200); $I->see('Hello World'); }
public function requireAuthenticationForSecureRoute(FunctionalTester $I) { $I->dontSeeAuthentication(); $I->amOnPage(LinksPage::$URL); $I->seeCurrentUrlEquals(LoginPage::$URL); $I->see(LoginPage::$title); LoginPage::of($I)->loginByCredentials(env('LDAP_ADMIN_USER'), env('LDAP_ADMIN_PASSWORD')); $I->amOnPage(LinksPage::$URL); $I->seeResponseCodeIs(200); $I->see(LinksPage::$title); }
public function requireAuthenticationForRoute(FunctionalTester $I) { $I->haveEnabledFilters(); $I->amOnPage('/secure'); $I->seeCurrentUrlEquals('/auth/login'); $I->see('Login'); $I->amLoggedAs(User::create($this->userAttributes)); $I->amOnPage('/secure'); $I->seeResponseCodeIs(200); $I->see('Hello World'); }
public function financeMemberCanVisitPaymentPage(FunctionalTester $I) { $I->am('a member of the finance group'); $I->wantTo('make sure I can view the payments page'); //Load and login a known member $user = User::find(3); $role = Role::findByName('finance'); $role->users()->attach($user->id); Auth::login($user); $I->amOnPage('/payments'); $I->seeCurrentUrlEquals('/payments'); $I->see('Payments'); }
public function tryToResetPasswordWithValidToken(FunctionalTester $I) { $I->seeRecord('password_resets', ['email' => '*****@*****.**']); $I->wantTo('Reset my password invalid token'); $I->amOnPage('/password/reset/reset-token'); $I->fillField('email', '*****@*****.**'); $I->fillField('password', '123456'); $I->fillField('password_confirmation', '123456'); $I->click('button[type=submit]'); $I->dontSeeRecord('password_resets', ['email' => '*****@*****.**']); $I->seeAuthentication(); $I->seeCurrentUrlEquals('/admin/dashboard'); }
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'); }
<?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');
<?php $I = new FunctionalTester($scenario); $I->am('a Larabook member'); $I->wantTo('post statuses to my profile'); $I->signIn(); $I->amOnPage('statuses'); $I->postAStatus('My first post.'); $I->seeCurrentUrlEquals('/statuses'); $I->see('My first post');
<?php use Laracasts\TestDummy\Factory; $I = new FunctionalTester($scenario); $I->am('a USC Todo member'); $I->wantTo('post a new project'); $email = '*****@*****.**'; $password = '******'; Factory::create('App\\User', ['email' => $email, 'password' => $password]); $I->amOnPage('/auth/login'); $I->fillField('email', $email); $I->fillField('password', $password); $I->click('Login!'); //$I->signIn(); $I->seeCurrentUrlEquals('/projects');
<?php $I = new FunctionalTester($scenario); $I->wantTo('I am Admin and Update Currency Mau'); $I->dontSeeAuthentication(); $I->amLoggedAs(['email' => '*****@*****.**', 'password' => 'admin']); $I->seeAuthentication(); //When $id = $I->haveRecord('currencys', ['name' => 'Mau', 'symbol' => '@']); //And $I->amOnPage('/settings/currency/' . $id); //then $I->see('Edit'); //When $I->click('Edit'); $I->seeCurrentUrlEquals('/settings/currency/' . $id . '/edit'); $I->seeInField('name', 'Mau'); $I->seeInField('symbol', '@'); //And $I->amGoingTo('Change name of Mau to Yen'); $form = ['name' => 'Yen', 'symbol' => '@']; //$I->submitForm('//form', $form, 'Save'); /*$I->amOnPage('/settings/users/'.$id); $I->seeCurrentUrlEquals('/settings/users/'.$id); $I->see('Macrio'); $I->see('*****@*****.**');*/
<?php $I = new FunctionalTester($scenario); $I->wantTo('Sign up for a larabook account'); $I->amOnPage('/'); $I->click('Sign Up!'); $I->seeCurrentUrlEquals('/register'); $I->fillField('username', 'JohnDoe'); $I->fillField('email', '*****@*****.**'); $I->fillField('password', 'demo'); $I->fillField('password_confirmation', 'demo'); $I->click('Sign Up'); $I->seeCurrentUrlEquals(''); $I->see('Welcome to Larabook!'); $I->seeRecord('users', [ 'username' => 'JohnDoe', 'email' => '*****@*****.**' ]);
<?php $I = new FunctionalTester($scenario); $I->am('a CMS admin'); $I->wantTo('delete a section'); // When $id = $I->haveSection(); // And $I->amOnPage('admin/sections/' . $id); // Then $I->see('Delete section', 'button.btn-del'); // When $I->click('Delete section'); // Then $I->seeCurrentUrlEquals('/admin/sections'); $I->dontSeeRecord('sections', ['id' => $id]);
<?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 require_once __DIR__ . '../../ConstantFunctional.php'; $I = new FunctionalTester($scenario); $I->wantTo('Check validate for Catalog input'); $I->amOnPage('/catalog/senior/input'); //submit form //$I->checkOption('#dct195'); //$I->click('STEP2 お届け先の入力へ進む'); //url //$I->seeCurrentUrlEquals('/catalog/senior/input'); //submit_button form $I->click('STEP2 お届け先の入力へ進む'); //check required $I->seeCurrentUrlEquals('/catalog/senior/input'); $I->seeFormErrorMessages(array('name1' => '姓は必須入力項目です。必ず入力してください。', 'name2' => '名は必須入力項目です。必ず入力してください。', 'kana1' => 'セイは必須入力項目です。必ず入力してください。', 'kana2' => 'メイは必須入力項目です。必ず入力してください。', 'tel1' => 'TELは必須入力項目です。必ず入力してください。', 'post1' => '郵便番号は必須入力項目です。必ず入力してください。', 'area' => '都道府県は必須入力項目です。必ず入力してください。', 'address1' => '市町村区・町名は必須入力項目です。必ず入力してください。', 'address2' => '地名・番地・建物名は必須入力項目です。必ず入力してください。', 'email1' => 'E-mailは必須入力項目です。必ず入力してください。')); //check max length $I->fillField('name1', INPUT_LENGTH_50 . '𪚲'); //length 51 $I->fillField('name2', INPUT_LENGTH_50 . '𪚲'); //length 51 $I->fillField('kana1', INPUT_LENGTH_50 . '𪚲'); //length 51 $I->fillField('kana2', INPUT_LENGTH_50 . '𪚲'); //length 51 $I->fillField('tel1', '12456-545-4564'); //length 14 $I->fillField('post1', '060-0000'); //length 14 $I->selectOption('area', '青森県'); $I->fillField('address1', INPUT_LENGTH_50 . '𪚲');
public function openPageByAction(FunctionalTester $I) { $I->amOnAction('PostsController@index'); $I->seeCurrentUrlEquals('/posts'); $I->seeCurrentRouteIs('posts.index'); }
<?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');
<?php use Arc\Users\User; $I = new FunctionalTester($scenario); $I->wantTo('login to the Arc System'); $I->am('valid User'); $I->haveAnAccount(); $I->amOnPage('/login'); $I->fillField('email', '*****@*****.**'); $I->fillField('password', 'a52Vaza09@'); $I->click('Sign In'); $I->seeCurrentUrlEquals('/admin'); $I->see('You are logged in.');
<?php $I = new FunctionalTester($scenario); $I->wantTo('create a currency without data'); $I->am('a Administrator user'); $I->dontSeeAuthentication(); $I->amLoggedAs(['email' => '*****@*****.**', 'password' => 'admin']); $I->seeAuthentication(); //When $I->amOnPage('/settings/currency'); //And $I->see('Create'); $I->click('Create'); //Then $I->seeCurrentUrlEquals('/settings/currency/create'); //When $form = ['name' => '', 'symbol' => '']; //And $I->submitForm('//form', $form, 'Create'); //Then $I->seeFormErrorMessage('name', 'The name field is required.'); //
<?php $I = new FunctionalTester($scenario); $I->wantTo('Create Article Tests'); // Not signed tests $I->amOnRoute('article.create'); $I->seeCurrentUrlEquals('/auth/login'); // Sign in $I->signIn(); // Create article $I->amOnRoute('article.create'); $I->see('Create Article'); $I->fillField('form input[name=title]', 'New Article by FunctionalTester'); $I->selectOption('form select[name=category_id]', '1'); $I->fillField('form textarea[name=body]', 'bodybodybody \\n by FunctionalTester'); $I->click('form [type=submit]'); $I->seeCurrentUrlMatches('~^/article/(\\d+)$~');
<?php $I = new FunctionalTester($scenario); $I->wantTo('Enter Zip Code and Select Restaurants'); $I->amOnPage('/'); $I->fillField('email', '*****@*****.**'); $I->fillField('password', '12345'); $I->click('Login'); $I->seeCurrentUrlEquals('/sessions'); $I->fillField('zipcode', '10025'); $I->checkOption('indian'); $I->click('Get Restaurants'); $I->seeCurrentUrlEquals('/results');
<?php $I = new FunctionalTester($scenario); $I->am('a Larabook member'); $I->wantTo('I want to view my profile.'); $I->signIn(); $I->postAStatus('My new status.'); $I->click('Your Profile'); $I->seeCurrentUrlEquals('/@Foobar'); $I->see('My new status.');
<?php use BB\Entities\User; $I = new FunctionalTester($scenario); $I->am('a member'); $I->wantTo('update my profile photo'); //Load and login a known member $user = User::find(1); Auth::login($user); $I->amOnPage('/account/' . $user->id . '/profile/edit'); $I->canSee('Profile Photo'); $I->attachFile('Profile Photo', 'test-image.png'); $I->click('Save'); $I->seeCurrentUrlEquals('/members/' . $user->id);
<?php $I = new FunctionalTester($scenario); $I->wantTo('show all item catalogR5 input'); $I->amOnPage('/catalog/owner'); $I->checkOption('#dct279'); //submit form $I->click('お客様情報を入力'); //url $I->seeCurrentUrlEquals('/catalog/owner/input'); //title page //$I->seeInTitle('SRSF0020_セミナー申込み入力 | トランスコスモス'); //title label $I->see('お名前'); $I->see('姓'); $I->see('名'); $I->see('フリガナ'); $I->see('セイ'); $I->see('メイ'); $I->see('性別'); $I->see('男'); $I->see('女'); $I->see('年齢'); $I->see('ご職業'); $I->see('TEL'); $I->see('E-mail'); $I->see('ご住所'); $I->see('郵便番号'); $I->see('都道府県'); $I->see('市町村区・町名'); $I->see('建物タイプ(商品タイプ)');
<?php require_once __DIR__ . '../../ConstantFunctional.php'; $I = new FunctionalTester($scenario); $I->wantTo('Check validate for CatalogR3 input'); $I->amOnPage('/catalog/43up/cart?dct[]=71&dct[]=173&dct[]=213&dct[]=214&dct[]=141'); //submit form $I->click('郵送先入力画面に進む'); //url $I->seeCurrentUrlEquals('/catalog/43up/input'); //submit_button form $I->click('STEP3 入力情報の確認へ進む'); //check required $I->seeCurrentUrlEquals('/catalog/43up/input'); $I->seeFormErrorMessages(array('name1' => '姓は必須入力項目です。必ず入力してください。', 'name2' => '名は必須入力項目です。必ず入力してください。', 'kana1' => 'セイは必須入力項目です。必ず入力してください。', 'kana2' => 'メイは必須入力項目です。必ず入力してください。', 'sex' => '性別は必須入力項目です。必ず入力してください。', 'tel1' => 'TELは必須入力項目です。必ず入力してください。', 'post1' => '郵便番号は必須入力項目です。必ず入力してください。', 'area' => '都道府県は必須入力項目です。必ず入力してください。', 'address1' => '市町村区・町名は必須入力項目です。必ず入力してください。', 'address2' => '地名・番地・建物名は必須入力項目です。必ず入力してください。', 'email1' => 'E-mailは必須入力項目です。必ず入力してください。', 'age' => '年齢は必須入力項目です。必ず入力してください。', 'job' => 'ご職業は必須入力項目です。必ず入力してください。')); //check max length $I->fillField('name1', INPUT_LENGTH_50 . '𪚲'); //length 51 $I->fillField('name2', INPUT_LENGTH_50 . '𪚲'); //length 51 $I->fillField('kana1', INPUT_LENGTH_50 . '𪚲'); //length 51 $I->fillField('kana2', INPUT_LENGTH_50 . '𪚲'); //length 51 $I->fillField('tel1', '12456-545-4564'); //length 14 $I->fillField('post1', '98765-432-4321'); //length 14 $I->selectOption('area', '青森県'); $I->fillField('address1', INPUT_LENGTH_50 . '𪚲'); //length 51