public function submitFormWithIncorrectEmail(FunctionalTester $I) { $I->submitForm('#contact-form', ['ContactForm[name]' => 'tester', 'ContactForm[email]' => 'tester.email', 'ContactForm[subject]' => 'test subject', 'ContactForm[body]' => 'test content', 'ContactForm[verifyCode]' => 'testme']); $I->expectTo('see that email address is wrong'); $I->dontSee('Name cannot be blank', '.help-inline'); $I->see('Email is not a valid email address.'); $I->dontSee('Subject cannot be blank', '.help-inline'); $I->dontSee('Body cannot be blank', '.help-inline'); $I->dontSee('The verification code is incorrect', '.help-inline'); }
public function checkUserRedirectedToLoginWhenNotAuthd(FunctionalTester $I) { $I->dontSeeAuthentication(); $I->amOnPage('/dashboard'); $I->dontSee('You are now logged in'); $I->seeCurrentUrlEquals('/auth/login'); }
/** * @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); }
/** * @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 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.'); }
/** * @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); }
public function getNoErrorIfAssetsAreDumped(FunctionalTester $I) { $I->bootKernelWith('customized'); $I->runCommand('maba_webpack.command.setup'); $I->seeFileFound(__DIR__ . '/Fixtures/package.json'); $I->seeFileFound(__DIR__ . '/Fixtures/app/config/webpack.config.js'); $I->runCommand('maba_webpack.command.compile'); $I->seeCommandStatusCode(0); $I->seeInCommandDisplay('webpack'); $I->dontSeeInCommandDisplay('error'); $I->amOnPage('/customized'); $I->canSeeResponseCodeIs(200); $I->dontSee('Manifest file not found'); $I->seeInSource('<link rel="stylesheet" id="css1" href="/assets/'); $href = $I->grabAttributeFrom('link#css1', 'href'); preg_match('#/assets/(.*)#', $href, $matches); $I->seeFileFound(__DIR__ . '/Fixtures/web/assets/' . $matches[1]); $I->openFile(__DIR__ . '/Fixtures/web/assets/' . $matches[1]); $I->canSeeInThisFile('.green'); $I->canSeeInThisFile('.red'); $I->canSeeInThisFile('-ms-fullscreen a.css'); $I->amGoingTo('Check if less file was compiled'); $I->canSeeInThisFile('color: #123456'); $I->canSeeInThisFile('-ms-fullscreen a.less'); $I->amGoingTo('Check if sass file was compiled'); $I->canSeeInThisFile('color: #654321'); $I->canSeeInThisFile('-ms-fullscreen a.scss'); $I->amGoingTo('Check if cat.png was included'); $I->canSeeInThisFile('background: url(/assets/'); $I->seeInSource('<link rel="stylesheet" id="css2" href="/assets/'); $href = $I->grabAttributeFrom('link#css2', 'href'); preg_match('#/assets/(.*)#', $href, $matches); $I->seeFileFound(__DIR__ . '/Fixtures/web/assets/' . $matches[1]); $I->openFile(__DIR__ . '/Fixtures/web/assets/' . $matches[1]); $I->canSeeInThisFile('color: #123456'); $I->seeInSource('<script src="/assets/'); $src = $I->grabAttributeFrom('script', 'src'); preg_match('#/assets/(.*)#', $src, $matches); $I->seeFileFound(__DIR__ . '/Fixtures/web/assets/' . $matches[1]); $I->openFile(__DIR__ . '/Fixtures/web/assets/' . $matches[1]); $I->canSeeInThisFile('additional-asset-content'); $I->canSeeInThisFile('additional asset B'); $I->canSeeInThisFile('app-asset-content'); $I->dontSeeInThisFile('featureA-content'); $I->dontSeeInThisFile('featureB-content'); $I->seeInSource('<img src="/assets/'); $src = $I->grabAttributeFrom('img', 'src'); preg_match('#/assets/(.*)#', $src, $matches); $I->seeFileFound(__DIR__ . '/Fixtures/web/assets/' . $matches[1]); $I->seeFileIsSmallerThan(__DIR__ . '/Fixtures/web/assets/' . $matches[1], __DIR__ . '/Fixtures/src/Resources/assets/cat.png'); }
/** * @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)); }
/** * @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); }
public function getNoErrorIfAssetsAreDumped(FunctionalTester $I) { $I->bootKernelWith(); $I->runCommand('maba_webpack.command.setup'); $I->seeFileFound(__DIR__ . '/Fixtures/package.json'); $I->seeFileFound(__DIR__ . '/Fixtures/app/config/webpack.config.js'); $I->runCommand('maba_webpack.command.compile'); $I->seeCommandStatusCode(0); $I->seeInCommandDisplay('webpack'); $I->dontSeeInCommandDisplay('error'); $I->amOnPage('/'); $I->canSeeResponseCodeIs(200); $I->dontSee('Manifest file not found'); $I->dontSeeInSource('<link rel="stylesheet"'); $I->seeInSource('<script src="http://localhost:8080/compiled/'); $src = $I->grabAttributeFrom('script', 'src'); preg_match('#http://localhost:8080/compiled/(.*)#', $src, $matches); $I->seeFileFound(__DIR__ . '/Fixtures/web/compiled/' . $matches[1]); $I->openFile(__DIR__ . '/Fixtures/web/compiled/' . $matches[1]); $I->canSeeInThisFile('.green'); $I->canSeeInThisFile('.red'); }
public function issueFilterUrl(FunctionalTester $I) { $I->am('Normal User'); $I->wantTo('view an issue with a content containing another issue number.'); $I->expectTo('see link in the issue number.'); $I->lookForwardTo('be redirected to the another issue.'); $developer1 = $I->createUser(1, 2); // developer $user1 = $I->createUser(2, 1); // user $project = $I->createProject(1, [$developer1, $user1]); $issue1 = $I->createIssue(1, $developer1, null, $project); $issue2 = $I->createIssue(2, $developer1, null, $project); $issue1->body = 'See issue #' . $issue2->id; $issue1->save(); $I->amLoggedAs($user1); $I->amOnAction('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue1]); $I->seeLink('issue #' . $issue2->id); $I->click('issue #' . $issue2->id); $I->seeResponseCodeIs(200); $I->see($issue2->title); $I->dontSee($issue1->title); }
public function getNoErrorIfAssetsAreDumped(FunctionalTester $I) { $I->bootKernelWith('tags'); $I->runCommand('maba_webpack.command.setup'); $I->seeFileFound(__DIR__ . '/Fixtures/package.json'); $I->seeFileFound(__DIR__ . '/Fixtures/app/config/webpack.config.js'); $I->runCommand('maba_webpack.command.compile'); $I->seeCommandStatusCode(0); $I->seeInCommandDisplay('webpack'); $I->dontSeeInCommandDisplay('error'); $I->amOnPage('/tags'); $I->canSeeResponseCodeIs(200); $I->dontSee('Manifest file not found'); $I->canSeeNumberOfElements('link[rel=stylesheet]', 3); $urlList = $I->grabMultiple('link', 'href'); foreach ($urlList as $i => $url) { preg_match('#/compiled/(.*)#', $url, $matches); $I->seeFileFound(__DIR__ . '/Fixtures/web/compiled/' . $matches[1]); $I->openFile(__DIR__ . '/Fixtures/web/compiled/' . $matches[1]); $I->canSeeInThisFile('.class' . $i . ' {'); } $I->canSeeNumberOfElements('script', 2); $urlList = $I->grabMultiple('script', 'src'); foreach ($urlList as $i => $url) { preg_match('#/compiled/(.*)#', $url, $matches); $I->seeFileFound(__DIR__ . '/Fixtures/web/compiled/' . $matches[1]); $I->openFile(__DIR__ . '/Fixtures/web/compiled/' . $matches[1]); $I->canSeeInThisFile('function f' . $i . '() {'); } $I->canSeeNumberOfElements('img', 2); $urlList = $I->grabMultiple('img', 'src'); foreach ($urlList as $i => $url) { preg_match('#/compiled/(.*)#', $url, $matches); $I->seeFileFound(__DIR__ . '/Fixtures/web/compiled/' . $matches[1]); } }
$I->see('Opportunity'); # module name $I->see('Relation'); # badge for relation $I->see('show/hide', 'table#message-steps a[data-target=".step-2-errors"]'); $I->dontSeeElement('table#message-steps table.collapsed'); $I->click('Set status New'); $I->seeResponseCodeIs(200); $I->see('Message'); $I->seeLink('Back to the list'); $I->seeLink('Run message'); $I->dontSeeLink('Set status New'); $I->seeLink('Halt message'); $I->seeLink('Cancel message'); // steps with status "Error" are changed to status "Rerun": $I->dontSee('Error', 'table#message-steps td.error-status'); $I->dontSee('Completed', 'table#message-steps td.error-status'); $I->dontSee('In progress', 'table#message-steps td.error-status'); $I->see('New', 'table#message-steps td.error-status'); $I->click('Halt message'); $I->seeResponseCodeIs(200); $I->see('Message'); $I->seeLink('Back to the list'); $I->seeLink('Run message'); $I->seeLink('Set status New'); $I->dontSeeLink('Halt message'); $I->seeLink('Cancel message'); $I->click('Cancel message'); $I->seeResponseCodeIs(200); $I->see('Message'); $I->seeLink('Back to the list');
$I->see('Halt message', 'div#batch-all'); $I->see('Cancel message', 'div#batch-all'); $I->see('Reset GUIDs', 'div#batch-all'); # sending batch form with no action selected $I->submitForm('form[name="batch"]', []); $I->see('Please select batch action.', '.alert-danger'); # sending batch form with no action type selected $I->submitForm('form[name="batch"]', ['action' => 'new']); $I->see('Please select batch action type.', '.alert-danger'); # sending batch form with no Messages selected //$I->submitForm('form[name="batch"]', ['action' => 'ready', 'action_type' => 'selected']); //$I->see('Please select at least one Message.', '.alert-danger'); $I->see('New', 'table tr[class="status-new"] td'); $I->see('Cancelled', 'table tr[class="status-cancelled"] td'); $I->see('Halted', 'table tr[class="status-halted"] td'); $I->dontSee('Finished', 'table tr[class="status-halted"] td'); $I->dontSee('Error', 'table tr[class="status-halted"] td'); # sending batch form with action for all items $I->submitForm('form[name="batch"]', ['action' => 'new', 'action_type' => 'all']); $I->see('New', 'table tr[class="status-new"] td'); $I->see('Batch action executed on 1502 items.', '.alert-success'); $I->dontSee('Cancelled', 'table tr[class="status-cancelled"] td'); $I->dontSee('Halted', 'table tr[class="status-halted"] td'); $I->dontSee('Finished', 'table tr[class="status-halted"] td'); $I->dontSee('Error', 'table tr[class="status-halted"] td'); $I->see('New', 'div#status-overview td'); $I->dontSee('Halted', 'div#status-overview td'); $I->dontSee('Cancelled', 'div#status-overview td'); # sending batch form with Messages IDs and action for selected items $ids = $I->getMessageIds(5); $I->submitForm('form[name="batch"]', ['action' => 'halt', 'action_type' => 'selected', 'batch_ids' => $ids]);
<?php /* @var $scenario Codeception\Scenario */ $I = new FunctionalTester($scenario); $I->assertTrue(Yii::$app->user->isGuest); $I->wantTo('ensure that home page works'); $I->amOnPage('/'); $I->dontSee('Logout'); $I->see('Main'); $I->see('Login'); $I->click('Main'); $I->dontSee('Logout'); $I->see('Main'); $I->see('Login'); $user = \app\models\User::findByUsername('admin'); Yii::$app->user->login($user); $I->assertFalse(Yii::$app->user->isGuest); $I->amOnPage('/'); $I->see('I`m index'); $I->see('About'); $I->see('Logout'); $I->click('About'); $I->see('Information');
<?php $I = new FunctionalTester($scenario); $I->wantTo('Add a product to cart that has low stock'); $product = $I->createModel(DanPowell\Shop\Models\Product::class, [], 'inStock', 1); $I->amOnRoute('shop.product.show', $product->slug); $I->submitForm('#addToCart', ['quantity' => 15]); $I->dontSee('Product added to cart'); $I->see('not enough product stock'); $I->seeFormHasErrors();
<?php // @group mandatory use tests\codeception\_pages\LoginPage; $I = new FunctionalTester($scenario); $I->wantTo('ensure that access control UI works'); $I->amOnPage('/'); $I->dontSeeLink('/de/backend', '.nav'); $I->dontSee('', '.glyphicon.glyphicon-cog'); LoginPage::openBy($I)->login('admin', 'admin'); $I->see('', '.glyphicon.glyphicon-cog');
/** * @param \FunctionalTester $I */ protected function logout(\FunctionalTester $I) { $I->amOnPage(AuthorizationPage::$LOGOUT_URL); $I->amOnPage(AuthorizationPage::$DASHBOARD_URL); $I->dontSee(AuthorizationPage::$SEE_ELEMENT_ON_DASHBOARD); }
// Random sections // And $I->amOnPage('admin/sections'); // Then $I->seeElement('input', ['name' => 'search']); // When $I->fillField('search', 'company'); $I->selectOption('published', '1'); // And $I->click('Filter sections'); // Then $I->seeCurrentUrlEquals('/admin/sections?search=company&published=1&menu='); $I->expect('not to see the our company record'); // Then $I->see('There are no sections, please create the first one'); $I->dontSee('Our company', 'td.name'); $I->seeInField('search', 'company'); // When $I->selectOption('published', '0'); $I->selectOption('menu', '0'); // And $I->click('Filter sections'); // Then $I->see('There are no sections, please create the first one'); $I->dontSee('Our company', 'td.name'); // When $I->selectOption('menu', '1'); // And $I->click('Filter sections'); // Then $I->see('Our company', 'td.name');
<?php $I = new FunctionalTester($scenario); $I->am('a CMS admin'); $I->wantTo('paginate the sections results'); $I->amGoingTo('Go to page 1'); // When $sections = $I->haveSections(16); // And $I->amOnPage('/admin/sections'); // Then $I->see('There are 16 sections, showing page 1 of 2'); $I->expectTo('see the first section'); $I->see($sections->first()->name, 'tbody tr:first-child td.name'); $I->expect('not to see the last section'); $I->dontSee($sections->last()->name); $I->expectTo('see the page 2 link'); $I->see('2', '.pagination a'); $I->amGoingTo('go to page 2'); // When $I->click('2', '.pagination a'); // Then $I->expectTo('see the pagination parameter in the URL'); $I->seeCurrentUrlEquals('/admin/sections?page=2'); $I->expect('not to see the first section'); $I->dontSee($sections->first()->name); $I->expectTo('see the last section'); $I->see($sections->last()->name); $I->expectTo('See the section #15 as first item on page 2'); $I->see($sections->get(15)->name, 'tbody tr:first-child td.name'); $I->amGoingTo('go back to page 1');
<?php $I = new FunctionalTester($scenario); $I->am('a member'); $I->wantTo('follow other users'); // setup $I->haveAnAccount(['username' => 'AnOtherUser']); $I->signIn(); // action $I->click(Lang::get('default.navigation.Find Members')); $I->click('AnOtherUser'); // When I follow a user $I->seeCurrentUrlEquals('/@AnOtherUser'); $I->click(Lang::get('default.follow') . ' AnOtherUser'); $I->seeCurrentUrlEquals('/@AnOtherUser'); $I->see(Lang::get('default.unfollow')); $I->dontSee(Lang::get('default.follow') . ' AnOtherUser'); // When I unfollow a user $I->click(Lang::get('default.unfollow')); $I->seeCurrentUrlEquals('/@AnOtherUser'); $I->see(Lang::get('default.follow') . ' AnOtherUser');
public function access_to_the_leading_team_page(FunctionalTester $I) { $I->am('Anybody'); $I->wantTo('access to the leading team page'); $I->expectTo('see that the user shown in the category they belong'); /*************************************************************************************************************** * settings **************************************************************************************************************/ // we create a member of the student leading board $credentials = ['last_name' => 'Student', 'first_name' => 'President', 'email' => '*****@*****.**', 'status_id' => config('user.status_key.student_president'), 'board_id' => config('user.board_key.student_leading_board'), 'password' => 'test']; Sentinel::register($credentials, true); // we create a member of the student leading board $credentials = ['last_name' => 'Deactivated', 'first_name' => 'Student vice-president', 'email' => '*****@*****.**', 'status_id' => config('user.status_key.user'), 'board_id' => config('user.board_key.student_leading_board'), 'password' => 'test']; Sentinel::register($credentials); // we create a member of the leading board $credentials = ['last_name' => 'Regular', 'first_name' => 'President', 'email' => '*****@*****.**', 'status_id' => config('user.status_key.president'), 'board_id' => config('user.board_key.leading_board'), 'password' => 'test']; Sentinel::register($credentials, true); // we create a member of the executive committee $credentials = ['last_name' => 'Communication', 'first_name' => 'Responsible', 'email' => '*****@*****.**', 'status_id' => config('user.status_key.communication_commission'), 'board_id' => config('user.board_key.executive_committee'), 'password' => 'test']; Sentinel::register($credentials, true); // we create an employee $credentials = ['last_name' => 'Coach', 'first_name' => 'Employee', 'email' => '*****@*****.**', 'status_id' => config('user.status_key.employee'), 'password' => 'test']; Sentinel::register($credentials, true); /*************************************************************************************************************** * run test **************************************************************************************************************/ $I->amOnPage('/'); $I->seeCurrentRouteIs('home'); $I->click(trans('template.front.header.leading_team')); $I->see('Student', '.student_leading_board'); $I->see('President', '.student_leading_board'); $I->see(trans('users.config.status.student_president'), '.student_leading_board'); $I->dontSee('Deactivated', '.student_leading_board'); $I->dontSee('Student vice-president', '.student_leading_board'); $I->dontSee(trans('users.config.status.user'), '.student_leading_board'); $I->see('Regular', '.leading_board'); $I->see('President', '.leading_board'); $I->see(trans('users.config.status.president'), '.leading_board'); $I->see('Communication', '.executive_committee'); $I->see('Responsible', '.executive_committee'); $I->see(trans('users.config.status.communication_commission'), '.executive_committee'); $I->see('Coach', '.employee'); $I->see('Employee', '.employee'); $I->see(trans('users.config.status.employee'), '.employee'); }
/** * @param FunctionalTester $I * @param Project $project * @param array $issues1 * @param array $issues2 * * @return void */ protected function _assertExport(FunctionalTester $I, Project $project, array $issues1, array $issues2) { $I->seeResponseCodeIs(200); array_walk($issues1, function ($issue) use($I) { $I->see($issue->title); }); $I->see($project->name); array_walk($issues2, function ($issue) use($I) { $I->dontSee($issue->title); }); }
<?php $I = new FunctionalTester($scenario); $I->resetEmails(); //setup $I->am('a user'); $I->wantTo('activate my email adress'); $I->amAuthenticatedWithCredentials(); $I->canSeeAuthentication(); $I->amOnPage('/confirmation'); //action //step1 $I->click('#submit-mail-code'); //step2 $I->seeInLastEmail('*****@*****.**'); $I->seeInLastEmail('Confirmation Code'); //step3 $I->seeRecord('users_confirmations', ['user_id' => 1, 'type' => 'mail']); //step4 $code = $I->grabRecord('users_confirmations', ['user_id' => 1, 'type' => 'mail']); $I->amOnPage('/confirmation/mail/' . $code->confirmation_code); $I->dontSee('#submit-mail-code'); $I->seeRecord('users_profiles', ['user_id' => 1, 'mail_confirmed' => 1]);
/** * @param FunctionalTester $I * * @actor FunctionalTester * * @return void */ public function removeUserFromProject(FunctionalTester $I) { $I->am('Admin User'); $I->wantTo('not be able to remove user to a project'); $admin = $I->createUser(1, 4); $developer1 = $I->createUser(2, 2); // developer $I->amLoggedAs($admin); $project = $I->createProject(1, [$developer1]); $I->amOnAction('ProjectController@getIndex', ['project' => $project]); $I->see($developer1->fullname, '#project-user' . $developer1->id); $uri = $I->getApplication()->url->action('ProjectController@postUnassign', ['project' => $project]); $I->sendAjaxPostRequest($uri, ['user_id' => $developer1->id, '_token' => csrf_token()]); $I->seeResponseCodeIs(200); $I->amOnAction('ProjectController@getIndex', ['project' => $project]); $I->dontSee($developer1->fullname, '#project-user' . $developer1->id); }
<?php $I = new FunctionalTester($scenario); $I->am('HRis User'); $I->wantTo('Delete Qualifications(Work Experience). [Positive Test]'); # Authorize User $I->amOnPage('/auth/login'); $I->fillField('email', '*****@*****.**'); $I->fillField('password', 'retardko'); $I->click('Login'); # Dashboard $I->seeCurrentUrlEquals('/dashboard'); # Profile $I->click('Profile'); $I->seeCurrentUrlEquals('/profile/personal-details'); # Qualifications $I->click('Qualifications'); $I->seeCurrentUrlEquals('/profile/qualifications'); # Delete record $I->see('Tested'); $id = $I->grabAttributeFrom('button[title=Edit]', 'id'); $token = $I->grabAttributeFrom('input[name=_token]', 'value'); $I->fillField('input[name=work_experience_id]', $id); $I->sendAjaxPostRequest('/ajax/profile/qualifications/work-experience', ['id' => $id, '_token' => $token, '_method' => 'DELETE']); // POST $I->dontSee('Tested');
$product->options()->saveMany($options); // Create another product so we can try and force it's option on to the 'correct' product $unrelatedProduct = $I->createModel(DanPowell\Shop\Models\Product::class, [], 'inStock', 1); $unrelatedOption = $I->makeModel(DanPowell\Shop\Models\Option::class, [], 'select', 1); $unrelatedProduct->options()->save($unrelatedOption); $I->amOnRoute('shop.product.show', $product->slug); // Randomly choose the option values $option_values = []; foreach ($options as $option) { if ($option->type == 'radio' || $option->type == 'select') { $option_values[$option->id] = $option->config[array_rand($option->config)]; $I->selectOption('option[' . $option->id . ']', $option_values[$option->id]); } else { $option_values[$option->id] = "Testing"; $I->fillField('option[' . $option->id . ']', "Testing"); } } // Submit the form $I->submitForm('#addToCart', ['option[' . $unrelatedOption->id . ']' => $unrelatedOption->config[0]]); $I->seeCurrentRouteIs('shop.cart.show'); // Check that we see the product $I->see('Product added to cart', '.alert'); $I->see($product->title, '.CartTable-product-title'); // Check that the selected options have been sent through foreach ($options as $option) { $I->see($option->title, '.CartTable-item-options'); $I->see($option_values[$option->id], '.CartTable-item-options'); } // Check that the unrelated option we forced through has *not* appeared $I->dontSee($unrelatedOption->title, '.CartTable-item-options'); $I->dontSee($unrelatedOption->config[0], '.CartTable-item-options');
$I->amGoingTo('test validation'); $I->click('Create'); $I->dontSeeRecord('categories', []); $I->seeCurrentUrlEquals('/categories/create'); $I->see('The name field is required'); $I->see('The slug field is required'); // only empty name $I->amGoingTo('test name validation'); $I->fillField('slug', 'libro'); $I->fillField('active', 1); $I->click('Create'); $I->dontSeeRecord('categories', ['slug' => 'libro', 'active' => 1]); $I->seeCurrentUrlEquals('/categories/create'); $I->see('The name field is required', '.error'); $I->seeInField('slug', 'libro'); $I->dontSee('The slug field is required'); // all form filled $I->fillField('name', 'Libro'); $I->fillField('slug', 'libro'); $I->fillField('active', 1); $I->click('Create'); $I->haveRecord('categories', ['name' => 'Libro', 'slug' => 'libro', 'active' => 1]); $I->seeCurrentUrlEquals('/categories'); $I->seeInTitle('All categories'); $I->see('Libro', 'td'); $I->see('libro', 'td'); $I->see('Si', 'td'); $I->see('Edit', '.btn-edit'); $I->see('Delete', '.btn-delete'); // name is unique $I->amGoingTo('validate if name is unique');
<?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->am('HRis User'); $I->wantTo('Delete My Job Details. [Positive Test]'); # Authorize User $I->amOnPage('/auth/login'); $I->fillField('email', '*****@*****.**'); $I->fillField('password', 'retardko'); $I->click('Login'); # Dashboard $I->seeCurrentUrlEquals('/dashboard'); # Profile $I->click('Profile'); $I->seeCurrentUrlEquals('/profile/personal-details'); # Job $I->click('Job'); $I->seeCurrentUrlEquals('/profile/job'); # Delete Job record $I->click('Modify'); $I->seeCurrentUrlEquals('/profile/job/edit'); $I->see('Sr Web Designer'); $id = $I->grabAttributeFrom('button[title=Delete]', 'id'); $token = $I->grabAttributeFrom('input[name=_token]', 'value'); $I->sendAjaxPostRequest('/ajax/profile/job/edit', ['id' => $id, '_token' => $token, '_method' => 'DELETE']); // POST $I->dontSee('Test Suite');