public function memberCanClaimBox(FunctionalTester $I) { $I->am('a member'); $I->wantTo('make sure I can claim a box'); //Load and login a known member $user = User::find(1); $I->amLoggedAs($user); //Create a box payment $I->haveInDatabase('payments', ['user_id' => $user->id, 'reason' => 'storage-box', 'source' => 'other', 'amount' => 5.0, 'status' => 'paid']); //$user->storage_box_payment_id = $paymentId; //$user->save(); $I->amOnPage('/storage_boxes'); //Make sure it has seen our payment $I->see("Total Paid £5"); //Claim a box $I->see('Claim'); $I->click('Claim'); //We should end up back on the page $I->canSeeCurrentUrlEquals('/storage_boxes'); //The page should now have our name next to the claimed box $I->see($user->name); //The box should be ours $I->seeInDatabase('storage_boxes', ['user_id' => $user->id]); //Add another payment $I->haveInDatabase('payments', ['user_id' => $user->id, 'reason' => 'storage-box', 'source' => 'other', 'amount' => 10.0, 'status' => 'paid']); $I->amOnPage('/storage_boxes'); //Make sure it has seen our new payment $I->see("Total Paid £15"); //We should now be able to claim another box $I->see('Claim'); $I->click('Claim'); }
public function guestCantVisitSomeonesBalancePage(FunctionalTester $I) { $I->am('a guest'); $I->wantTo('make sure I can\'t view a balance page'); //I can see the menu item $I->amOnPage('/account/1/balance'); $I->canSeeCurrentUrlEquals('/login'); }
public function guestCantVisitRolesPage(FunctionalTester $I) { $I->am('a guest'); $I->wantTo('make sure I can\'t view the roles page'); //I can see the menu item $I->amOnPage('/roles'); $I->canSeeCurrentUrlEquals('/login'); }
public function nonMemberCantViewExpenses(FunctionalTester $I) { $I->am('a guest'); $I->wantTo('make sure I cant view the list of expenses'); //Create a proposal that's currently open $I->haveInDatabase('expenses', ['id' => 1, 'category' => 'consumables', 'description' => 'Sample Description', 'user_id' => '3', 'amount' => 1234, 'expense_date' => Carbon::now()]); $I->amOnPage('/expenses'); $I->canSeeCurrentUrlEquals('/login'); }
public function adminCanEditUnstartedProposal(FunctionalTester $I) { $I->am('an admin'); $I->wantTo('make sure I can edit a proposal that hasnt been started'); //Create a proposal that's currently open $startDate = Carbon::now()->addDays(1)->format('Y-m-d'); $endDate = Carbon::now()->addDays(5)->format('Y-m-d'); $I->haveInDatabase('proposals', ['id' => 2, 'title' => 'Proposal 2', 'description' => 'Demo Description', 'user_id' => '3', 'start_date' => $startDate, 'end_date' => $endDate]); //Load and login a known member $user = User::find(3); Auth::login($user); $I->amOnPage('/proposals/2'); //I can visit the edit page $I->click('Edit Proposal'); $I->canSeeCurrentUrlEquals('/proposals/2/edit'); $I->click('Update'); $I->canSeeCurrentUrlEquals('/proposals'); }
<?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 Laracasts\TestDummy\Factory; $I = new FunctionalTester($scenario); $I->am('talent4startups member'); $I->wantTo('login to my talent4startups account'); $user = Factory::create('App\\Models\\User', ['password' => 'password']); $I->amOnPage('/'); $I->click('#login-link'); $I->canSeeCurrentUrlEquals('/auth/login'); $I->submitForm('form', ['email' => $user->email, 'password' => '']); $I->dontSeeAuthentication(); $I->submitForm('form', ['email' => $user->email, 'password' => 'wrong_password']); $I->dontSeeAuthentication(); $I->submitForm('form', ['email' => $user->email, 'password' => 'password']); $I->amLoggedAs($user);
<?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); //setup $I->am('a user'); $I->wantTo('logout from my account'); $I->amAuthenticatedWithCredentials(); $I->canSeeAuthentication(); //action $I->amOnPage('/logout'); //verify $I->canSeeCurrentUrlEquals(''); $I->cantSeeAuthentication();
<?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');