/** * Login the admin user using his email * * @param \AcceptanceTester $I */ public function loginAdminUserTest(\AcceptanceTester $I) { $I->wantTo('log into the backend as Admin with email'); $I->loginWithEmailAs($this->user['admin']); $this->saveLogin($I); $I->see('Dashboard'); $I->see('Configuration', Locator::href('/bolt/users')); $I->see("You've been logged on successfully."); }
/** * Login the admin user using his email * * @param \AcceptanceTester $I */ public function loginAdminUserTest(\AcceptanceTester $I) { $I->wantTo('log into the backend as Admin with email'); $I->loginWithEmailAs($this->user['admin']); $this->cookies[$this->tokenNames['authtoken']] = $I->grabCookie($this->tokenNames['authtoken']); $this->cookies[$this->tokenNames['session']] = $I->grabCookie($this->tokenNames['session']); $I->see('Dashboard'); $I->see('Configuration', Locator::href('/bolt/users')); $I->see("You've been logged on successfully."); }
/** * Create a page record. * * @param \AcceptanceTester $I */ public function createRecordsTest(\AcceptanceTester $I) { $I->wantTo("Create and edit Pages as the 'editor' user"); // Set up the browser $I->setCookie('bolt_authtoken', $this->cookies['bolt_authtoken']); $I->setCookie('bolt_session', $this->cookies['bolt_session']); $I->amOnPage('/bolt'); $I->see('New Page'); $I->click('New Page'); $I->see('Pages', Locator::href('/bolt/overview/pages')); $I->see('View Pages', Locator::href('/bolt/overview/pages')); $I->see('New Page', Locator::href('/bolt/editcontent/pages')); $I->fillField('#title', 'A page I made'); $I->fillField('#teaser', 'Woop woop woop! Crazy nice stuff inside!'); $I->fillField('#body', 'Take it, take it! I have three more of these!'); $I->click('Save Page'); $I->see('The new Page has been saved.'); $I->see('A page I made'); $I->see('Woop woop woop'); }
/** * Test the 'File management -> View / edit templates' interface * * @param \AcceptanceTester $I */ public function fileManagementViewEditTemplatesTest(\AcceptanceTester $I) { $I->wantTo("Use the 'File management -> View / edit templates' interface as the 'developer' user"); // Set up the browser $this->setLoginCookies($I); $I->amOnPage('/bolt/files/themes'); // Inspect the landing page $dir = 'base-2016'; $I->see('Create folder', Locator::find('a', ['href' => '#'])); $I->see($dir, Locator::href("/bolt/files/themes/{$dir}")); $I->see("Rename {$dir}", Locator::find('a', ['href' => '#'])); $I->see("Delete {$dir}", Locator::find('a', ['href' => '#'])); // Navigate into the theme and check the results $I->click("{$dir}", Locator::href("/bolt/files/themes/{$dir}")); $I->see('css', Locator::href("/bolt/files/themes/{$dir}/css")); $I->see('images', Locator::href("/bolt/files/themes/{$dir}/images")); $I->see('js', Locator::href("/bolt/files/themes/{$dir}/js")); $I->see('theme.yml', Locator::href("/bolt/file/edit/themes/{$dir}/theme.yml")); $I->see('record.twig', Locator::href("/bolt/file/edit/themes/{$dir}/record.twig")); $I->see('index.twig', Locator::href("/bolt/file/edit/themes/{$dir}/index.twig")); // Navigate into a subdirectory $I->click('css', Locator::href("/bolt/files/themes/{$dir}/css")); $I->see('theme.css', Locator::href("/bolt/file/edit/themes/{$dir}/css/theme.css")); }
/** * Check that admin user can view all content types * * @param \AcceptanceTester $I */ public function viewAllContenttypesTest(\AcceptanceTester $I) { $I->wantTo('make sure the admin user can view all content types'); // Set up the browser $I->setCookie('bolt_authtoken', $this->cookies['bolt_authtoken']); $I->setCookie('bolt_session', $this->cookies['bolt_session']); $I->amOnPage('/bolt'); // Pages $I->see('Pages', Locator::href('/bolt/overview/pages')); $I->see('View Pages', Locator::href('/bolt/overview/pages')); $I->see('New Page', Locator::href('/bolt/editcontent/pages')); // Entries $I->see('Entries', Locator::href('/bolt/overview/entries')); $I->see('View Entries', Locator::href('/bolt/overview/entries')); $I->see('New Entry', Locator::href('/bolt/editcontent/entries')); // Showcases $I->see('Showcases', Locator::href('/bolt/overview/showcases')); $I->see('View Showcases', Locator::href('/bolt/overview/showcases')); $I->see('New Showcase', Locator::href('/bolt/editcontent/showcases')); // Resources $I->see('Resources', Locator::href('/bolt/overview/resources')); $I->see('View Resources', Locator::href('/bolt/overview/resources')); $I->see('New Resource', Locator::href('/bolt/editcontent/resources')); }
/** * Test that the 'developer' user can configure installed extensions. * * @param \AcceptanceTester $I */ public function configureInstalledExtensions(\AcceptanceTester $I, \Codeception\Scenario $scenario) { $I->wantTo("See that the 'developer' user can configure installed extensions."); // Set up the browser $I->setCookie($this->tokenNames['authtoken'], $this->cookies[$this->tokenNames['authtoken']]); $I->setCookie($this->tokenNames['session'], $this->cookies[$this->tokenNames['session']]); $I->amOnPage('/bolt/files/config/extensions'); $I->see('testerevents.bolt.yml', Locator::href('/bolt/file/edit/config/extensions/testerevents.bolt.yml')); $I->click('testerevents.bolt.yml', Locator::href('/bolt/file/edit/config/extensions/testerevents.bolt.yml')); $I->see('# Sit back and breathe', 'textarea'); $I->see('its_nice_to_know_you_work_alone: true', 'textarea'); // Edit the field $twig = $I->grabTextFrom('#form_contents', 'textarea'); $twig .= PHP_EOL . "# Let's make this perfectly clear"; $twig .= PHP_EOL . 'theres_no_secrets_this_year: true' . PHP_EOL; $I->fillField('#form_contents', $twig); $token = $I->grabValueFrom('#form__token'); $I->sendAjaxPostRequest('/bolt/file/edit/config/extensions/testerevents.bolt.yml', ['form[_token]' => $token, 'form[contents]' => $twig]); $I->amOnPage('/bolt/file/edit/config/extensions/testerevents.bolt.yml'); $I->see("# Let's make this perfectly clear", 'textarea'); $I->see('theres_no_secrets_this_year: true', 'textarea'); }
public function testHref() { $xml = new SimpleXMLElement("<root><a href='/logout'>Click Me</a></root>"); $this->assertNotEmpty($xml->xpath(Locator::href('/logout'))); }
$I->see('Test plant latin', 'tr td'); } $I = new AcceptanceTester($scenario); $I->wantTo('Edit plant'); /* * The user creates a plant width all the information on a plant. */ helperCreatePlant($I); /* * He is now on the front page and he wants to edit the newly created plant. */ $plantID = $I->grabRecord('plants', array('name' => 'Test plant'))->id; /* * He clicks on the link "mere.." at the plant. */ $I->click('Mere..', Locator::href('/plant-detail/' . $plantID)); /* * Here he sees all the information on the plant has been saved correct. */ $I->seeInCurrentUrl('plant-detail/' . $plantID); /* * Now he clicks on the edit button for the plant. */ $I->click('edit plant'); /* * The page redirects him to the edit page */ $I->seeInCurrentUrl('show-edit-plant'); /* * Here he sees all the checkboxes is checked correctly. */
<?php use Codeception\Util\Locator; $I = new FunctionalTester($scenario); $I->wantTo('Create a new offer'); //Index to login $I->amOnPage('/'); $I->click('Ingresa'); UserActionPage::of($I)->login('*****@*****.**', '123'); $I->seeCurrentUrlEquals('/companies/1/dashboard'); $I->click('Agregar Nueva Orden'); $I->seeCurrentUrlEquals('/companies/1/orders/create'); $I->selectOption('product_id', 'Limón Granel'); $I->selectOption('period', 'Todos los días (Lunes-Viernes) en un Periodo'); $I->fillField('start_date', NOW); $I->fillField('end_date', TOMORROW); $I->fillField('amount', 100); $I->fillField('min_amount', 90); $I->fillField('max_amount', 100); $I->fillField('max_amount_daily', 10); $I->fillField('price', 100); $I->click('Crear Orden'); $I->seeCurrentUrlEquals('/companies/1/dashboard'); $I->click('Ver Ordenes'); $I->see(NOW); $I->seeInDatabase('orders', array('start_date' => NOW)); $id = $I->grabFromDatabase('orders', 'id', array('start_date' => NOW)); $I->see($id); $I->see('Ver Ofertas', Locator::href('http://localhost/companies/1/offers/' . $id)); $I->see('Editar', Locator::href('http://localhost/companies/1/orders/' . $id . '/edit')); UserActionPage::of($I)->logout();