public function loginWithInvalidCredentials(AcceptanceTester $I) { $I->amOnPage('/login'); $I->click('Login'); $I->seeCurrentUrlEquals('/login'); $I->see('Invalid Credentials', '.flash'); }
public function editTask(AcceptanceTester $I) { $description = $this->faker->text(100); $I->wantTo('edit a task'); $I->amOnPage('/tasks/1/edit'); $I->seeCurrentUrlEquals('/tasks/1/edit'); $I->fillField('#description', $description); $I->click('Save'); $I->seeInDatabase('tasks', ['description' => $description]); }
public function editClient(AcceptanceTester $I) { $I->wantTo('Edit a client'); //$id = Helper::getRandom('Client', 'public_id'); //$url = sprintf('/clients/%d/edit', $id); $url = '/clients/1/edit'; $I->amOnPage($url); $I->seeCurrentUrlEquals($url); //update fields $name = $this->faker->firstName; $I->fillField(['name' => 'name'], $name); $I->click('Save'); $I->see($name); }
/** * Tests add product to cart * * @group checkout * * @param $I \AcceptanceTester * */ public function testAddProductToCart(AT $I) { $I->am('Visitor'); $I->wantTo('Add product to cart'); $I->amGoingTo('open category page'); $I->amOnPage(Page\Catalog::$CATEGORY_URL); $I->expectTo('see category page'); $I->amGoingTo('open product page'); $I->click(Page\Catalog::$categoryFirstProduct); $I->expectTo('see product page'); $I->seeElement(Page\Catalog::$productBody); $I->amGoingTo('submit the form'); $I->submitForm(Page\Catalog::$addToCartForm, array()); $I->expectTo('see the cart page'); $I->seeCurrentUrlEquals(Page\Checkout::$CART_URL); $I->expectTo('see a success message'); $I->seeElement(Page\Catalog::$successMessage); }
<?php $I = new AcceptanceTester($scenario); $I->am('Site Administrator'); $I->wantTo('Add a new Product'); $I->amLoggedAs($I->aSiteAdministrator()); $I->amOnPage('/admin/products'); $I->click('Add Product'); $I->seeCurrentUrlEquals('/admin/products/create'); $category = \App\Repositories\Category::get()->toArray(); $I->selectOption('category', $category[0]['id']); $I->fillField('name', 'Malt Liquor'); $I->fillField('description', 'Malt Liquor for you to describe'); $I->fillField('price', '34.00'); $I->fillField('quantity', '150'); $I->selectOption('status', '1'); $I->attachFile('image', 'roundrect8537796.gif'); $I->click('Create Product'); $I->seeCurrentUrlEquals('/admin/products'); $I->see('New Product: Malt Liquor Created');
<?php /** * @link http://www.diemeisterei.de/ * @copyright Copyright (c) 2015 diemeisterei GmbH, Stuttgart * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ $I = new AcceptanceTester($scenario); $I->wantTo('ensure that language urls and redirects work'); $I->amOnPage('/'); $I->seeCurrentUrlEquals('/en/user/login'); $I->amOnPage('/de'); $I->seeCurrentUrlEquals('/de/user/login'); $I->see('Anmelden'); $I->makeScreenshot('language-de'); $I->amOnPage('/en-us'); $I->see('Not Found');
<?php $I = new AcceptanceTester($scenario); $I->wantTo('Validate the login function with zhaobing\' email and password! '); $I->amOnPage('/'); $I->see('赵兵的电影'); $I->canSeeInCurrentUrl('/auth/login'); $I->fillField('email', '*****@*****.**'); $I->fillField('password', '123456'); $I->click('Login'); $I->seeCurrentUrlEquals('/movies'); $I->see('欢迎赵兵登录');
<?php $I = new AcceptanceTester($scenario); $I->am('Site Administrator'); $I->wantTo('View all products'); $I->amLoggedAs($I->aSiteAdministrator()); $I->amOnPage('/admin/dashboard'); $I->click('Products'); $I->seeCurrentUrlEquals('/admin/products'); $I->see('Products Administration');
<?php $I = new AcceptanceTester($scenario); $I->am('Site User'); $I->wantTo('Be restricted from the Administrator\'s section'); $I->amLoggedAs($I->siteUser()); $I->amOnPage('/admin/dashboard'); $I->seeCurrentUrlEquals('/user/dashboard'); $I->see('Restricted Access!!!'); $I->amOnPage('/admin/categories'); $I->seeCurrentUrlEquals('/user/dashboard'); $I->see('Restricted Access!!!'); $I->amOnPage('/admin/products'); $I->seeCurrentUrlEquals('/user/dashboard'); $I->see('Restricted Access!!!'); $I->amOnPage('/admin/administrators'); $I->seeCurrentUrlEquals('/user/dashboard'); $I->see('Restricted Access!!!'); $I->amOnPage('/admin/clients'); $I->seeCurrentUrlEquals('/user/dashboard'); $I->see('Restricted Access!!!');
<?php $I = new AcceptanceTester($scenario); $I->wantTo('see the Home page'); $I->amOnPage('/'); $I->see('My albums'); $I->seeInDatabase('album', array('artist' => 'Adele', 'title' => '21')); $I->seeLink('Add new album'); $I->click('Add new album'); $I->see('Title'); $I->see('Artist'); $I->seeCurrentUrlEquals('/album/add'); $I->fillField('title', 'foo'); $I->fillField('artist', 'bar'); // enable repopulate and cleanup in codeception.yml to reset the db before each test // enabld module Db in acceptance.suite.yml to use this feature // click submit to add the new album //$I->dontSee('foo'); //$I->click('submit'); //$I->see('foo');
<?php $I = new AcceptanceTester($scenario); $I->wantTo('test everything under the sun... one moment...'); $I->wantTo('sign up for a new account'); $I->amOnPage('/register'); $I->fillField('Name', 'Test User'); $I->fillField('Email Address', '*****@*****.**'); $I->fillField('Password', 'batman'); $I->fillField('Confirm Password', 'batman'); $I->click('Sign Up'); $I->seeCurrentUrlEquals('/home'); $I->wantTo('sign out and check I can log back in successfully'); $I->see('Sign Out'); $I->click('Sign Out'); $I->seeCurrentURlEquals('/'); $I->amOnPage('/login'); $I->fillField('Email Address', '*****@*****.**'); $I->fillField('Password', 'batman'); $I->click('Log In'); $I->seeCurrentUrlEquals('/home'); $I->wantTo('add a category and get started'); $I->amOnPage('/home'); $I->see('Add a Category Below'); $I->fillField('Category Name', 'Test Category'); $I->click('Add Category'); $I->seeCurrentUrlEquals('/home'); $I->see('Test Category'); $I->wantTo('add another category'); $I->fillField('Category Name', 'My Next Category'); $I->fillField('Category Description', 'I can put whatever I want here???');
<?php $I = new AcceptanceTester($scenario); $I->am('Site User'); $I->wantTo('Log in as a Site User'); $I->amOnPage('/'); $I->click('Login'); $I->seeCurrentUrlEquals('/auth/login'); $I->fillField('email', '*****@*****.**'); $I->fillField('password', 'joshua'); $I->click('login_user'); $I->seeCurrentUrlEquals('/user/dashboard'); $I->see('User Dashboard');
<?php /** * ownCloud - galleryplus * * This file is licensed under the Affero General Public License version 3 or * later. See the COPYING file. * * @author Olivier Paroz <*****@*****.**> * * @copyright Olivier Paroz 2015 */ use Page\Acceptance\Login; use Page\Gallery as GalleryPage; $I = new AcceptanceTester($scenario); $I->am('a standard user'); $I->wantTo('load the Gallery+ app'); $I->lookForwardTo('seeing my holiday pictures'); $loginPage = new Login($I); $loginPage->login('admin', 'admin'); $loginPage->confirmLogin(); $I->click('.menutoggle'); $I->click('Gallery+', '#navigation'); $I->seeCurrentUrlEquals(GalleryPage::$URL); $I->seeElement(GalleryPage::$contentDiv);
<?php $I = new AcceptanceTester($scenario); $I->am('a guest'); $I->wantTo('clean slug and redirect'); $I->amOnPage('test@'); $I->seeCurrentUrlEquals('/testat'); $I->amOnPage(' this will have dash between'); $I->seeCurrentUrlEquals('/this-will-have-dash-between'); $I->amOnPage('password@/login'); $I->seeCurrentUrlEquals('/passwordat');
<?php $I = new AcceptanceTester($scenario); $I->am('a guest'); $I->wantTo('have password prompt if page is protected'); $I->amOnPage('password'); $I->seeCurrentUrlEquals('/password/login');
<?php $I = new AcceptanceTester($scenario); $I->am('Site Administrator'); $I->wantTo('Add a new Category'); $I->amLoggedAs($I->aSiteAdministrator()); $I->amOnPage('/admin/categories'); $I->click('Add Category'); $I->seeCurrentUrlEquals('/admin/categories/create'); $I->fillField('name', 'Malt Liquor'); $I->fillField('description', 'Malt Liquor for you to describe'); $I->click('Create Category'); $I->seeCurrentUrlEquals('/admin/categories'); $I->see('New Category: Malt Liquor Created');
$I->see('Item updated'); $I->amOnPage('/'); $I->click('Logout'); //login as moderator $I->amOnPage('/oc-panel/auth/login'); $I->fillField('email', '*****@*****.**'); $I->fillField('password', '1234'); $I->click('auth_redirect'); $I->amOnPage('/oc-panel/ad'); $I->dontSeeElement('.alert.alert-danger'); $I->see('Advertisements', 'h1'); $I->see('ALL ADS', 'a'); $I->see('SPAM', 'a'); $I->see('UNAVAILABLE', 'a'); $I->see('UNCONFIRMED', 'a'); $I->seeCurrentUrlEquals('/oc-panel/ad'); $I->amOnPage('/oc-panel/category'); //$I->dontSeeElement('.alert.alert-danger'); $I->see('Categories', 'h1'); $I->see('NEW CATEGORY', 'a'); $I->see('Change the order of your categories. Keep in mind that more than 2 levels nested probably won´t be displayed in the theme (it is not recommended).', 'p'); $I->see('Add names for multiple categories, for each one push enter.'); $I->see('Please use the correct CSV format'); $I->seeElement('.drag-icon'); $I->seeCurrentUrlEquals('/oc-panel/category'); $I->amOnPage('/oc-panel/location'); //$I->dontSeeElement('.alert.alert-danger'); $I->see('Locations', 'h1'); $I->see('NEW LOCATION', 'a'); $I->see('Change the order of your locations. Keep in mind that more than 2 levels nested probably won´t be displayed in the theme (it is not recommended).', 'p'); $I->see('Add names for multiple locations, for each one push enter.');
<?php $I = new AcceptanceTester($scenario); $I->am('Registered Site User'); $I->wantTo('Add an Address to my Profile'); $I->amLoggedAs($I->siteUser()); $I->amOnPage('/user/addresses'); $I->click('Add Address'); $I->seeCurrentUrlEquals('/user/addresses/add'); $I->fillField('street_number', '36'); $I->fillField('street_name', 'McGhie Avenue'); $I->fillField('suburb', 'Rhodene'); $I->fillField('city', 'Masvingo'); $I->fillField('province', 'Masvingo'); $I->fillField('postal_code', '9999'); $I->click('Add Address'); $I->seeCurrentUrlEquals('/user/addresses'); $I->see('New Address Saved');
<?php $I = new AcceptanceTester($scenario); $I->am('Registered User'); $I->wantTo('View my Orders'); $I->amLoggedAs($I->siteUser()); $I->amOnPage('/user/dashboard'); $I->click('View Orders'); $I->seeCurrentUrlEquals('/user/orders'); $I->see('User Orders'); $I->see('Address');
<?php $I = new AcceptanceTester($scenario); $I->am('Unregistered User'); $I->wantTo('Register as a Site Administrator'); $I->amOnPage('/admin/register'); $I->see('Register'); $I->fillField('name', 'Bradshaw Matikinye'); $I->fillField('email', '*****@*****.**'); $I->fillField('password', 'bradshaw'); $I->fillField('password_confirmation', 'bradshaw'); $I->click('register_admin'); $I->seeCurrentUrlEquals('/admin/dashboard'); $I->see('Admin Dashboard');
<?php $I = new AcceptanceTester($scenario); $I->wantTo('see user can successfully sign up'); $I->amOnPage('/signup'); $I->fillField('Email', '*****@*****.**'); $I->fillField('Password', 'qwerty'); $I->fillField('confirm', 'qwerty'); $I->click('Sign Up'); $I->seeInCurrentUrl('/signin'); $I->see('User is successfully created. Now you can sign in.'); $I->testLogin('*****@*****.**', 'qwerty'); $I->seeCurrentUrlEquals('/'); $I->see('My pads');
<?php $I = new AcceptanceTester($scenario); $I->am('Site Administrator'); $I->wantTo('Edit a Category'); $I->amLoggedAs($I->aSiteAdministrator()); $I->amOnPage('/admin/categories'); $category = \App\Repositories\Category::get()->toArray(); $I->click($category[0]['name']); $I->seeCurrentUrlEquals('/admin/categories/1/edit'); $category = \App\Repositories\Category::get()->toArray(); $I->selectOption('parent_id', $category[2]['id']); $I->fillField('name', 'Roobeer'); $I->fillField('description', 'Roober Test Category'); $I->click('Update Category'); $I->seeCurrentUrlEquals('/admin/categories'); $I->see('Category: Roobeer Updated');