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');
         })
     );
     */
 }
Ejemplo n.º 2
0
 /**
  * @param FunctionalTester $I
  *
  * @actor FunctionalTester
  *
  * @return void
  */
 public function viewIssues(FunctionalTester $I)
 {
     $I->am('Manager User');
     $I->expectTo('view issues in all projects');
     $user = $I->createUser(1, 3);
     $admin = $I->createUser(2, 4);
     $project1 = $I->createProject(1);
     $project2 = $I->createProject(2, [$user]);
     $issue1 = $I->createIssue(1, $admin, null, $project1);
     $issue2 = $I->createIssue(2, $admin, null, $project2);
     $comment1 = $I->createComment(1, $admin, $issue2);
     $I->amLoggedAs($user);
     $I->amOnAction('HomeController@getIndex');
     $I->see($project2->name, '#sidebar .project');
     $I->dontSee($project1->name, '#sidebar .project');
     $I->click($project2->name);
     $I->seeCurrentActionIs('ProjectController@getIndex', ['project' => $project2]);
     $I->seeLink($issue2->title);
     $I->dontSeeLink($issue1->title);
     $I->click($issue2->title);
     $I->seeCurrentActionIs('Project\\IssueController@getIndex', ['project' => $project2, 'issue' => $issue2]);
     $I->see($comment1->comment, '#comment' . $comment1->id . ' .content');
     $I->amOnAction('Project\\IssueController@getNew', ['project' => $project1]);
     $I->seeResponseCodeIs(200);
     $I->click(trans('tinyissue.projects'));
     $I->see($project1->name);
     $I->see($project2->name);
 }
Ejemplo n.º 3
0
 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!');
 }
Ejemplo n.º 4
0
 /**
  * @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);
 }
Ejemplo n.º 5
0
 /**
  * @param FunctionalTester $I
  */
 public function seeContact(FunctionalTester $I)
 {
     $I->wantToTest('if I can see the contact form as anonymous user');
     $I->amOnPage('/');
     $I->click(['link' => 'Contact']);
     $I->see('ContactForm');
 }
 public function checkCorrectChangePassword(FunctionalTester $I)
 {
     $I->submitForm('#login-form', $this->loginFormParams('*****@*****.**', '123123'));
     $I->click('My Account');
     $I->submitForm('#change-password-form', $this->resetPasswordFormParams('123456', '123456'));
     $I->see('Password has been updated.');
 }
 private function complete_reset_password_email_form(FunctionalTester $I)
 {
     // fill & submit password reset email form
     $I->amOnPage('/password/reset');
     $I->fillField('email', self::EMAIL);
     $I->click(['class' => 'btn-email-password-reset']);
 }
 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();
 }
Ejemplo n.º 9
0
 /**
  * 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');
 }
 /**
  * @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 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('/');
 }
Ejemplo n.º 12
0
 /**
  * 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');
 }
Ejemplo n.º 13
0
 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.');
 }
Ejemplo n.º 14
0
 /**
  * @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();
 }
Ejemplo n.º 15
0
 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();
 }
Ejemplo n.º 16
0
 public function deleteADiscussion(FunctionalTester $I, UserSteps $userSteps)
 {
     $userId = $userSteps->amRegularUser();
     $catId = $userSteps->haveCategory(['name' => 'Some Category', 'slug' => 'some-category', 'description' => 'A description of the category']);
     $postId = $userSteps->havePost(['title' => 'Is there a way to validate only some fields?', 'content' => 'as I see, only the form itself can be validated. It validates if all fields passes, right?' . ' Well, this time I have to validate 3 fields - but those fields what passes, should go inside database.' . ' With the original schema, I cant do that', 'users_id' => $userId, 'slug' => 'is-there-a-way-to-validate-only-some-fields', 'categories_id' => $catId]);
     $I->amOnPage("/discussion/{$postId}/is-there-a-way-to-validate-only-some-fields");
     $I->seeInTitle('Is there a way to validate only some fields? - Discussion - Phalcon Framework');
     $I->seeElement(['css' => 'a.btn-delete-post']);
     $I->click(['css' => 'a.btn-delete-post']);
     $I->see('Discussion was successfully deleted', '//body/div[1]/div/div/div');
 }
Ejemplo n.º 17
0
 public function deleteADiscussion(FunctionalTester $I, UserSteps $userSteps)
 {
     $userId = $userSteps->amRegularUser();
     $catId = $userSteps->haveCategory();
     $postId = $userSteps->havePost(['title' => 'Is there a way to validate only some fields?', 'users_id' => $userId, 'categories_id' => $catId]);
     $I->amOnPage("/discussion/{$postId}/abc");
     $I->seeInTitle('Is there a way to validate only some fields? - Discussion');
     $I->seeElement(['css' => 'a.btn-delete-post']);
     $I->click(['css' => 'a.btn-delete-post']);
     $I->see('Discussion was successfully deleted', '//body/div[1]/div/div/div');
 }
 public function teamMemberCanEditLog(FunctionalTester $I)
 {
     $I->am('a laser team member');
     $I->wantTo('make sure I can edit laser logs');
     //Load and login a known admin member
     $user = $I->loginLaserTeamMember();
     $otherUser = User::find(1);
     $I->amOnPage('/equipment/laser');
     $I->see($otherUser->name);
     $I->selectOption('form[name=equipmentLog] select[name=reason]', 'testing');
     $I->click('Update');
 }
Ejemplo n.º 19
0
 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 generateStars(FunctionalTester $I)
 {
     $I->amOnPage('/admin/star');
     $I->see('Star administration');
     $star_count_before = $I->grabTextFrom('~<li>Star count: (\\d+)</li>~');
     $star_link_count_before = $I->grabTextFrom('~<li>Star link count: (\\d+)</li>~');
     $I->click('Generate new galaxy.');
     $star_count_after = $I->grabTextFrom('~<li>Star count: (\\d+)</li>~');
     $star_link_count_after = $I->grabTextFrom('~<li>Star link count: (\\d+)</li>~');
     $I->assertGreaterThan($star_count_before, $star_count_after);
     $I->assertGreaterThan($star_link_count_before, $star_link_count_after);
 }
Ejemplo n.º 21
0
 public function checkAdminPanel(FunctionalTester $I)
 {
     $I->submitForm($this->formId, $this->formParams('*****@*****.**', '123123'));
     $I->see('Logout (admin)', 'form button[type=submit]');
     $I->seeLink('Administration');
     $I->click('Administration');
     $I->see('Users');
     $I->seeLink('CMS');
     $I->seeLink('RBAC');
     $I->seeLink('Settings Storage');
     $I->seeLink('Cron Schedule Log');
 }
Ejemplo n.º 22
0
 /**
  * @param FunctionalTester $I
  *
  * @actor FunctionalTester
  *
  * @return void
  */
 public function cantEditClosedIssue(FunctionalTester $I)
 {
     $I->am('Admin User');
     $I->wantTo('not be able to edit closed issue');
     $admin = $I->createUser(1, 4);
     $developer1 = $I->createUser(2, 2);
     // developer
     $I->amLoggedAs($admin);
     $project = $I->createProject(1, [$developer1]);
     $issue = $I->createIssue(1, $admin, $developer1, $project);
     $I->amOnAction('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]);
     $I->click('Issue 1', '.edit-issue');
     $I->seeCurrentActionIs('Project\\IssueController@getEdit', ['project' => $project, 'issue' => $issue]);
     $I->amOnAction('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]);
     $I->click(trans('tinyissue.close_issue'), '.close-issue');
     $I->seeLink(trans('tinyissue.reopen_issue'));
     $I->click('Issue 1', '.edit-issue');
     $I->seeResponseCodeIs(200);
     $I->seeCurrentActionIs('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]);
     $I->see(trans('tinyissue.cant_edit_closed_issue'));
 }
Ejemplo n.º 23
0
 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');
 }
Ejemplo n.º 24
0
 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');
 }
Ejemplo n.º 25
0
 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]);
 }
Ejemplo n.º 26
0
 /**
  * @param FunctionalTester $I
  *
  * @actor FunctionalTester
  *
  * @return void
  */
 public function deleteProject(FunctionalTester $I)
 {
     $I->am('Admin User');
     $I->wantTo('delete an existing project details');
     $project = $I->createProject(1);
     $admin = $I->createUser(1, 4);
     $I->amLoggedAs($admin);
     $I->amOnAction('ProjectController@getEdit', ['project' => $project]);
     $I->click(trans('tinyissue.delete_something', ['name' => $project->name]));
     $I->seeCurrentActionIs('ProjectsController@getIndex');
     $I->dontSeeLink('Project 1');
     $I->amOnAction('ProjectsController@getIndex', ['status' => Project::STATUS_ARCHIVED]);
     $I->dontSeeLink('Project 1');
     $I->dontSeeRecord($project->getTable(), ['name' => 'Project 1']);
 }
Ejemplo n.º 27
0
 /**
  * @param FunctionalTester $I
  *
  * @actor FunctionalTester
  *
  * @return void
  */
 public function updateTag(FunctionalTester $I)
 {
     $I->am('Admin User');
     $I->wantTo('edit an existing tag');
     $tag = (new Tag())->where('group', '=', false)->get()->random(1);
     $data = ['name' => 'tag updated'];
     $tagName = $tag->name;
     $I->amLoggedAs($I->createUser(1, 4));
     $I->amOnAction('Administration\\TagsController@getIndex');
     $I->click($this->_editTagSelector($tagName));
     $I->seeCurrentActionIs('Administration\\TagsController@getEdit', ['tag' => $tag]);
     $I->submitForm('form', $data);
     $I->amOnAction('Administration\\TagsController@getIndex');
     $I->see($data['name'], $this->_editTagSelector($data['name']));
     $I->dontSee($data['name'], $this->_editTagSelector($tagName));
 }
Ejemplo n.º 28
0
 /**
  * @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 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');
 }
Ejemplo n.º 30
0
 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');
 }