/** * @param FunctionalTester $I * * @actor FunctionalTester * * @return void */ public function updateEmail(FunctionalTester $I) { $I->am('Normal User'); $I->wantTo('update my email'); $I->lookForwardTo('be able to change my email'); $user = $I->createUser(1); $I->amLoggedAs($user); $I->amOnAction('UserController@getSettings'); $I->fillField('email', 'email'); $I->click(trans('tinyissue.update')); $I->seeFormHasErrors(); $I->fillField('email', '*****@*****.**'); $I->click(trans('tinyissue.update')); $I->seeInField('email', '*****@*****.**'); }
<?php $I = new FunctionalTester($scenario); $I->wantTo('I am Admin and Update Currency Mau'); $I->dontSeeAuthentication(); $I->amLoggedAs(['email' => '*****@*****.**', 'password' => 'admin']); $I->seeAuthentication(); //When $id = $I->haveRecord('currencys', ['name' => 'Mau', 'symbol' => '@']); //And $I->amOnPage('/settings/currency/' . $id); //then $I->see('Edit'); //When $I->click('Edit'); $I->seeCurrentUrlEquals('/settings/currency/' . $id . '/edit'); $I->seeInField('name', 'Mau'); $I->seeInField('symbol', '@'); //And $I->amGoingTo('Change name of Mau to Yen'); $form = ['name' => 'Yen', 'symbol' => '@']; //$I->submitForm('//form', $form, 'Save'); /*$I->amOnPage('/settings/users/'.$id); $I->seeCurrentUrlEquals('/settings/users/'.$id); $I->see('Macrio'); $I->see('*****@*****.**');*/
public function access_to_account_create_page(FunctionalTester $I) { $I->am('Unlogged user'); $I->wantTo('access to the account create page after a fail attempt to login'); $I->expectTo('see the account create page with only the email filled'); /*************************************************************************************************************** * run test **************************************************************************************************************/ $I->amOnPage('/'); $I->amOnRoute('home'); $I->click(trans('template.front.header.my_account')); $I->seeCurrentRouteIs('login.index'); $I->fillField('email', '*****@*****.**'); $I->click(trans('auth.login.action.login')); $I->seeInField('email', '*****@*****.**'); $I->click(trans('auth.login.label.create_account')); $I->see(trans('auth.login.label.create_account'), 'h1'); $I->seeInField('last_name', ''); $I->seeInField('first_name', ''); $I->seeInField('email', '*****@*****.**'); $I->seeInField('password', ''); $I->seeInField('password_confirmation', ''); }
$I->wantTo('create a new section'); // When $I->amOnPage('admin/sections'); // And $I->click('Add a new section'); // Then $I->seeCurrentUrlEquals('/admin/sections/create'); $I->see('New section', 'h1'); $I->amGoingTo('Omit the name field in order to submit an invalid form'); // When $I->fillField('Slug URL', 'our-company'); $I->click('Create section'); // Then $I->expectTo('See the form again with the errors'); $I->seeCurrentUrlEquals('/admin/sections/create'); $I->seeInField('slug_url', 'our-company'); $I->see('The name field is required', '.error'); $I->amGoingTo('Fill a valid form'); // When $I->fillField('Name', 'Our company'); $I->fillField('Slug URL', 'our-company'); $I->selectOption('type', 'blog'); $I->selectOption('menu', 1); $I->fillField('menu_order', 2); $I->selectOption('published', 0); // And $I->click('Create section'); // Then $I->seeCurrentUrlEquals('/admin/sections/1'); $I->see('Our company', 'h1'); /*
// 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'); $I->dontSee($sections->first()->name, 'td.name');
<?php $I = new FunctionalTester($scenario); $I->wantTo('I am Admin and Update Company Mau'); $I->dontSeeAuthentication(); $I->amLoggedAs(['email' => '*****@*****.**', 'password' => 'admin']); $I->seeAuthentication(); //When $id = $I->haveRecord('companys', ['name' => 'Maur', 'partner_id' => '2', 'currency_id' => '3', 'fiscalRegimen_id' => '2']); //And $I->amOnPage('/settings/company/' . $id); //then $I->see('Edit'); //When $I->click('Edit'); $I->seeCurrentUrlEquals('/settings/company/' . $id . '/edit'); $I->seeInField('name', 'Maur'); $I->seeInField('partner_id', '2'); $I->seeInField('currency_id', '3'); $I->seeInField('fiscalRegimen_id', '2'); //And $I->amGoingTo('Change name of Maur to Association_Mau'); $form = ['name' => 'Association_Mau', 'partner_id' => '3', 'currency_id' => '2', 'fiscalRegimen_id' => '1'];
<?php $I = new FunctionalTester($scenario); $I->wantTo('I am Admin and Update CertificateSats Mau'); $I->dontSeeAuthentication(); $I->amLoggedAs(['email' => '*****@*****.**', 'password' => 'admin']); $I->seeAuthentication(); //When $id = $I->haveRecord('certificatesats', ['name' => 'Benny', 'noSerie' => '123456', 'startDate' => '0000-00-00', 'endDate' => '0000-00-00']); //And $I->amOnPage('/settings/certificatesats/' . $id); //then $I->see('Edit'); //When $I->click('Edit'); $I->seeCurrentUrlEquals('/settings/certificatesats/' . $id . '/edit'); $I->seeInField('name', 'Benny'); $I->seeInField('noSerie', '123456'); $I->seeInField('startDate', '0000-00-00'); $I->seeInField('endDate', '0000-00-00'); //And $I->amGoingTo('Change name of Benny to Iggy2'); $form = ['name' => 'Iggy2', 'noSerie' => '1234567', 'startDate' => '2010-02-01', 'endDate' => '2019-04-01'];
// form empty $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
public function access_to_my_profile(FunctionalTester $I) { $I->am('Admin'); $I->wantTo('access to my profile page'); $I->expectTo('see my profile page'); /*************************************************************************************************************** * run test **************************************************************************************************************/ $I->amOnPage('/'); $I->seeCurrentRouteIs('home'); $I->click(trans('template.front.header.my_account')); $I->seeCurrentRouteIs('dashboard.index'); $I->click(trans('template.back.header.my_profile')); $I->seeCurrentRouteIs('users.profile'); $I->see(trans('breadcrumbs.admin'), '.breadcrumb'); $I->seeLink(trans('breadcrumbs.admin'), route('dashboard.index')); $I->see(strip_tags(trans('breadcrumbs.users.profile')), '.breadcrumb'); $I->assertFileNotExists('photo'); $I->seeOptionIsSelected('gender', config('user.gender_key.male')); $I->seeInField('last_name', $this->_user->last_name); $I->seeInField('first_name', $this->_user->first_name); $I->seeInField('birth_date', Carbon::createFromFormat('Y-m-d', $this->_user->birth_date)->format('d/m/Y')); $I->seeInField('phone_number', $this->_user->phone_number); $I->seeInField('email', $this->_user->email); $I->seeInField('address', $this->_user->address); $I->seeInField('zip_code', $this->_user->zip_code); $I->seeInField('city', $this->_user->city); $I->seeInField('country', $this->_user->country); $I->seeInField('password', ''); $I->seeInField('password_confirmation', ''); $I->dontSee(trans('users.page.label.status_id')); $I->dontSee(trans('users.page.label.board_id')); $I->dontSee(trans('users.page.label.role')); $I->dontSee(trans('users.page.label.activation')); }
$I = new FunctionalTester($scenario); $I->am('a CMS Admin'); $I->wantTo('update a section'); // When $id = $I->haveSection(); // And $I->amOnPage('admin/sections/' . $id); // Then $I->see('Edit section', '.btn-edit'); // When $I->click('Edit section'); // Then $I->seeCurrentUrlEquals('/admin/sections/' . $id . '/edit'); $I->see('Edit section "Our company"', 'h1'); $I->seeInField('name', 'Our company'); $I->seeInField('slug_url', 'our-company'); $I->seeInField('menu_order', 2); $I->seeOptionIsSelected('published', 0); $I->seeOptionIsSelected('menu', 1); $I->seeOptionIsSelected('type', 'Page'); $I->amGoingTo('Submit an invalid form'); // When $I->fillField('name', ''); // And $I->click('Update section'); // Then $I->expectTo('see the form back with data and errors'); $I->seeCurrentUrlEquals('/admin/sections/' . $id . '/edit'); $I->seeInField('name', ''); $I->seeInField('slug_url', 'our-company');
$I = new FunctionalTester($scenario); $I->wantTo('Check validate for Catalog input'); $I->amOnPage('/catalog/digital_mail'); //submit form $I->click('送信する'); //check required $I->seeCurrentUrlEquals('/catalog/digital_mail'); $I->seeFormErrorMessages(array('email1' => 'E-mailは必須入力項目です。必ず入力してください。')); //check max length $I->fillField('email1', INPUT_LENGTH_99 . '.vn'); //length 102 //submit form $I->click('送信する'); //check required $I->seeCurrentUrlEquals('/catalog/digital_mail'); $I->seeFormErrorMessages(array('email1' => 'E-mailは100文字以下で入力してください。')); // // //-----------------------------------check email can be apply----------------------------------- // // //fill value $I->fillField('email1', 'email1@gmail'); //submit form $I->click('送信する'); //check required $I->seeCurrentUrlEquals('/catalog/digital_mail'); //check error $I->seeFormErrorMessages(array('email1' => 'E-mailが正しく入力されていません。')); $I->seeInField('email1', 'email1@gmail');
public function update_slide_with_data_changed(FunctionalTester $I) { $I->am('Admin'); $I->wantTo('update slide data'); $I->expectTo('see a success confirmation message and see that the user data has changed'); /*************************************************************************************************************** * settings **************************************************************************************************************/ // we create the admin role $admin_role = $this->_createAdminRole(); // we attach it to the logged user $admin_role->users()->attach($this->_user); // we create a slide $this->_createSlide(); // we create another slide $slide = $this->_slide_repo->create(['title' => 'Aviron universitaire', 'quote' => 'Other quote', 'picto' => 'picto_2.png', 'background_image' => 'bg_img_2.jpg', 'position' => 2, 'active' => true]); /*************************************************************************************************************** * run test **************************************************************************************************************/ $I->amOnPage('/'); $I->amOnRoute('slides.edit', ['id' => $this->_slide->id]); $I->fillField('title', 'Test'); $I->fillField('quote', 'Rejoignez le plus grand club d\'aviron universitaire de France. Nous proposons des tarifs avantageux pour tous les étudiants nantais !'); $I->selectOption('#input_previous_slide_id', $slide->position . ' - ' . $slide->title); $I->checkOption('#input_active'); $I->click(trans('home.page.action.slide.update')); $I->seeCurrentRouteIs('slides.edit', ['id' => $this->_slide->id]); $I->see(trans('global.modal.alert.title.success'), 'h3'); $I->see(strip_tags(trans('home.message.slide.update.success', ['slide' => 'Test']))); $I->seeInField('title', 'Test'); $I->seeInField('quote', 'Rejoignez le plus grand club d\'aviron universitaire de France. Nous proposons des tarifs avantageux pour tous les étudiants nantais !'); $I->seeOptionIsSelected('#input_previous_slide_id', '1 - ' . $slide->title); $I->seeCheckboxIsChecked('#input_active'); $I->seeRecord('slides', ['title' => 'Test', 'quote' => 'Rejoignez le plus grand club d\'aviron universitaire de France. Nous proposons des tarifs avantageux pour tous les étudiants nantais !', 'position' => 2, 'active' => true]); }
// Then $I->see('Log in', 'h2'); $I->see('Username', 'label'); $I->see('Password', 'label'); $I->see('Remember me', 'label'); $I->seeElement('input', ['value' => 'Log in', 'class' => 'btn btn-primary btn-block']); $I->amGoingTo('fill an invalid user in order to see the errors'); // When $I->fillField('username', 'admin'); $I->fillField('password', '12345'); // And $I->click('Log in', 'input[type=submit]'); // Then $I->expectTo('see an error message'); $I->seeCurrentUrlEquals('/login'); $I->seeInField('username', 'admin'); $I->see('Invalid data', '.alert-danger'); $I->haveRecord('users', ['first_name' => 'System', 'last_name' => 'Administrator', 'username' => 'admin', 'password' => Hash::make('secret'), 'email' => '*****@*****.**', 'remember_token' => null]); $I->amGoingTo('full a valid user and see the result'); // When $I->fillField('password', 'secret'); // And $I->click('Log in', 'input[type=submit]'); // Then $I->seeCurrentUrlEquals(''); $I->see('You have arrived.', 'h1'); $I->see('Log out', 'a'); $I->seeAuthentication(); $I->amGoingTo('log out'); // When $I->click('Log out', 'a');
public function update_role_with_data_changes(FunctionalTester $I) { $I->am('Admin'); $I->wantTo('update a role with no data'); $I->expectTo('see an error message explaining that the fields are required'); /*************************************************************************************************************** * settings **************************************************************************************************************/ // we create the admin role $admin = $this->_createAdminRole(); // we attach it to the logged user $admin->users()->attach($this->_user); // we create another role $operator = $this->_createUserRole(); /*************************************************************************************************************** * run test **************************************************************************************************************/ $I->amOnPage('/'); $I->amOnRoute('permissions.edit', ['id' => $operator->id]); $I->fillField('name_fr', 'Test FR'); $I->fillField('slug', 'new_slug'); $I->selectOption('parent_role_id', $admin->id); $I->checkOption('#settings' . config('permissions.separator') . 'view'); $I->checkOption('#permissions'); $I->checkOption('#permissions' . config('permissions.separator') . 'list'); $I->checkOption('#permissions' . config('permissions.separator') . 'create'); $I->checkOption('#permissions' . config('permissions.separator') . 'view'); $I->checkOption('#permissions' . config('permissions.separator') . 'update'); $I->checkOption('#permissions' . config('permissions.separator') . 'delete'); $I->checkOption('#users'); $I->checkOption('#users' . config('permissions.separator') . 'list'); $I->checkOption('#users' . config('permissions.separator') . 'create'); $I->checkOption('#users' . config('permissions.separator') . 'view'); $I->checkOption('#users' . config('permissions.separator') . 'update'); $I->checkOption('#users' . config('permissions.separator') . 'delete'); $I->click(trans('permissions.page.action.edit')); $I->seeCurrentRouteIs('permissions.edit', ['id' => $operator->id]); $I->see(trans('global.modal.alert.title.success'), 'h3'); $I->see(strip_tags(trans('permissions.message.update.success', ['name' => 'Test FR']))); $I->seeInField('name_fr', 'Test FR'); $I->seeInField('slug', 'new-slug'); $I->seeInField('position', 2); $I->seeOptionIsSelected('#input_parent_role', '1 - ' . $admin->name); $I->seeCheckboxIsChecked('#settings' . config('permissions.separator') . 'view'); $I->seeCheckboxIsChecked('#permissions'); $I->seeCheckboxIsChecked('#permissions' . config('permissions.separator') . 'list'); $I->seeCheckboxIsChecked('#permissions' . config('permissions.separator') . 'create'); $I->seeCheckboxIsChecked('#permissions' . config('permissions.separator') . 'view'); $I->seeCheckboxIsChecked('#permissions' . config('permissions.separator') . 'update'); $I->seeCheckboxIsChecked('#permissions' . config('permissions.separator') . 'delete'); $I->seeCheckboxIsChecked('#users'); $I->seeCheckboxIsChecked('#users' . config('permissions.separator') . 'list'); $I->seeCheckboxIsChecked('#users' . config('permissions.separator') . 'create'); $I->seeCheckboxIsChecked('#users' . config('permissions.separator') . 'view'); $I->seeCheckboxIsChecked('#users' . config('permissions.separator') . 'update'); $I->seeCheckboxIsChecked('#users' . config('permissions.separator') . 'delete'); $I->seeRecord('roles', ['id' => $operator->id, 'slug' => 'new-slug', 'position' => 2, 'permissions' => '{"permissions":true,"users":true,"settings.view":true,"permissions.list":true,"permissions.create":true,"permissions.view":true,"permissions.update":true,"permissions.delete":true,"users.list":true,"users.create":true,"users.view":true,"users.update":true,"users.delete":true}']); }
<?php $I = new FunctionalTester($scenario); $I->wantTo('I am Admin and Update partner Mario'); $I->dontSeeAuthentication(); $I->amLoggedAs(['email' => '*****@*****.**', 'password' => 'admin']); $I->seeAuthentication(); //When $id = $I->haveRecord('partners', ['name' => 'Mario', 'country_id' => 1, 'state_id' => 1, 'city_id' => 1]); //And $I->amOnPage('/partners/' . $id); //then $I->see('Edit'); //When $I->click('Edit'); $I->seeCurrentUrlEquals('/partners/' . $id . '/edit'); $I->seeInField('name', 'Mario'); $I->seeInField('country_id', 1); $I->seeInField('state_id', 1); $I->seeInField('city_id', 1); //And $I->amGoingTo('Change name of Mario to Mariano'); $form = ['name' => 'Mariano', 'country_id' => 1, 'state_id' => 1, 'city_id' => 1]; $I->submitForm('//form', $form, 'Save');
<?php $I = new FunctionalTester($scenario); $I->wantTo('I am Admin and Update product Fresca'); $I->dontSeeAuthentication(); $I->amLoggedAs(['email' => '*****@*****.**', 'password' => 'admin']); $I->seeAuthentication(); //When $id = $I->haveRecord('products', ['name' => 'Fresca', 'description' => 'Fresca de 600 ml', 'purchasePrice' => 7, 'salePrice' => 9, 'qtyAvailable' => 20, 'incomingQty' => 12, 'virtualAvailable' => 32, 'ean13' => 'Fresca Coca-cola company', 'uom_id' => 4, 'partner_id' => 2]); //And $I->amOnPage('/products/' . $id); //then $I->see('Edit'); //When $I->click('Edit'); $I->seeCurrentUrlEquals('/products/' . $id . '/edit'); $I->seeInField('name', 'Fresca'); $I->seeInField('description', 'Fresca de 600 ml'); $I->seeInField('purchasePrice', 7); $I->seeInField('salePrice', 9); $I->seeInField('qtyAvailable', 20); $I->seeInField('incomingQty', 12); $I->seeInField('virtualAvailable', 32); $I->seeInField('ean13', 'Fresca Coca-cola company'); $I->seeInField('uom_id', 4); $I->seeInField('partner_id', 2); //And $I->amGoingTo('Change name and description of Fresca to Fanta'); $form = ['name' => 'Fanta', 'description' => 'Fanta de 600 ml', 'purchasePrice' => 7, 'salePrice' => 9, 'qtyAvailable' => 20, 'incomingQty' => 12, 'virtualAvailable' => 32, 'ean13' => 'Fresca Coca-cola company', 'uom_id' => 4, 'partner_id' => 2]; $I->submitForm('//form', $form, 'Save');