private function fill_in_form(FunctionalTester $I) { $I->fillField('name', self::NAME); $I->fillField('email', self::EMAIL); $I->fillField('password', self::PASSWORD); $I->fillField('password_confirmation', self::PASSWORD); }
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'); }) ); */ }
/** * @param FunctionalTester $I * * @actor FunctionalTester * * @return void */ public function updateIssue(FunctionalTester $I) { $I->am('Admin User'); $I->wantTo('edit an existing project issue details'); $admin = $I->createUser(1, 4); $developer1 = $I->createUser(2, 2); // developer $I->amLoggedAs($admin); $project = $I->createProject(1, [$developer1]); $I->amOnAction('Project\\IssueController@getNew', ['project' => $project]); $issue = $I->createIssue(1, $admin, $developer1, $project); $I->amOnAction('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]); $I->seeLink('Issue 1'); $I->dontSee(\Html::duration($issue->time_quote), '.issue-quote'); $I->click('Issue 1', '.edit-issue'); $I->seeCurrentActionIs('Project\\IssueController@getEdit', ['project' => $project, 'issue' => $issue]); $newTitle = 'Issue 1 update'; $newTime = 3700; $I->fillField('title', $newTitle); $I->fillField('time_quote[h]', 1); $I->fillField('time_quote[s]', 100); $I->fillField('tag', 'type:tag1'); $I->click(trans('tinyissue.update_issue')); $I->seeResponseCodeIs(200); $I->seeCurrentActionIs('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]); $I->seeLink($newTitle); $I->see(\Html::duration($newTime), '.issue-quote'); $I->see('type', '.issue-tag'); $I->see('tag1', '.issue-tag'); }
/** * Define custom actions here */ function checkIfLogin(\FunctionalTester $I) { //if ($I->loadSessionSnapshot('login')) return; $I->amOnPage('/login'); $I->fillField(['name' => 'email'], Fixtures::get('username')); $I->fillField(['name' => 'password'], Fixtures::get('password')); $I->click('#loginButton'); //$I->saveSessionSnapshot('login'); }
public function loginFailsWhenPasswordIncorrect(FunctionalTester $I) { $I->amOnPage('/auth/login'); $I->see('Login'); $I->fillField('email', '*****@*****.**'); $I->fillField('password', 'incorrect'); $I->click('Login'); $I->seeCurrentUrlEquals('/auth/login'); $I->dontSeeAuthentication(); $I->see('These credentials do not match our records.'); }
/** * @param FunctionalTester $I * * @return void */ public function invalidUsernamePassword(FunctionalTester $I) { $I->wantTo('login with invalid username/password'); $I->amOnAction('HomeController@getIndex'); $I->dontSeeAuthentication(); $I->see('Login'); $I->fillField('Email', '*****@*****.**'); $I->fillField('Password', '1234'); $I->click('Login'); $I->dontSeeAuthentication(); }
public function testRegisterSuccsess(FunctionalTester $I) { $I->wantTo('register a user'); $I->amOnPage('/register'); $I->fillField('name', 'JohnDoe'); $I->fillField('email', '*****@*****.**'); $I->fillField('password', 'admin'); $I->fillField('password_confirmation', 'admin'); $I->click('Continue'); $I->amOnPage('/'); }
/** * @param \FunctionalTester $I */ protected function authAsAdmin(\FunctionalTester $I) { $I->amOnPage(AuthorizationPage::$LOGOUT_URL); $I->amOnPage(AuthorizationPage::$LOGIN_URL); $I->fillField(AuthorizationPage::$USERNAME_FIELD, AuthorizationPage::$USERNAME); $I->fillField(AuthorizationPage::$PASSWORD_FIELD, AuthorizationPage::$PASSWORD); $I->click(AuthorizationPage::$SUBMIT_BUTTON); $I->expect(AuthorizationPage::$EXPECT_SUCCESS_LOGIN); $I->amOnPage(AuthorizationPage::$DASHBOARD_URL); $I->see(AuthorizationPage::$SEE_ELEMENT_ON_DASHBOARD); }
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(); }
/** * Submit the project create/update form. * @param \AcceptanceTester|\FunctionalTester $I * @param array $fields */ public static function submit($I, $fields) { if ($fields['image']) { $I->attachFile('#uploadform-newimage', $fields['image']); } $I->fillField(['name' => 'Project[name]'], $fields['name']); $I->selectOption(['name' => 'Project[coordinator]'], $fields['coordinator']); $I->fillField(['name' => 'Project[status]'], $fields['status']); $I->fillField(['name' => 'UploadForm[newImageDescription][]'], $fields['imageDescription']); $I->click('#project-form button'); }
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 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 it_register_a_valide_user(FunctionalTester $I) { $name = 'joe'; $email = '*****@*****.**'; $password = '******'; $I->amOnRoute('user:register'); $I->fillField('username', $name); $I->fillField('email', $email); $I->fillField('password', $password); $I->fillField('password_confirmation', $password); $I->click(Lang::get('form.register')); //$I->seePageIs(route('home')); //$I->seeInDatabase('users', ['username' => $name, 'email' => $email]); }
/** * @param FunctionalTester $I * * @actor FunctionalTester * * @return void */ public function updateEmail(FunctionalTester $I) { $I->am('Normal User'); $I->wantTo('update my email'); $I->lookForwardTo('be able to change my email'); $user = $I->createUser(1); $I->amLoggedAs($user); $I->amOnAction('UserController@getSettings'); $I->fillField('email', 'email'); $I->click(trans('tinyissue.update')); $I->seeFormHasErrors(); $I->fillField('email', '*****@*****.**'); $I->click(trans('tinyissue.update')); $I->seeInField('email', '*****@*****.**'); }
public function editAProfile(FunctionalTester $I, UserSteps $userSteps) { $userSteps->loginAsFirstUser(); $I->click('Profile'); $I->dontSeeInFormFields('#profileForm', ['name' => 'John Doe']); $I->fillField('name', 'John Doe'); $I->click('Update'); $I->click('Log Out'); $I->see('Goodbye John Doe!'); }
/** * @param FunctionalTester $I * * @actor FunctionalTester * * @return void */ public function updateUser(FunctionalTester $I) { $I->am('Admin User'); $I->wantTo('edit an existing user details'); $admin = $I->createUser(1, 4); $user = $I->createUser(2, 1); $I->amLoggedAs($admin); $I->amOnAction('Administration\\UsersController@getIndex'); $I->click("//a[contains(.,'" . $user->fullname . "')]"); $I->fillField('firstname', 'user1-update'); $I->click(trans('tinyissue.update')); $I->seeCurrentActionIs('Administration\\UsersController@getIndex'); $user = $I->fetchUserBy('id', $user->id); $I->see($user->fullname); }
/** * @param FunctionalTester $I * * @actor FunctionalTester * * @return void */ public function addComment(FunctionalTester $I) { $I->am('Developer User'); $I->wantTo('add new comment to an issue'); $admin = $I->createUser(2, 4); $I->amLoggedAs($admin); $project = $I->createProject(1, [$admin]); $issue = $I->createIssue(1, $admin, $admin, $project); $I->amOnAction('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]); $I->fillField('comment', 'Comment one'); $I->click(trans('tinyissue.comment')); $I->seeResponseCodeIs(200); $comment = $issue->comments->last(); $I->seeCurrentActionIs('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue->id . '#comment' . $comment->id]); $I->see('Comment one', '.comment .content'); }
public function testSpamRegistration(FunctionalTester $I) { $I->fillField('name', $this->tester['name']); $I->fillField('email', $this->tester['email']); $I->fillField('password', $this->tester['password']); $I->fillField('password_confirmation', $this->tester['password']); $I->fillField('agreement', 'yes'); $I->click('Register', 'button'); $I->dontSeeFormErrors(); $I->click('Logout'); $I->click('Login'); $I->fillField('email', $this->tester['email']); $I->fillField('password', $this->tester['password']); $I->click('Login', 'button'); $I->seeFormHasErrors(); $I->dontSeeAuthentication(); }
public function createATicketSuccessfully(FunctionalTester $I) { $I->amLoggedAs(User::where('email', '*****@*****.**')->first()); $I->seeAuthentication(); $I->amOnPage('/ticket/create'); $I->see('Create Ticket', 'h1'); $I->fillField('customer_name', 'Evie Martell'); $I->fillField('customer_address', 'Luton, LU1 9AB'); $I->fillField('customer_tel', '07710999888'); $I->fillField('customer_email', '*****@*****.**'); $I->selectOption('select[name=type]', 'Fault'); $I->selectOption('select[name=category_id]', '1'); $I->fillField('post_serial', '2997'); $I->fillField('description', 'Testing the post fault'); $I->seeAuthentication(); $I->click('Create'); $I->see('Ticket created'); }
<?php $I = new FunctionalTester($scenario); //setup $I->am('a guest'); $I->wantTo('register an account'); //action $I->amOnPage('/register'); $I->see('Inscription'); $I->fillField(['name' => 'firstname'], 'John'); $I->fillField(['name' => 'lastname'], 'Doe'); $I->fillField(['name' => 'email'], '*****@*****.**'); $I->fillField(['name' => 'password'], 'password'); $I->fillField(['name' => 'password_confirmation'], 'password'); $I->click('submit-register'); //verify $I->canSeeAuthentication(); $I->seeRecord('users', array('email' => '*****@*****.**'));
<?php /** * ------------------------------------ * Notify user being "@" * ------------------------------------ */ $I = new FunctionalTester($scenario); Route::enableFilters(); $I->wantTo('Notify a User when he/she is being AT on a newly Reply'); $SuperMan = $I->have('User', ['name' => 'SuperMan']); $user = $I->signIn(); $topic = $I->postATopic(['title' => 'My Awsome Topic.', 'user_id' => $user->id]); // another user leave a reply $randomUser = $I->signIn(); $I->amOnRoute('topics.show', $topic->id); $I->fillField(['name' => 'body'], 'The Awsome Reply. @SuperMan'); $I->click('#reply-create-submit'); $I->see('The Awsome Reply. <a href="' . route('users.show', $SuperMan->id) . '">@SuperMan</a>'); // sign in the author $user = $I->signIn($SuperMan); $I->seeRecord('users', ['id' => $user->id, 'notification_count' => 1]); $I->amOnRoute('notifications.index'); $I->see('My Awsome Topic.'); $I->see('The Awsome Reply. <a href="' . route('users.show', $SuperMan->id) . '">@SuperMan</a>'); $I->see($randomUser->name); $I->seeRecord('users', ['id' => $user->id, 'notification_count' => 0]);
<?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 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('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 guest'); $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(['class' => 'submitbutton']); $I->seeCurrentUrlEquals(''); $I->see('Welcome to Larabook!'); $I->seeRecord('users', ['username' => 'JohnDoe', 'email' => '*****@*****.**']); $I->assertTrue(Auth::check());
<?php $I = new FunctionalTester($scenario); // Prep $sentry = $I->grabService('sentry'); $user = $sentry->findUserByLogin('*****@*****.**'); $group = $sentry->findGroupByName('Users'); // Test $I->amActingAs('*****@*****.**'); $I->wantTo('edit a group name'); $I->amOnPage('/groups/' . $group->id . '/edit'); $I->seeElement('input', ['class' => 'form-control', 'name' => 'name']); $I->fillField('name', 'Prozorovs'); $I->click('Save Changes'); $I->seeRecord('groups', ['name' => 'Prozorovs', 'id' => $group->id]);
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 . '𪚲'); //length 51 $I->fillField('address2', INPUT_LENGTH_50 . '𪚲');
<?php $I = new FunctionalTester($scenario); $I->am('a member'); $I->wantTo('view my profile.'); // setup $I->signIn(); $I->amOnPage('statuses'); // action $I->fillField('body', 'walla yalla'); $I->click(Lang::get('status.Send')); $I->click(Lang::get('account.Your Profile')); // watching if status actually is posted to my wall $I->seeCurrentUrlEquals('/@Foobar'); $I->see('walla yalla');
<?php use schmunk42\giiant\tests\_pages\LoginPage; $I = new FunctionalTester($scenario); $I->wantTo('ensure that crud works with access rules'); $I->amOnPage('/crud/actor'); $I->dontSee('Actor', 'h2'); $I->see('Sign in', 'h3'); $I->amGoingTo('try to login with correct credentials'); // TODO: use LoginPage class $username = '******'; $password = '******'; $I->fillField('input[name="login-form[login]"]', $username); $I->fillField('input[name="login-form[password]"]', $password); $I->click('Sign in'); $I->see('Actor', 'h2');
<?php $I = new FunctionalTester($scenario); $I->wantTo('register a user'); $I->amOnPage('/auth/register'); $I->fillField('name', 'John Doe'); $I->fillField('email', '*****@*****.**'); $I->fillField('password', 'password'); $I->fillField('password_confirmation', 'password'); $I->click('button[type=submit]'); $I->amOnPage('/'); $I->seeRecord('users', ['email' => '*****@*****.**']); $I->seeAuthentication();