/** * @param FunctionalTester $I * * @actor FunctionalTester * * @return void */ public function viewIssues(FunctionalTester $I) { $I->am('Developer User'); $I->expectTo('view issues in projects I am one of the users'); $user = $I->createUser(1, 2); $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(401); $I->amOnAction('UserController@getIssues'); $I->dontSeeLink($issue2->title); $I->dontSeeLink($issue1->title); }
/** * @param FunctionalTester $I * * @actor FunctionalTester * * @return void */ public function addIssueComment(FunctionalTester $I) { $comment = 'Comment 1'; $fileName1 = 'upload1.txt'; $fileName2 = 'upload2.txt'; $I->am('Manager User'); $I->wantTo('add new comment to a project issue with attachments'); $manager = $I->createUser(1, 3); $I->amLoggedAs($manager); $issue = $I->createIssue(1, $manager); $project = $issue->project; $I->amOnAction('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]); $I->seeResponseCodeIs(200); $uri = $I->getApplication()->url->action('Project\\IssueController@postUploadAttachment', ['project' => $project]); $I->submitFormWithFileToUri('.new-comment form', $uri, ['upload' => [$fileName1, $fileName2]], ['comment' => $comment]); $I->seeResponseCodeIs(200); $I->amOnAction('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]); $I->seeCurrentActionIs('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]); $I->see($comment, '.comment .content'); $I->seeLink($fileName1); $I->seeLink($fileName2); $I->see($fileName1, '.attachments'); $I->see($fileName2, '.attachments'); $attachments = $issue->comments->first()->attachments; foreach ($attachments as $attachment) { $I->amOnAction('Project\\IssueController@getDisplayAttachment', ['project' => $project, 'issue' => $issue, 'attachment' => $attachment]); $I->seeResponseCodeIs(200); } }
/** * @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'); }
public function seeLinksList(FunctionalTester $I) { $I->haveRecord('links', $this->linkRecord); $I->amOnPage(LinksPage::$URL); $I->see('Links'); $I->see('/' . $this->link['uri']); $I->see($this->link['description']); }
public function it_validates_required_fields(FunctionalTester $I) { //For coverage $I->amOnRoute(RegisterPage::$ROUTE); $I->submitForm(RegisterPage::$formId, [], 'Register'); $I->see('The username field is required.'); $I->see('The email field is required.'); $I->see('The password field is required.'); $I->dontSee('The name field is required.'); }
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 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 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'); }
public function submitFormSuccessfully(\FunctionalTester $I) { $I->submitForm('#contact-form', ['ContactForm[name]' => 'tester', 'ContactForm[email]' => '*****@*****.**', 'ContactForm[subject]' => 'test subject', 'ContactForm[body]' => 'test content', 'ContactForm[verifyCode]' => 'testme']); $I->seeEmailIsSent(); $I->dontSeeElement('#contact-form'); $I->see('Thank you for contacting us. We will respond to you as soon as possible.'); }
public function checkValidLogin(FunctionalTester $I) { $I->submitForm('#login-form', $this->formParams('*****@*****.**', '123123')); $I->see('Logout (admin)', 'form button[type=submit]'); $I->dontSeeLink('Login'); $I->dontSeeLink('Signup'); }
public function getInternalErrorIfAssetsNotDumped(FunctionalTester $I) { $I->bootKernelWith(); $I->amOnPage('/'); $I->canSeeResponseCodeIs(500); $I->see('Manifest file not found'); }
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.'); }
/** * @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 canEditMicroblog(FunctionalTester $I) { $fake = Factory::create(); $text = $fake->text(); $id = $I->haveRecord('microblogs', ['user_id' => $this->user->id, 'text' => $text, 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'score' => 0]); $I->amOnRoute('microblog.save', [$id]); $I->see($text); }
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'); }
public function createUser(FunctionalTester $I) { $I->amOnRoute('site/login'); $I->submitForm($this->loginFormId, $this->loginFormParams('*****@*****.**', '123123')); $I->amOnRoute('/admin/user/create'); $I->see('Create User'); $I->submitForm($this->createUserFormId, $this->createUserFormParams('created-user', '*****@*****.**', '123123')); $I->seeRecord('app\\models\\UserModel', ['username' => 'created-user', 'email' => '*****@*****.**']); }
public function deletePost(FunctionalTester $I) { $id = $I->haveRecord('posts', $this->postAttributes); $I->amOnPage(PostsPage::$url); $I->see('Hello Universe'); PostsPage::of($I)->deletePost($id); $I->seeCurrentUrlEquals(PostsPage::$url); $I->dontSee('Hello Universe'); }
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!'); }
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 */ 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 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); }
/** * @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 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 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'); }
/** * @param FunctionalTester $I * * @actor FunctionalTester * * @return void */ public function deleteComment(FunctionalTester $I) { $I->am('Developer User'); $I->wantTo('delete a comment from an issue'); $admin = $I->createUser(2, 4); $I->amLoggedAs($admin); $project = $I->createProject(1, [$admin]); $issue = $I->createIssue(1, $admin, $admin, $project); $comment1 = $I->createComment(1, $admin, $issue); $comment2 = $I->createComment(2, $admin, $issue); $I->amOnAction('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]); $I->see($comment1->comment, '#comment' . $comment1->id . ' .content'); $I->see($comment2->comment, '#comment' . $comment2->id . ' .content'); $uri = $I->getApplication()->url->action('Project\\IssueController@getDeleteComment', ['comment' => $comment1]); $I->sendAjaxGetRequest($uri); $I->seeResponseCodeIs(200); $I->amOnAction('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]); $I->dontSee($comment1->comment); $I->see($comment2->comment); }
/** * @depends loginSuccessfully */ public function openFregat(\FunctionalTester $I) { $I->setCookie('_identity', $this->cookie_identity); $I->setCookie('PHPSESSID', $this->cookie_session); // $I->click('Fregat/fregat/mainmenu'); $I->amOnRoute('site/index'); $I->see('Система "Фрегат"'); $I->amOnRoute('Fregat/fregat/mainmenu'); $I->see('Справочники'); /* $I->click('//div[contains(text(), "Фрегат")]'); $I->see('Журнал материальных ценностей'); $I->see('Журнал перемещений материальных ценностей'); $I->see('Журнал снятия комплектующих с материальных ценностей'); $I->see('Журнал осмотров материальных ценностей'); $I->see('Журнал осмотров материалов'); $I->see('Журнал восстановления материальных ценностей'); $I->see('Журнал списания основных средств'); $I->see('Импорт данных'); $I->see('Справочники');*/ }
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); }
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'); }
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'); }
/** * @param FunctionalTester $I * * @actor FunctionalTester * * @return void */ public function deleteUser(FunctionalTester $I) { $I->am('Admin User'); $I->wantTo('delete an existing user details'); $admin = $I->createUser(1, 4); $user = $I->createUser(2, 1); $user1 = $I->createUser(3, 2); $I->amLoggedAs($admin); $I->amOnAction('Administration\\UsersController@getDelete', ['user' => $user]); $I->seeCurrentActionIs('Administration\\UsersController@getIndex'); $I->dontSee($user->fullname); $I->see($user1->fullname); }