codeception

Codeception: Check if element has focus?

做~自己de王妃 提交于 2019-12-10 21:58:43
问题 Is there a way to assert that an element (e.g. input or link) has the keyboard focus? I'm using Codeception with Selenium. Couldn't find anything on http://codeception.com/docs/modules/WebDriver 回答1: A reliable source told me this works: $I->executeJS('return $("#element").is(":focus")'); Happy testing! 回答2: Some more details to the answer by @sunomad Activate Codeception's Asserts Module in your acceptance.suite.yml : modules: enabled: # ... - Asserts Then use this in an Acceptance test:

selenium-server: Unexpected status SERVICE_PAUSED

风格不统一 提交于 2019-12-10 18:23:30
问题 Attempts to install Selenium Server as a service (using nssm) in Windows 10 fail with Unexpected status SERVICE_PAUSED on nssm start selenium-server . Selenium is selenium-server-standalone-2.53.0.jar. nssm is 2.24. OS is Windows 10, 1511, 32-bit. Event viewer says Service selenium-server ran for less than 1500 milliseconds. Restart will be delayed by 16000 milliseconds. The objective is to run acceptance tests of a Symfony application using codeception. PhantomJS has been abandoned as it

Codeception: [RuntimeException] Call to undefined method AcceptanceTester::wait

早过忘川 提交于 2019-12-10 16:47:49
问题 I'm making my first acceptance test with Codeception. When I run my test with wait() or waitForElement() , I get this message: [RuntimeException] Call to undefined method AcceptanceTester::wait Here is my acceptance.yml # Codeception Test Suite Configuration # # Suite for acceptance tests. # Perform tests in browser using the WebDriver or PhpBrowser. # If you need both WebDriver and PHPBrowser tests - create a separate suite. class_name: WebGuy modules: enabled: - WebDriver - \Helper

How to properly change testing environment vars - Codeception and Laravel 5.1

穿精又带淫゛_ 提交于 2019-12-10 16:07:49
问题 I am trying to use a sqlite db for testing purposes, as I don't want to touch my actual database: In my unit.suite.yml file: class_name: UnitTester modules: enabled: [Asserts, UnitHelper] config: Db: dsn: 'sqlite:app/tests/_data/testdb.sqlite' user: '' password: '' dump: app/tests/_data/dump.sql In my TestCase.php file I have a function which resets and migrates and seeds the db for testing: Artisan::call('migrate:reset'); Artisan::call('migrate'); Artisan::call('db:seed'); I also added the

Why Codeception creates new \Test instance for each test* method?

吃可爱长大的小学妹 提交于 2019-12-10 13:08:54
问题 As a base I use \Codeception\TestCase\Test class. And I noticed that for every test* methods defined in class, codeception recreates TestCase\Test class ! But Why? As result I can't use class fields! public function getName() { if (!empty($this->_name)) { return $this->_name; } else $this->_name = uniqid('_name'); } getName() for every test method will return new generated name.. thats wrong behavior as for me. It's possible to resolve this situation if I wants to use class fields for every

unable to run codeception in virtual machine -Mink could not be found and loaded

家住魔仙堡 提交于 2019-12-10 09:27:19
问题 I installed a vm ubuntu guest OS. My app is running from the browser in my host OS at the url http://abc.localhost:8888 I type php codecept.phar run in the guest OS terminal. I get the following error: [Codeception\Exception\Configuration] Mink could not be found and loaded My acceptance.yml says # Codeception Test Suite Configuration # suite for acceptance tests. # perform tests in browser using the Selenium-like tools. # powered by Mink (http://mink.behat.org). # (tip: that's what your

seeInField finds the element, while fillField doesn't - CodeCeption

笑着哭i 提交于 2019-12-10 04:23:00
问题 I am totally new to CodeCeption. I have the below html inside the body, <div><input type="text" name="content_id" id="contentId" maxlength="10" value="123"></div> In CodeCeption acceptance test I have a this below code `<?php $I = new AcceptanceTester($scenario); $I->wantTo('fillfield test'); $I->amOnPage('/'); $I->seeInField('#contentId', 123); $I->fillField('#contentId', 222397); ?>` seeInField Test passes successfully, but fillField throws an error Sorry, I couldn't fill field "#contentId"

Authorization header not making it through in Codeception API testing

会有一股神秘感。 提交于 2019-12-10 02:54:34
问题 I am attempting to test my Laravel 4 REST API using Codeception, but when I try to send through my Authorization header (using the $I->amBearerAuthenticated() function of the REST module) it is not making it through to the eventual request. From what I can see, the Symfony2 BrowserKit module modifies any headers added into the HTTP_XXX_XXX format, so the header being sent seems to be HTTP_AUTHORIZATION - when I output the received headers in my application, however, neither Authorization nor

Using parameter placeholders in codeception.yml

余生颓废 提交于 2019-12-09 12:41:45
问题 I'm setting up Codeception's Db module and would like to use the parameters from my Symfony 2's parameters.yml file. Basically something like this: paths: tests: tests log: tests/_log data: tests/_data helpers: tests/_helpers settings: bootstrap: _bootstrap.php suite_class: \PHPUnit_Framework_TestSuite colors: true memory_limit: 1024M log: true modules: config: Symfony2: app_path: 'app' var_path: 'app' environment: 'test' Db: dsn: "mysql:host='%test_database_host%';dbname='%test_database_name

Codeception - Acceptance tests work but Functional test don't

北战南征 提交于 2019-12-08 19:08:48
问题 I am running the latest version of Codeception on a WAMP platform - My acceptance is very basic however works fine (see below): $I = new WebGuy($scenario); $I->wantTo('Log in to the website'); $I->amOnPage('/auth/login'); $I->fillField('identity','admin@admin.com'); $I->fillField('password','password'); $I->click('Login'); In a nutshell - it checks the page is 'auth/login' fills out 2 form fields and clicks the login button. This works without any problems. Here is my identical functional