<?php use Mockery as m; $I = new FunctionalTester($scenario); $I->am('a guest'); $I->wantTo('sign up to build brighton'); $I->amOnPage('/'); $I->click('Become a Member'); $I->seeCurrentUrlEquals('/register'); $I->fillField('First Name', 'Jon'); $I->fillField('Family Name', 'Doe'); $I->fillField('Email', '*****@*****.**'); $I->fillField('Password', '12345678'); $I->fillField(['name' => 'address[line_1]'], 'Street Address'); $I->fillField(['name' => 'address[postcode]'], 'BN3 1AN'); $I->fillField('Phone', '0123456789'); $I->fillField('Emergency Contact', 'Contact Details'); $I->attachFile('Profile Photo', 'test-image.png'); $I->checkOption('rules_agreed'); //$userImageService = m::mock('\BB\Helpers\UserImage'); //$userImageService->shouldReceive('uploadPhoto')->times(1); //$this->app->instance('\BB\Helpers\UserImage',$userImageService); //$I->haveEnabledFilters(); $I->click('Join'); //Make sure we are now on an account page with the new id $I->seeCurrentUrlMatches('^/account/(\\d+)^'); $user = \BB\Entities\User::where('email', '*****@*****.**')->first(); $I->assertNotEmpty($user->hash);
<?php $I = new FunctionalTester($scenario); $I->wantTo('show all item catalogR5 input'); $I->amOnPage('/catalog/owner'); $I->checkOption('#dct279'); //submit form $I->click('お客様情報を入力'); //url $I->seeCurrentUrlEquals('/catalog/owner/input'); //title page //$I->seeInTitle('SRSF0020_セミナー申込み入力 | トランスコスモス'); //title label $I->see('お名前'); $I->see('姓'); $I->see('名'); $I->see('フリガナ'); $I->see('セイ'); $I->see('メイ'); $I->see('性別'); $I->see('男'); $I->see('女'); $I->see('年齢'); $I->see('ご職業'); $I->see('TEL'); $I->see('E-mail'); $I->see('ご住所'); $I->see('郵便番号'); $I->see('都道府県'); $I->see('市町村区・町名'); $I->see('建物タイプ(商品タイプ)');
<?php $I = new FunctionalTester($scenario); $I->wantTo('Enter Zip Code and Select Restaurants'); $I->amOnPage('/'); $I->fillField('email', '*****@*****.**'); $I->fillField('password', '12345'); $I->click('Login'); $I->seeCurrentUrlEquals('/sessions'); $I->fillField('zipcode', '10025'); $I->checkOption('indian'); $I->click('Get Restaurants'); $I->seeCurrentUrlEquals('/results');
public function log_with_correct_credentials_with_remember_checked(FunctionalTester $I) { $I->am('Unlogged user'); $I->wantTo('log with correct credentials filled and the "Remember me" checked'); $I->expectTo('have a remember cookie recorded'); $I->amOnPage('/'); $I->seeCurrentRouteIs('home'); $I->click(trans('template.front.header.my_account')); $I->seeCurrentRouteIs('login.index'); $I->fillField('email', $this->_user->email); $I->fillField('password', 'test'); $I->dontSeeCheckboxIsChecked('form input[name="remember"]'); $I->checkOption('form input[name="remember"]'); $I->canSeeCheckboxIsChecked('form input[name="remember"]'); $I->click(trans('auth.login.action.login')); $I->seeCurrentRouteIs('dashboard.index'); $I->see(trans('global.modal.alert.title.success'), 'h3'); $I->see(strip_tags(trans('auth.message.login.success', ['name' => $this->_user->first_name . ' ' . $this->_user->last_name]))); $I->seeCookie('cartalyst_sentinel'); }
public function activate_user_with_higher_role(FunctionalTester $I) { $I->am('Admin'); $I->wantTo('activate a user which have a higher role than mine'); $I->expectTo('see an error message explaining that I do not have the authorization'); /*************************************************************************************************************** * settings **************************************************************************************************************/ // we create the user role $user_role = $this->_createUserRole(); // we attach it the the logged user $user_role->users()->attach($this->_user); // we create another user $credentials = ['last_name' => 'Autre', 'first_name' => 'autre', 'email' => '*****@*****.**', 'password' => 'autre']; $user = \Sentinel::register($credentials); // we create the admin role $admin_role = $this->_createAdminRole(); // we attach it to the new user $admin_role->users()->attach($user); /*************************************************************************************************************** * run test **************************************************************************************************************/ $this->_user->addPermission('users.list', true)->save(); $I->amOnPage('/'); $I->amOnRoute('users.index'); $I->checkOption('#activate_' . $user->id); $I->submitForm('#form_activate_' . $user->id, []); $I->seeResponseCodeIs(401); // $I->see(strip_tags(trans('users.message.permission.denied', ['action' => trans('users.message.permission.action.edit')]))); $I->dontSeeRecord('activations', ['user_id' => $user->id, 'completed' => true]); }
<?php $I = new FunctionalTester($scenario); $I->wantTo('Add a product to cart that has bad extras'); // Create the models $product = $I->createModel(DanPowell\Shop\Models\Product::class, [], 'inStock', 1); // Extra 1 - This extra has a few options and will be selected $extra1 = $I->makeModel(DanPowell\Shop\Models\Extra::class, [], 'inStock', 1); $extra1 = $product->extras()->save($extra1); $option1 = $I->makeModel(DanPowell\Shop\Models\Option::class, [], 'text', 1); $option1 = $extra1->options()->save($option1); $I->amOnRoute('shop.product.show', $product->slug); // Select the extra 1, but DON'T fill out the option value $I->checkOption('extra[' . $extra1->id . ']'); $I->submitForm('#addToCart', []); $I->dontSee('Product added to cart', '.alert'); $I->seeCurrentRouteIs('shop.product.show'); $I->seeFormHasErrors();
<?php $I = new FunctionalTester($scenario); $I->reloadFixtures(); $I->wantTo('use filters to show messages with specified statuses on list'); $I->amOnPage('/message'); $I->see('Finished', 'table#results td span.label'); $I->see('In progress', 'table#results td span.label'); $I->see('New', 'table#results td span.label'); $I->see('Halted', 'table#results td span.label'); $I->see('Rerun', 'table#results td span.label'); $I->see('Error', 'table#results td span.label'); $I->checkOption('#message_search_flowStatuses_0'); // "New" $I->checkOption('#message_search_flowStatuses_4'); // "Finished" $I->click('Search'); $I->amOnPage('/message'); $I->see('Finished', 'table#results td span.label'); $I->dontSee('In progress', 'table#results td span.label'); $I->dontSee('Halted', 'table#results td span.label'); $I->dontSee('Rerun', 'table#results td span.label'); $I->dontSee('Error', 'table#results td span.label'); $I->dontSee('', 'table#results tr[class="status-finished"] td:last-child a[title="Run message"]'); $I->dontSee('', 'table#results tr[class="status-finished"] td:last-child a[title="Set status Ready"]'); $I->dontSee('', 'table#results tr[class="status-finished"] td:last-child a[title="Halt message"]'); $I->dontSee('', 'table#results tr[class="status-finished"] td:last-child a[title="Cancel message"]');
<?php $I = new FunctionalTester($scenario); $I->wantTo('Check catalog layout'); $I->amOnPage('/catalog/lifestylenavi'); $I->checkOption('#dct011'); //submit form $I->click('STEP2 お届け先の入力へ進む'); //url $I->seeCurrentUrlEquals('/catalog/lifestylenavi/input'); //title label $I->see('お名前'); $I->see('姓'); $I->see('名'); $I->see('フリガナ'); $I->see('セイ'); $I->see('メイ'); $I->see('性別'); $I->see('男'); $I->see('女'); $I->see('年齢'); $I->see('ご職業'); $I->see('TEL'); $I->see('FAX'); $I->see('E-mail'); $I->see('ご住所'); $I->see('郵便番号'); $I->see('都道府県'); $I->see('市町村区・町名'); $I->see('現在の検討状況等についてお聞かせください。'); $I->see('建築予定時期');
public function activate_slide(FunctionalTester $I) { $I->am('Admin'); $I->wantTo('activate a slide'); $I->expectTo('see that the slide has been activated'); /*************************************************************************************************************** * 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(); $this->_slide->active = false; $this->_slide->save(); /*************************************************************************************************************** * run test **************************************************************************************************************/ $I->amOnPage('/'); $I->amOnRoute('home.edit'); $I->checkOption('#activate_' . $this->_slide->id); $I->submitForm('#form_activate_' . $this->_slide->id, []); $I->seeResponseCodeIs(200); // $I->see(strip_tags(trans('home.message.slide.activation.success.label', ['action' => trans_choice('users.message.activation.success.action', true), 'slide' => $this->_slide->title]))); $I->seeRecord('slides', ['id' => $this->_slide->id, 'active' => true]); }
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('Add a product to cart that has extras'); // Create a Product and add some Extras $product = $I->createModel(DanPowell\Shop\Models\Product::class, [], 'inStock', 1); for ($i = 0; $i < 2; $i++) { $extras[] = $I->makeModel(DanPowell\Shop\Models\Extra::class, [], 'inStock', 1); } $product->extras()->saveMany($extras); // 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); $unrelatedExtra = $I->makeModel(DanPowell\Shop\Models\Extra::class, [], 'inStock', 1); $unrelatedProduct->extras()->save($unrelatedExtra); // Go to the product page $I->amOnRoute('shop.product.show', $product->slug); // Select only the first Extra $I->checkOption('extra[' . $extras[0]->id . ']'); $I->submitForm('#addToCart', ['extra[' . $unrelatedExtra->id . ']' => 'on']); $I->seeCurrentRouteIs('shop.cart.show'); $I->see('Product added to cart', '.alert'); $I->see($product->title, '.CartTable-product-title'); // Should see first Extra $I->see($extras[0]->title, '.CartTable-item-extras'); // Should *not* see any other Extras $I->dontSee($extras[1]->title, '.CartTable-item-extas'); $I->dontSee($unrelatedExtra->title, '.CartTable-item-extas');