selenium - Selenium2 with PhantomJS and PHPUnit - session/cookie issue -
i have setup current project run selenium , phantomjs. (similar setup http://www.nuanced.it/2015/05/using-phantomjs-with-phpunit.html)
however keep on getting following error
{"errormessage":"can set cookies current domain","request":{"headers":{"accept":"application/json;charset=utf-8","content-length":"135","content-type":"application/json;charset=utf-8","host":"127.0.0.1:8080"},"httpversion":"1.1","method":"post","post":"{\"cookie\":{\"name\":\"phpunit_selenium_test_id\",\"value\":\"pepperleaf\\\\webbundle\\\\tests\\\\myproject\\\\testfirsttest__testtitle\",\"secure\":false}}","url":"/cookie","urlparsed":{"anchor":"","query":"","file":"cookie","directory":"/","path":"/cookie","relative":"/cookie","port":"","host":"","password":"","user":"","userinfo":"","authority":"","protocol":"","source":"/cookie","querykey":{},"chunks":["cookie"]},"urloriginal":"/session/0d022670-4f79-11e5-abbe-01f06bc40b42/cookie"}}
output phantomjs
[info - 2015-08-31t00:41:02.249z] hub register - register - registered grid hub: http://127.0.0.1:4444/ (ok) [info - 2015-08-31t00:41:43.258z] session [0d022670-4f79-11e5-abbe-01f06bc40b42] - page.settings - {"xssauditingenabled":false,"javascriptcanclosewindows":true,"javascriptcanopenwindows":true,"javascriptenabled":true,"loadimages":true,"localtoremoteurlaccessenabled":false,"useragent":"mozilla/5.0 (macintosh; intel mac os x) applewebkit/538.1 (khtml, gecko) phantomjs/2.0.0 safari/538.1","websecurityenabled":true} [info - 2015-08-31t00:41:43.258z] session [0d022670-4f79-11e5-abbe-01f06bc40b42] - page.customheaders: - {} [info - 2015-08-31t00:41:43.258z] session [0d022670-4f79-11e5-abbe-01f06bc40b42] - session.negotiatedcapabilities - {"browsername":"phantomjs","version":"2.0.0","drivername":"ghostdriver","driverversion":"1.2.0","platform":"mac-10.9 (mavericks)-64bit","javascriptenabled":true,"takesscreenshot":true,"handlesalerts":false,"databaseenabled":false,"locationcontextenabled":false,"applicationcacheenabled":false,"browserconnectionenabled":false,"cssselectorsenabled":true,"webstorageenabled":false,"rotatable":false,"acceptsslcerts":false,"nativeevents":true,"proxy":{"proxytype":"direct"}} [info - 2015-08-31t00:41:43.258z] sessionmanagerreqhand - _postnewsessioncommand - new session created: 0d022670-4f79-11e5-abbe-01f06bc40b42
code run on phpunit
class testfirsttest extends \phpunit_extensions_selenium2testcase { /** * {@inheritdoc} */ protected function setup() { $this->setbrowser('phantomjs'); $this->sethost("127.0.0.1"); $this->setport(8080); $this->setbrowserurl('http://www.mywebsite.dev/'); } public function testtitle() { $this->url('/'); $this->asserttitle('example www page'); } }
disclaimer: i'm quite new front end testing, first go @ this. i'm confused why happening i'm not setting nor creating cookies/sessions.
i'm not sure has caused problem. however, symfony/phpunit.xml (this has caused problems)
<!-- http://www.phpunit.de/manual/current/en/appendixes.configuration.html --> <phpunit backupglobals = "false" backupstaticattributes = "false" colors = "false" converterrorstoexceptions = "true" convertnoticestoexceptions = "true" convertwarningstoexceptions = "true" processisolation = "false" stoponfailure = "false" syntaxcheck = "false" bootstrap = "../app/bootstrap.php.cache" > <testsuites> <testsuite name="pepperleaf"> <directory>../src/*/*bundle/tests</directory> <directory>../src/*/bundle/*bundle/tests</directory> </testsuite> </testsuites> <php> <server name="kernel_dir" value="app/" /> <ini name="memory_limit" value="2048m" /> <ini name="xdebug.max_nesting_level" value="500" /> </php> <filter> <whitelist adduncoveredfilesfromwhitelist="true"> <directory suffix=".php">../src</directory> <exclude> <directory>../src/*/*bundle/resources</directory> <directory>../src/*/*bundle/tests</directory> <directory>../src/*/bundle/*bundle/resources</directory> <directory>../src/*/bundle/*bundle/tests</directory> <directory>../src/*/bundle/*bundle/fronttests</directory> <directory>../src/*/bundle/*bundle/datafixtures</directory> </exclude> </whitelist> </filter> <logging> <log type="coverage-html" target="coverage" /> <log type="coverage-xml" target="coverage/xml" /> <log type="coverage-clover" target="logs/clover.xml" /> <log type="coverage-crap4j" target="logs/crap4j.xml" /> <log type="junit" target="logs/junit.xml" logincompleteskipped="false" /> </logging> </phpunit>
this updated (working phpunit.xml script works). i'm not sure caused problem above.
<?xml version="1.0" encoding="utf-8"?> <!-- http://www.phpunit.de/manual/current/en/appendixes.configuration.html --> <phpunit> <testsuites> <testsuite name="pepperleaf_frontend"> <directory>../src/*/*bundle/fronttests</directory> </testsuite> </testsuites> <php> <server name="kernel_dir" value="app/" /> <ini name="memory_limit" value="2048m" /> <ini name="xdebug.max_nesting_level" value="500" /> </php> <filter> <whitelist adduncoveredfilesfromwhitelist="true"> <directory suffix=".php">../src</directory> <exclude> <directory>../src/*/*bundle/resources</directory> <directory>../src/*/*bundle/tests</directory> <directory>../src/*/bundle/*bundle/resources</directory> <directory>../src/*/bundle/*bundle/tests</directory> <directory>../src/*/bundle/*bundle/datafixtures</directory> <directory>../src/*/*bundle/fronttests</directory> </exclude> </whitelist> </filter> </phpunit>
Comments
Post a Comment