Apache/2.4.23 (Win32) mod_authnz_sspi/0.1.0 OpenSSL/1.0.2h PHP/7.0.10
PHP version: 7.0.10 info
Document Root: C:/laragon/www
Closed haakym closed 6 years ago
Related?
https://github.com/Codeception/Codeception/issues/2651
If this is an issue with proxy settings, how or where can I set them?
Thanks a lot @haakym If this is in your test case
$this->visit('/')
->see('Laravel')
->hold(3);
Then test will fail because it's looking for Laravel
and your body contain Laragon
Also, it seems the problem is not related to baseUrl because phpunit is not able to decode json PHPUnit_Extensions_Selenium2TestCase_Exception: JSON decoding of remote response failed.
Also, your tag at <title>Laragon</title
is not been close properly.
@Modelizer
Thanks for your reply! I'm not sure you fully understood my issue, I will try to explain in more detail.
The test fails because it's hitting the wrong URL which gives different content to what is expected. I'm using a WAMP app called Laragon and that's the splash page which is shown at http://localhost
.
I thought the issue was related to the baseUrl because it was going to http://localhost
instead of my desired URL: http://modelizer-selenium.dev
After googling some of the output after running phpunit
I now believe the issue is related to the chrome webdriver and proxy settings (I'm behind a proxy at my work place), as others were having issues using codeception and the chrome webdriver here: https://github.com/Codeception/Codeception/issues/3042 and here https://github.com/Codeception/Codeception/issues/2651
How would I be able to set the proxy settings to resolve this issue?
Okay.
What if we provide an option which will be loaded when selenium server is started.
Example PHP artisan selenium:start --proxy-server=192.168.1.1
Will this help you? Because right now I think we need to tell selenium which proxy needs to be loaded, check this out.
This issue is new for me correct me if I'm wrong :)
@Modelizer
Sorry for the late reply.
What if we provide an option which will be loaded when selenium server is started. Example PHP artisan selenium:start --proxy-server=192.168.1.1
Will this help you?
Yes, that looks good! To be honest, it's new for me too.
@Modelizer - awesome, I'll give this a try soon and will be sure to give feedback
closing this issue for now.
@Modelizer I've done the following...
laravel new seleniumtest
now if I go to http://seleniumtest.dev/
I see the following in my browser:
composer require modelizer/selenium "~1.0"
add to .env:
APP_URL="http://seleniumtest.dev/"
SELENIUM_WIDTH=1024
SELENIUM_HEIGHT=768
add to app.php
Modelizer\Selenium\SeleniumServiceProvider::class,
php artisan selenium:make:test SeleniumExampleTest
add to SeleniumExampleTest.php:
public function testBasicExample()
{
// This is a sample code you can change as per your current scenario
$this->visit('/')
->see('Laravel')
->hold(3);
}
create file: config/selenium.php
with following content:
<?php
return [ 'proxyInjectionMode' => true ];
Unsure I am doing the correct thing here?
8. `php artisan selenium:start`
When running `phpunit` I get the same issue as before:
- the tests appear to be hitting the server software splash page on `http://localhost` not `http://seleniumtest.dev`
PHPUnit 5.6.5 by Sebastian Bergmann and contributors.
.E 2 / 2 (100%)
Time: 234 ms, Memory: 10.00MB
There was 1 error:
1) SeleniumExampleTest::testBasicExample
PHPUnit_Extensions_Selenium2TestCase_Exception: JSON decoding of remote response failed.
Error code: 4
The response: '<!DOCTYPE html>
ping @jhoopes @chrispecoraro Have you guys have any idea what is going on? :thinking:
I think if we able to pass a correct APP_URL
in the proxy environment will solve this issue.
Just to add some further context if you didn't read my first few posts on this issue, I am using this package at work where we're behind a proxy and thought this was causing the issue as googling similar errors brought up results related to proxy settings for selenium?
@haakym try removing the trailing forward slash from the APP_URL... APP_URL="http://seleniumtest.dev/" => APP_URL="http://seleniumtest.dev" And then with testing, omit first forward slash also, ie $this->visit('foo') instead of $this->visit('/foo')
Upgrading to 2.0 should solve this problem.
Hi. Firstly, great idea for a package I look forward to seeing it develop further!
I'm developing locally using Laragon on Windows 7 for which I used to start up a fresh install of Laravel 5.3 and pulled in the package and then followed the installation instructions from the readme.
I've added the following values to my
.env
file:APP_URL="http://modelizer-selenium.dev/" SELENIUM_WIDTH=1024 SELENIUM_HEIGHT=768
Then when I run the selenium server and phpunit it hits localhost and not http://modelizer-selenium.dev/, this is what I've got in the console which is the Laragon splash page which is returned when you hit localhost:
I also tried adding the following to my phpunit.xml:
this to my tests/TestCase.php:
The failing test looks like this:
Any ideas? Thanks!