Codeception.com site can’t be reached
Codeception not clearing ["HTTP_X_REQUESTED_WITH"]
@staveleyhead-garethm wrote:
hi all - I have just updated/rebuilt a dev server and now codeception (phalcon module) is not clearing $SERVER between tests - I make a $I->sendAjaxGetRequest and then in the next test I call $I->amOnPage BUT the ["HTTPX_REQUESTED_WITH"] header is still set and the test fails. If I add public function before(FunctionalTester $I){$SERVER = [];} then the tests pass expected - why is codeception not clearing headers between tests all of a sudden?
Posts: 3
Participants: 2
How to create a date run folder in tests/_output
@Dmitry_Komarov wrote:
Hi I want to figure out, how I can add to default output new folder with date and time the build was runned, like this "tests/_output/01-12-2017-10-50/
Posts: 1
Participants: 1
grabTextFrom does not work from acceptence tests
@potemkin_graph wrote:
it should work? (webDriver selenium 2.53.1)
$I->moveMouseOver(['css' => '#inn_c']); $I->fillField('input[type=text]#inn_c','22dff222222'); $value = $I->grabTextFrom('#inn_c'); $I->assertEquals($value, '22222222');
assert say: $value = ""
Posts: 3
Participants: 2
Continue test execution after a test fails
@tilmp wrote:
Hello, how does I configure codeception environment to continue on test execution even if one (or more) of the tests of a test suite group etc. are failing?
Goal: Execute all of the tests of a group or suite etc.
Posts: 1
Participants: 1
Best practice?
@rebas wrote:
I use my tests in Cest formate.
For example when i need test e-shop.
E-shop have some special pages, something as:
home page, registration, category with goods, detail goods, basket, etc.In codeception, I have in pageObject for detail goods saved constant and function only for this page, different page have different page object.
When i need test different complete order, i use my cest test, where i have used StepObject. In this Step object i use function from page object. This is OK.
If i need create new function (i will like use in page object or step object or in cest test), where is best place create this new function? Is it in \tests_support\AcceptanceTester.php or \tests_support\Helper\Acceptance.php
Why i have this qustion... I doing this new function in acceptance tester - in this new function i use php function as work with strings, array, etc. To helper i write only function, which i can use in acceptance tester (for example
public function getActualTitle()
{
return $this->getModule('WebDriver')->webDriver->getTitle();
}My tester colleague doing almost everything to helper\acceptance.php
Who of us does it better?
Or do you have better idea?
Posts: 1
Participants: 1
Issue while setting up local testing environment with docker for parallel execution
@phptestbot wrote:
From @p-saxena on Mon Dec 05 2016 09:53:39 GMT-0500 (EST)
Hi All,I am trying to set up local testing environment with docker for parallel execution.
For this I pulled docker container for selenium grid, firefoxnode and chromenode from hub.docker.comI configured successfully the docker-compose.yml file to register firefox and chrome node on hub.
I see both these node on grid console.The issue I am facing is I am not able to launch my tests on any node registered on hub.
When I try to execute tests with the following command:
./vendor/bin/codecept run acceptance --env testing-de_DE
I get following exception:
[Facebook\WebDriver\Exception\UnknownCommandException] GET /session/8e9400ff-7c27-4f53-8e9f-0b4939f12654/log/types did not match a known command Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700' System info: host: '81377a00d579', ip: '172.17.0.4', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-34-generic', java.version: '1.8.0_91' Driver info: org.openqa.selenium.firefox.FirefoxDriver Capabilities [{rotatable=false, raisesAccessibilityExceptions=false, firefoxOptions={args=[], profile=UEsDBBQACAgIAGoyhUkAAAAAAAAAAAAAAAAHAAAAdXNlci5qc51WTW/bMAy971cMOW3AKqTretlOXdcBA4Z1aFDsKMgSbauRJ U0fcfPvR/mjSRNHbndKbJMS+fj4yOjBUeugfLconGnxiXhWQvdf6oo0TLXMAQHNCgVi8eFtyZSH91/exJ2nYAFtrHEhudTAVKj7Z4JGG8ln/DWE1rg1qUOwxNbS19uz9Nky788U6CrU6Pjx8vK52xiwAybwR0AAHkB8l86HK4yFK0C34OJhuKbBvB4pr51pgHrupA3U RU2DbJLLxXL6osAKTxAOfauvlfEwnc1oLUyrlWEC79KsSsDWpv1Tg14hWgmpaXeLQdng02W0MYKpGexhE4xRnoBzxnGjvVH7cB+n72WljUbUGmgKcKvu0edz8eC9RKtgkAsOfETcSgyUcsd8nfdVUq+JsaApPAZwmqlUzFczqExlvYt6+rIWCuHkBp8Z54DljBoz90g HysEFP4nEU6Wkt4ptQdycL1e/DDInlfbTtDG+Erf6j9RYX3++JBIvMvd3P9FjwQoTw+dCMb1eHHOuT4gypeiDRzBSnLKH/ji2RysRbrQlbS0DKOkDHvA3SneKCYkGaxnI0E0j6zC5xIUsAIphYbAB8lTzibfRkhq7xuLZtAXFUwdFl0q6OEg5VVt3rCHRYoGBaIS23N 6jyat1JNrUSjfZ8IBHJ8MWmaIA/xEfnOSBGicrqak1SvJtnqoaWmw7MuSTqeazQPuTSXq5ikUju1b53b286sj4Mt2cPCab8VN3DoVJRUHLE+q160NMs+34e9yIpizRDs6YtZ4g+0xLiy0VULKowrScjLBzbwf+TEd7zIcs20Y6I/dRqYLbkl4ZO/uPc7bZo0dEbu5/X pELwnZFOk7vgW1YPyGyonpYirFH8jw6jtvBQzfEspf0NE3H5/PcQ5zFYL71SrDiSIIkOufLUxran0o1C/hIYQM6zAyIvdF4ixSbjadQhq87UXtRpTwwx+uBN3NjtyE9u4mIjc1WDVn+Ii4+I4xBhJwU04p6JEKH6nMxvfr0an02th/SKMQZyAfbE9Iy7Djzy83e5PTd XN9NTpSg2Gl1FrlErekg9nrH9KOu24F+6Ot+TTm5nQ0zi3ZqJRBGXdGk/zMkqQHHJa+Br7/1gvW1//L6cUaYEDJFzGYmweTS/L/LsjJVlV4OW1xW+/d6qcv4GrUR27WQKrFPy6oO6sS023Mdb/wfaaNjI5AG98KOiIu0Szo4wGi3yqTVE4mNC+TMLrPre1X6aPsVYLd l/ANQSwcIy87bUaYDAAC2DAAAUEsBAhQAFAAICAgAajKFScvO21GmAwAAtgwAAAcAAAAAAAAAAAAAAAAAAAAAAHVzZXIuanNQSwUGAAAAAAEAAQA1AAAA2wMAAAAA}, appBuildId=20160922113459, version=49.0.1, platform=LINUX, proxy={}, co mmand_id=1, specificationLevel=0, acceptSslCerts=false, processId=171, browserVersion=49.0.1, platformVersion=4.4.0-34-generic, XULappId={ec8030f7-c20a-464f-9b0e-13a3a9e97384}, browserName=firefox, t akesScreenshot=true, takesElementScreenshot=true, platformName=linux, device=desktop, unexpectedAlertBehaviour=accept}] Session ID: 8e9400ff-7c27-4f53-8e9f-0b4939f12654
content of my docker-compose.yml file is:
seleniumhub: image: selenium/hub ports: - 4444 firefoxnode: image: selenium/node-firefox-debug ports: - 5555 links: - seleniumhub:hub chromenode: image: selenium/node-chrome-debug ports: - 5555 links: - seleniumhub:hub
content of acceptance.suite.yml file is:
class_name: AcceptanceTester modules: enabled: - WebDriver: host: localhost port: 4444 browser: firefox window_size: 1024x768 url: 'http://localhost/' capabilities: unexpectedAlertBehaviour: 'accept' - \Helper\EnvSpecificHelper - \Helper\DbHelper - Asserts - Db config: Db: dsn: user: password: populate: false cleanup: false dump: _data/migrations.sql \Helper\DbHelper: dsn: user: password: populate: false cleanup: false WebDriver: host: localhost port: 4444 browser: firefox url: 'http://localhost/' env: testing-de_DE: modules: config: WebDriver: host: localhost port: 4444 browser: firefox window_size: 1024x768 url: 'https://xxxx.com/de' capabilities: unexpectedAlertBehaviour: 'accept' \Helper\EnvSpecificHelper:
I have placed my env file 'testing-de_DE' in _envs folder and its content is:
modules: config: WebDriver: host: localhost port: 4444 browser: firefox window_size: 1024x768 url: 'https://xxxx.com/de' capabilities: unexpectedAlertBehaviour: 'accept' \Helper\EnvSpecificHelper: <<: *testingSimpleUrls_de_DE <<: *country_de_DE <<: *PDP <<: *NEWARRIVALS <<: *DISCOUNT <<: *Redirects <<: *TRADEIN <<: *RELATEDREFERENCES
- Codeception version: 5.4.8
- Operating System: Ubuntu 16.04
- Installation type: Composer
Copied from original issue: https://github.com/Codeception/Codeception/issues/3817
Posts: 2
Participants: 1
WebDriver Firefox rebuilding new Windows
@phptestbot wrote:
From @HankShi on Mon Apr 18 2016 04:03:58 GMT-0400 (EDT)
Sorry,I am not good at English,But I must need help from this community.I am writing Acceptance Test in CodeCeption....I have problem,when I use " $I->click('#artList li:nth-child(3) .news-title a')",but WebDriver Firefox rebuilding new Windows....So that ,I operation next page appear "Link or Button or CSS or XPath element with '.tfoot div.pull-right a:first-child' was not found",because the origin page is old html。。。So,I want know how resolve this problem??? # @NaktibaldaI have thought about setting the Firefox browser preferences,but accross webdriver open Firefox ,the Firefox browser preferences is reduced。。。。 @elazar @tuupola @diszad @samdark @grahamc
Copied from original issue: https://github.com/Codeception/Codeception/issues/3001
Posts: 2
Participants: 1
New to codeception - Can anyone let me know how to run codeception in safari and opera browsers from Windows 8.1
@phptestbot wrote:
From @rajabhaskar on Wed Dec 21 2016 01:00:10 GMT-0500 (EST)
Can you please let me know how I can run acceptance suite in safari browser in Windows 8.1. Below is my acceptance.yml file configuration. I tried --env safari and --env firefox by mentioning the env in acceptance suite. yml also but no luck. it's giving me error[Codeception\Exception\ConnectionException]
Curl error thrown for http POST to /session with params: {"desiredCapabilit
ies":{"unexpectedAlertBehaviour":"accept","handlesAlerts":true,"browserName
":"firefox"}}
Could not resolve host: selenium-hubPlease make sure that Selenium Server or PhantomJS is running.
But I do have selenium jar or phantom running aside already with below command
phantomjs --webdriver=4444 [OR] java -jar vendor/selenium/selenium-server/selenium-server-standalone-2.53.0.jarAcceprance.suite.yml
modules:
enabled:WebDriver
\Helper\Acceptance
\Helper\Locator
\Helper\User
\Helper\TestData
config:
WebDriver:
url: 'https://www.abc.com'
browser: safari
wait: 2
window_size: maximize
clear_cookies: false
capabilities:
unexpectedAlertBehaviour: 'accept'
handlesAlerts: true
but it is not working. If I replace the browser name with Chrome (and run executable) or firefox then I was able to run my suite. Please advise. (By the way, I do have safari installed manually in my machine - V5.1.7)
Thanks
- Codeception version: 2.2.1
- PHP Version:7.0.7
- Operating System: Windows 8.1
- Installation type: Phar || Composer
- List of installed packages (
composer show
)
behat/gherkin v4.4.5 Gherkin DSL parser for PHP 5.3
codeception/codeception 2.2.0 BDD-style testing framework
codeception/specify 0.4.5 BDD code blocks for PHPUnit and...
codeception/verify 0.3.2 BDD assertion library for PHPUnit
doctrine/instantiator 1.0.5 A small, lightweight utility to...
facebook/webdriver 1.2.0 A PHP client for WebDriver
flow/jsonpath 0.3.4 JSONPath implementation for par...
guzzlehttp/guzzle 6.2.2 Guzzle is a PHP HTTP client lib...
guzzlehttp/promises v1.3.1 Guzzle promises library
guzzlehttp/psr7 1.3.1 PSR-7 message implementation
justinrainbow/json-schema 4.0.1 A library to validate a json sc...
monolog/monolog 1.22.0 Sends your logs to files, socke...
myclabs/deep-copy 1.5.5 Create deep copies (clones) of ...
pdepend/pdepend 2.3.2 Official version of pdepend to ...
phpdocumentor/reflection-common 1.0 Common reflection classes used ...
phpdocumentor/reflection-docblock 3.1.1 With this component, a library ...
phpdocumentor/type-resolver 0.2.1
phpmd/phpmd 2.5.0 PHPMD is a spin-off project of ...
phpoffice/phpexcel 1.8.1 PHPExcel - OpenXML - Read, Crea...
phpspec/prophecy v1.6.2 Highly opinionated mocking fram...
phpunit/php-code-coverage 4.0.4 Library that provides collectio...
phpunit/php-file-iterator 1.4.2 FilterIterator implementation t...
phpunit/php-text-template 1.2.1 Simple template engine.
phpunit/php-timer 1.0.8 Utility class for timing
phpunit/php-token-stream 1.4.9 Wrapper around PHP's tokenizer ...
phpunit/phpunit 5.7.4 The PHP Unit Testing framework.
phpunit/phpunit-mock-objects 3.4.3 Mock Object library for PHPUnit
psr/http-message 1.0.1 Common interface for HTTP messages
psr/log 1.0.2 Common interface for logging li...
sebastian/code-unit-reverse-lookup 1.0.0 Looks up which function or meth...
sebastian/comparator 1.2.2 Provides the functionality to c...
sebastian/diff 1.4.1 Diff implementation
sebastian/environment 2.0.0 Provides functionality to handl...
sebastian/exporter 2.0.0 Provides the functionality to e...
sebastian/global-state 1.1.1 Snapshotting of global state
sebastian/object-enumerator 2.0.0 Traverses array structures and ...
sebastian/recursion-context 2.0.0 Provides functionality to recur...
sebastian/resource-operations 1.0.0 Provides a list of PHP built-in...
sebastian/version 2.0.1 Library that helps with managin...
selenium/chromedriver/linux64 2.21
selenium/chromedriver/mac32 2.21
selenium/chromedriver/win32 2.21
selenium/edgedriver 3.14393
selenium/opera 0.2.2
selenium/safari 2.48
selenium/selenium-server 2.53.0
squizlabs/php_codesniffer 2.7.1 PHP_CodeSniffer tokenizes PHP, ...
symfony/browser-kit v3.2.1 Symfony BrowserKit Component
symfony/config v3.2.1 Symfony Config Component
symfony/console v3.2.1 Symfony Console Component
symfony/css-selector v3.2.1 Symfony CssSelector Component
symfony/debug v3.2.1 Symfony Debug Component
symfony/dependency-injection v3.2.1 Symfony DependencyInjection Com...
symfony/dom-crawler v3.2.1 Symfony DomCrawler Component
symfony/event-dispatcher v3.2.1 Symfony EventDispatcher Component
symfony/filesystem v3.2.1 Symfony Filesystem Component
symfony/finder v3.2.1 Symfony Finder Component
symfony/http-foundation v3.2.1 Symfony HttpFoundation Component
symfony/http-kernel v3.2.1 Symfony HttpKernel Component
symfony/polyfill-mbstring v1.3.0 Symfony polyfill for the Mbstri...
symfony/process v3.2.1 Symfony Process Component
symfony/yaml v3.2.1 Symfony Yaml Component
webmozart/assert 1.2.0 Assertions to validate method i...# paste suite config here
Copied from original issue: https://github.com/Codeception/Codeception/issues/3856
Posts: 4
Participants: 1
Make http request with WebDriver
@davert wrote:
Case: make arbitrary HTTP requests within inside acceptance tests with WebDriver.
You can't do this with PhpBrowser, as it conflicts with WebDriver, but you can use REST module and its actions.REST should be enabled in your
acceptance.suite.yml
with dependency in PhpBrowser.class_name: AcceptanceTester modules: enabled: - WebDriver: host: 127.0.0.1 url: 'https://localhost' browser: phantomjs - REST: depends: PhpBrowser url: 'http://localhost'
after that methods like
->sendGetRequest
,sendPostRequests
, as well as all other REST methods, will be available for$I
.Thanks to @Naktibalda
Posts: 1
Participants: 1
REST Validating JSON Schema
@davert wrote:
To validate JSON repsonses in JSON schema you may need a JsonSchema module developed by Anton Cnam.
Install it with composer
composer require cnam/codeception-json-schema --dev
Enable it in config with REST module:
class_name: ApiTester modules: enabled: - JsonSchema - REST: depends: PhpBrowser part: Json
It adds new method
canSeeResponseIsValidOnSchemaFile($schema)
. Pass schema file as parameter to validate:// assume schema is stored in tests/_data/users.json $I->canSeeResponseIsValidOnSchemaFile(codecept_data_dir('users.json'));
See this example repository provided by Sven Hartmann
Posts: 1
Participants: 1
waitForElementVisible() not working in Safari
@CosetteN wrote:
I'm trying to bring a large Codeception acceptance test suite up to date using Selenium 3.0.1. I'm finding $I->waitForElementVisible() commands aren't working when running tests in Safari. $I->wait() & $I->waitForElement() both work.
Is anyone else experiencing this? Any suggestions beyond converting all of my waitForElementVisible() actions into other types of wait?
Posts: 1
Participants: 1
Unble to enter the values in the table using using codeception
@dora wrote:
This form is created by clicking a button. Cannnot enter the values using the following:-
/**
* @When the :arg1,:arg2,:arg3,:arg4 are entered
*/
public function theAreEntered($arg1, $arg2, $arg3, $arg4)
{$elements = $this->I->grabMultiple('//*[@id="intervals-table"]/tbody/tr'); $sortOrder = count($elements) - 1; $this->I->fillField('//*[@id="intervals-table"]/tbody/tr['.$sortOrder.']/td[1]/input', $arg1);-- not working $this->I->executeJS('document.getElementsByName(\'newAssignedIntervals['.$sortOrder.'][miles]\').value = '.$arg1.';'); $this->I->executeJS('document.getElementsByName(\'newAssignedIntervals['.$sortOrder.'][miles]\').value = '.$arg2.';'); $this->I->executeJS('document.getElementsByName(\'newAssignedIntervals['.$sortOrder.'][miles]\').value = '.$arg3.';'); $this->I->executeJS('document.getElementsByName(\'newAssignedIntervals['.$sortOrder.'][miles]\').value = '.$arg4.';');
Posts: 1
Participants: 1
Php vendor/bin/codecept bootstrap -> stange result?
@marcelloh wrote:
New to codeception. Installed it via composer. Running php 7.1.1 (64)
When I start the command (Running it from the terminal in Laragon):
php vendor/bin/codecept bootstrap stange result
I see this in my window:
dir=$(d=${0%[/\]*}; cd "$d"; cd "../codeception/codeception" && pwd)
See if we are running in Cygwin by checking for cygpath program
if command -v 'cygpath' >/dev/null 2>&1; then
# Cygwin paths start with /cygdrive/ which will break windows PHP,
# so we need to translate the dir path to windows format. However
# we could be using cygwin PHP which does not require this, so we
# test if the path to PHP starts with /cygdrive/ rather than /usr/bin
if [[ $(which php) == /cygdrive/* ]]; then
dir=$(cygpath -m "$dir");
fi
fidir=$(echo $dir | sed 's/ /\ /g')
"${dir}/codecept" "$@"Which doesn't seem like a normal informational screen to me, saying it did it's job.
(I kindof miss the specific information in the documentation, in what the result of running that command would be.)Any help would be appreciated
Posts: 1
Participants: 1
How transformation array id in array boolean
@Dima_Naglyuk wrote:
Hello 2all
I have a task to transformation array id in array boolean for my test.
example:
in php : 'week_days' = [0,1,2,3,4,5,6]
but in dataBase line
'wd' have type boolean [t,t,t,t,t,t,t],
or
'week_days' = [0,1,4,5,6]
'wd' boolean [t,t,f,f,t,t,t]Tell me please
Posts: 1
Participants: 1
BDD Documentation & examples
@carltondickson wrote:
I'm trying to understand how to use the BDD part of Codeception but I'm finding that the BDD documentation is not as well put together as the other sections and sometimes doesn't make sense (perhaps due to bad translations?)
I don't want this to sound too negative but wanted to highlight this as the rest of the Codeception documentation is really good.
Can anyone recommend any resources that show examples on how to use BDD in Codeception as resources/example are lacking and it's proving difficult to learn and implement something useful.
Posts: 1
Participants: 1
Using tags issue
@wojtusthc wrote:
I need test one feature on two difference contexts,
./codecept gherkin:steps acceptance
Steps from tag:domain context:
+----------+-----------------------------------------------------------------+
| Step | Implementation |
+----------+-----------------------------------------------------------------+
| testcase | Step\Acceptance\Domain\DomainUseCase::testcase |
+----------+-----------------------------------------------------------------+
Steps from tag:app context:
+----------+-----------------------------------------------------------+
| Step | Implementation |
+----------+-----------------------------------------------------------+
| testcase | Step\Acceptance\App\AppUseCase::testcase |
+----------+-----------------------------------------------------------+
my feature file contains :
@app @domainmy config:
gherkin:
contexts:
default:
- AcceptanceTester
tag:
domain:
- Step\Acceptance\Domain\DomainUseCase
app:
- Step\Acceptance\App\AppUseCasebut when I run test with "-g app" it always use domain context.
I debug it and
/codeception/src/Codeception/Test/Loader/Gherkin.php:155
always override stepsDo you know how fix it?
Or maybe I doing it wrong?
Posts: 1
Participants: 1
How can I move the element (left and right) in codeception
@s.alex wrote:
Hi everyone! I have a task the following:
The client has a map for example
I need to click on this element and move right and left
I use dropAndDrove and moveOverMouse ,but they do not work
I think I need to use Selenium Action
1. clickOnHold
2. moveToElement
3. moveByOffsetbut I'm not sure for this solution. If somebody knows how can do it, please will help me
Posts: 1
Participants: 1
Codeception build with MailCatcher
@codecepter wrote:
I am trying to build with MailCatcher on codeception.
Essentially I am trying to run this
php codecep.phar build
But it keeps coming with this error.
[Codeception\Exception\ConfigurationException]
Module MailCatcher could not be found and loadedI am following the instructions here https://github.com/captbaritone/codeception-mailcatcher-module
Question:
1) What am I doing wrong?
2) Can I get a .phar file with MailCatcher add on?
Posts: 1
Participants: 1
Clean the auto_increment of tables after running CEST test
@anarela wrote:
I'm new at codeception testing and so far I found it very useful and easy.
Right now I finished a CRUD test but I realized that every time my test run it increment the value of the id of my table. I could run a DB script after I finished my tests so I can reset the value of the id but I think it would be great if I can do it in the "_after" method of my own class.
How can I achieve this? I tried calling a method in my model that finds the last id and execute a unprepared statement in database but when I try to inject that model class in my cest it always throws an error: A facade root has not been set.
I think the best option is injecting my class but I don't get this to work and I don't know if there is another way to do this.
Thanks in advance for your help.
Posts: 2
Participants: 2