Webception / webdriver / ftp - php

I use Codeception with webdriver and use command line to start tests. I try to use webception to show it on a web-application for my colleagues so I deployed webception on my FTP but i have problems with piloting selenium. I didnt succeed to run the test from my ftp with webcept.
[WebDriverCurlException]
Curl error thrown for http POST to http://127.0.0.1:4444/wd/hub/session with params: {"desiredCapabilities":{"unexpectedAlertBehaviour":"accept","browserName":"firefox"}}
couldn't connect to host
Here is my acceptance.suit.yml :
class_name: WebGuy
modules:
enabled:
#- PhpBrowser
- WebHelper
- REST
- WebDriver
config:
REST:
url: 'http://theAddress/'
timeout: 90
PhpBrowser:
url: 'http://theAddress/'
curl:
CURLOPT_RETURNTRANSFER: true
CURLOPT_FOLLOWLOCATION: true
WebDriver:
url: 'http://theAddress/'
browser: firefox
capabilities:
unexpectedAlertBehaviour: 'accept'
Any suggestions will be welcome. thank you

Try to run Selenium manually. Download Selenium Server here Selenium Downloads , then in the command line, navigate to the folder where the file has been downloaded and type:
java -jar selenium-server-standalone-W.XY.Z.jar
Now, Selenium should be running on the 4444 port. After that, try to run your test again.

Related

Codeception Acceptance Tests not working

everyone!
I have been trying to configure Codeception 2.3.6 with Laravel 5.3.30 running on PHP 7.0.23 powered by WAMP 3.1.0. My functional test cases are running fine, but when I try to run my acceptance test cases, a new chrome window opens and then closes without doing anything.
The output in the HTML Report is Codeception Results OK(0s), while the output on the command line is:
WelcomeCept: Perform actions and see result (0.00s)
Time: 3.24 seconds, Memory: 22.75MB
OK (1 test, 0 assertions)
HTML report generated in file://D:\wamp\www\myApp\tests/_output\report.html
First I start ChromeDriver with the command
chromedriver --url-base=/wd/hub
Then I start Selenium Standalone Server 3.13.0 with the command:
java -Dwebdriver.chrome.driver="chromedriver" -jar selenium-server-standalone-3.13.0.jar -port 4445
Then I run my acceptance test suite which contains a single test file, with the command:
call vendor/bin/codecept run acceptance --html
My acceptance.suite.yml is:
class_name: AcceptanceTester
modules:
enabled:
- WebDriver:
url: http://lcms.com/
window_size: false # disabled in ChromeDriver
port: 9515
browser: 'chrome'
restart: true
wait: 200
capabilities:
unexpectedAlertBehaviour: 'accept'
webStorageEnabled: true
javascriptEnabled: true
- Laravel5:
part: ORM
cleanup: false # can't wrap into transaction
environment_file: .env
- \Helper\Acceptance
My WelcomeCept.php file, just for testing the configuration, is:
<?php
class WelcomeCept
{
public function welcomeTest(AcceptanceTester $I)
{
$I->wantTo('perform actions and see result');
}
}
Please review my workflow and let me know if I'm doing things incorrectly or am missing something.
Thanks!
Update: Same thing is happening using GeckoDriver or PhantomJS in WebDriver mode. The tests are passing with OK but not performing any actions.
Solved! I tried WelcomeCest instead of WelcomeCept and things have fallen into place.

How to made to work Codeception + facebook webdriver agent?

okay, i'm setup appium 1.6.3 server on my mac, webdriver agent inspector works great on real device. now i have this config in codeception yml file:
actor: AcceptanceTester
modules:
enabled:
- \Helper\Acceptance
- \Appium\AppiumDriver:
host: 0.0.0.0
port: 4723
dummyRemote: false
resetAfterSuite: true
resetAfterCest: false
resetAfterTest: false
resetAfterStep: false
capabilities:
app : '/Users/kirill/Documents/iCanDeliver/Deliver.app'
platformName : 'ios'
platformVersion : '10.3'
deviceName : 'iPhone (Kirill)'
automationName : 'XCUITest'
udid: c57bcfcc08ee2485d02f30298dc98bef808a39a5
when I concept run any script appium server unlock the real device, deploy app, deploy webdriveragent, connect to webdriveragent, starting app OK,
but how to writing cases? maybe I made something wrong, there is no any info about codeception-webdriveragent.
Thanks!

Codeception\Extension\RunProcess not starting processes

PROBLEM:
Yesterday Codeception introduced new extension which should help with starting/stopping Selenium Server, Chrome Driver, etc (more here). However, even it shows that processes are starting - they're actually not.
acceptance.suite.yml
class_name: AcceptanceTester
modules:
enabled:
- WebDriver:
url: http://127.0.0.1:8080/
browser: chrome
- Yii2:
part: orm
entryScript: index-test.php
cleanup: false
extensions:
enabled:
- Codeception\Extension\RunProcess:
- java -jar /home/tajgeer/.executables/bin/selenium-server.jar
- php /home/tajgeer/Repozytoria/Yii2/yii serve
output:
Acceptance Tests (5)
[RunProcess] Starting java -jar /home/tajgeer/.executables/bin/selenium-server.jar
[RunProcess] Starting php /home/tajgeer/Repozytoria/Yii2/yii serve
E AboutCest: Ensure that about works
E ContactCest: Ensure that contact page works
E ContactCest: Contact form can be submitted
E HomeCest: Ensure that home page works
E LoginCest: Ensure that login works
[RunProcess] Stopping php /home/tajgeer/Repozytoria/Yii2/yii serve
[RunProcess] Stopping java -jar /home/tajgeer/.executables/bin/selenium-server.jar
example error:
[ConnectionException] Can't connect to Webdriver at http://127.0.0.1:4444/wd/hub. Please make sure that Selenium Server or PhantomJS is running.
I've already tried to set o+x permissions on both execs - didn't change anything. When I'm trying to run both tools by using entered commands - everything works well.
Could anyone point out what am I doing wrong?
SOLUTION:
Actually... I've solved it on my own. I've forgot about sleep (processes didn't even had a chance to run as tests were very quick). I've changed acceptance.suite.xml to following:
class_name: AcceptanceTester
modules:
enabled:
- WebDriver:
url: http://127.0.0.1:8080/
browser: chrome
- Yii2:
part: orm
entryScript: index-test.php
cleanup: false
extensions:
enabled:
- Codeception\Extension\RunProcess:
0: java -jar /home/tajgeer/.executables/bin/selenium-server.jar
1: php /home/tajgeer/Repozytoria/Yii2/yii serve
sleep: 5

Test multiple urls (files) with codeception and log separate results

I'm trying to create a small test suite for a homework assignment, using Codeception. My idea is to apply a single Cest test scenario to multiple URLs and get the different results, which I can then log by some identification (for example name of the file).
There are two main things I can't figure out:
How to run a single test with different URL and log failed assertions/passed assertions for every test?
How to check every assertion, even if some of them fail?
First part:
I assume you are using Codeception with Selenium.
You can configure this in acceptance.suite.yml:
class_name: AcceptanceTester
modules:
enabled:
- WebDriver
- AcceptanceHelper
config:
WebDriver:
url: 'http://localhost.dev:8000/'
browser: 'firefox'
env:
url1:
modules:
config:
WebDriver:
url: 'http://url-1.dev/'
browser: 'chrome'
url2:
modules:
config:
WebDriver:
url: 'http://url-2.dev/'
browser: 'chrome'
url3:
modules:
config:
WebDriver:
url: 'http://url-3.dev/'
browser: 'chrome'
Then invoke the tests like this:
$ php codecept.phar run acceptance --env url1 --env url2 --env url3
For more details: http://codeception.com/docs/07-AdvancedUsage#Environments
Second part:
If an assertion fails, testing still continues with the subsequent environments. You can also use conditional assertions (those that start with canSee and cantSee), which will allow the test to continue even if the assertion fails.
For more details: http://codeception.com/docs/03-AcceptanceTests#Conditional-Assertions

Codeception + Selenium server- browser (chrome) pops up, but web page is always white

Using the latest Codeception.
Tried selenium server 2.40.0 and 2.42.2
Snippit of Config:
enabled:
- WebDriver
WebDriver:
url: 'foo'
browser: chrome
I have chrome web driver in my path.
From cmd line, I kick off the selenium server
java -jar C:\...\vendor\selenium\selenium-server-standalone-2.42.2.jar
From cmd line2,
run acceptance fooCept.php
Chrome opens, but the page is always blank. If I was only running one step, I remember not being able to see anything on the page because it was too quick. But with my latest go around with Codeception, I cannot get to see the web page when I over 30 steps.
Your config syntax is not correct. Try this in acceptance.suite.yml:
modules:
enabled:
- WebDriver
config:
WebDriver:
url: 'http://your.site.dev'
browser: 'chrome'
PHPBrowser was also enabled in the acceptance.suite.yml. Once I removed this, it worked.

Categories