public function memberCanLeave(FunctionalTester $I) { $I->am('a member'); $I->wantTo('leave build brighton'); //Load and login a known member $user = User::find(1); Auth::login($user); $I->amOnPage('/account/' . $user->id . ''); $I->canSee('Active'); $I->click("Leave Build Brighton"); $I->canSee('Leaving'); }
public function memberCanVisitStoragePage(FunctionalTester $I) { $I->am('a member'); $I->wantTo('make sure I can view the member box page'); //Load and login a known member $user = User::find(1); Auth::login($user); //I can see the menu item $I->amOnPage('/storage_boxes'); $I->canSee('Member Storage Boxes'); $I->cantSee($user->name); //Make sure the message about paying for a box is displayed $I->canSee('5 deposit'); }
public function adminCanDeclineExpenses(FunctionalTester $I) { $I->am('an admin'); $I->wantTo('make sure I can decline an expense'); //Create a proposal that's currently open $I->haveInDatabase('expenses', ['id' => 4, 'category' => 'consumables', 'description' => 'Another Description', 'user_id' => '3', 'amount' => 1234, 'expense_date' => Carbon::now()]); //Load and login a known member $user = User::find(3); Auth::login($user); $I->amOnPage('/expenses'); $I->canSee('Expenses'); $I->canSee('Another Description'); $I->cantSee('Declined by'); $I->click('Decline'); $I->canSee('Declined by'); }
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'); }) ); */ }
public function adminCanVisitRolesPage(FunctionalTester $I) { $I->am('an admin'); $I->wantTo('make sure I can view the roles page'); //Load and login a known member $user = User::find(3); \Auth::login($user); //I can see the menu item $I->amOnPage('/roles'); $I->canSee('Member Roles'); }
public function memberCantSneakyVoteOnNotStartedProposal(FunctionalTester $I) { $I->am('a member'); $I->wantTo('make sure I cant sneakily vote on a proposal that hasnt started yet'); //Create a proposal starting in the future $startDate = Carbon::now()->addDay()->format('Y-m-d'); $endDate = Carbon::now()->addDays(3)->format('Y-m-d'); $I->haveInDatabase('proposals', ['id' => 4, 'title' => 'Proposal 4', 'description' => 'Demo Description', 'user_id' => '1', 'start_date' => $startDate, 'end_date' => $endDate]); //Load and login a known member $user = User::find(1); Auth::login($user); //I can see the menu item $I->amOnPage('/proposals'); $I->canSee('Proposal 4'); $I->seeExceptionThrown('BB\\Exceptions\\ValidationException', function ($I) { //Confirm that posting directly generates a validation exception $I->sendPOST('/proposals/4', ['vote' => '+1']); }); }
<?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');
<?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 use BB\Entities\User; $I = new FunctionalTester($scenario); $I->am('a member'); $I->wantTo('view the equipment training page'); //Load and login a known member $user = User::find(1); Auth::login($user); //I can see the menu item $I->amOnPage('/'); $I->canSee('Tools and Equipment'); $I->click('Tools and Equipment'); $I->canSeeCurrentUrlEquals('/equipment'); $I->seeResponseCodeIs(200);
<?php use BB\Entities\User; $I = new FunctionalTester($scenario); $I->am('a member'); $I->wantTo('view a members profile'); //Load and login a known member $user = User::find(1); Auth::login($user); //I can see the menu item $I->amOnPage('/'); $I->canSee('Members'); $I->click('Members'); $I->canSeeCurrentUrlEquals('/members'); $I->canSee('Members'); $I->click($user->name); $I->canSeeCurrentUrlEquals('/members/' . $user->id); $I->canSee($user->name);
<?php use BB\Entities\User; $I = new FunctionalTester($scenario); $I->am('a member'); $I->wantTo('view the profile edit page'); //Load and login a known member $user = User::find(1); Auth::login($user); $I->amOnPage('/account/' . $user->id); $I->seeResponseCodeIs(200); $I->canSeeCurrentUrlEquals('/account/' . $user->id); //$I->click('Edit Your Profile'); $I->canSee('Edit Your Profile'); $I->amOnPage('/account/' . $user->id . '/profile/edit'); $I->seeResponseCodeIs(200); $I->canSeeCurrentUrlEquals('/account/' . $user->id . '/profile/edit');
<?php $I = new FunctionalTester($scenario); $I->am('an admin user'); $I->wantTo('see the admin menu items'); $I->loginAdminMember(); $I->amOnPage('/'); $I->canSee('Manage Members');
<?php $I = new FunctionalTester($scenario); $I->am('a guest'); $I->wantTo('try and fail to view the stats page'); //I can see the menu item $I->amOnPage('/'); $I->canSee('Stats'); //I cant access it $I->amOnPage('/stats'); $I->canSeeCurrentUrlEquals('/login');
<?php $I = new FunctionalTester($scenario); $I->wantTo('I can see laravel 5 in homepage'); $I->amOnPage('/'); $I->canSee("Laravel 5");
<?php $I = new FunctionalTester($scenario); $I->am('a Larabook member.'); $I->wantTo('login to my Larabook account'); $I->signIn(); $I->seeInCurrentUrl('/statuses'); $I->canSee('Welcome back'); $I->assertTrue(Auth::check(), 'The user is logged in');
<?php use BB\Entities\User; $I = new FunctionalTester($scenario); $I->am('a member'); $I->wantTo('view the stats page'); //Load and login a known member $user = User::find(1); Auth::login($user); //I can see the menu item $I->amOnPage('/'); $I->canSee('Stats'); //Try and go to the stats page $I->amOnPage('/stats'); $I->canSeeCurrentUrlEquals('/stats'); $I->canSee('Payment Methods');