Closed JenniferZhou1999 closed 6 years ago
Does your /
page actually contain "Laravel"? Does it work when you use APP_URL=http://localhost
?
I changed APP_URL to APP_URL=http://localhost and then typed in php artisan dusk. However, I still get the same error.
What does the screenshot in tests/Browser/screenshots
show?
My tests/Browser/screenshots/failure-testBasicExample-0.png file only shows a blank white space.
Are you running php artisan dusk
in Homestead (via SSH) or on your host machine?
I always cd into my MarketPlace project and then run php artisan dusk (I do not run php artisan dusk in my homestead folder), so I believe my host machine.
http://market.test
works in your browser? Is the screenshot also blank when you run Dusk with the original APP_URL=http://market.test
?
http://market.test does work in my browser(my website shows up as it should). When I run php artisan dusk with the original APP_URL=http://market.test, a screenshot of the home page of my website shows up in the file.
Does your home page actually contain the word "Laravel"? The example test is meant to work with the default welcome page.
My home page no longer contains the word "Laravel". I changed the words in the title tag to Cypress. (I have included my welcome.blade.php below). Does that mean the reason the test is outputting error, is because I was using a test that is testing a file that does not exist?
`
<!DOCTYPE html>
Did not see expected text [Laravel] within element [body].
As the error message says, the test fails because the given text doesn't appear on the page.
You have to change it to something like ->assertSee('Cypress')
.
Thank you so much! I do not know how I did not figure that out! Thank you!
I just downloaded Laravel Dusk and when I typed php artisan dusk in my project folder, I received this error.
1) Tests\Browser\ExampleTest::testBasicExample Did not see expected text [Laravel] within element [body]. Failed asserting that false is true.
/Users/jenniferzhou/Documents/Cypress/MarketPlace/vendor/laravel/dusk/src/Concerns/MakesAssertions.php:348 /Users/jenniferzhou/Documents/Cypress/MarketPlace/vendor/laravel/dusk/src/Concerns/MakesAssertions.php:319 /Users/jenniferzhou/Documents/Cypress/MarketPlace/tests/Browser/ExampleTest.php:20 /Users/jenniferzhou/Documents/Cypress/MarketPlace/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:67 /Users/jenniferzhou/Documents/Cypress/MarketPlace/tests/Browser/ExampleTest.php:21
FAILURES! Tests: 1, Assertions: 1, Failures: 1.
I have tried everything I saw online, but cannot seem to fix my problem.
This is my DuskTestCase.php file:
`<?php
namespace Tests;
use Laravel\Dusk\TestCase as BaseTestCase; use Facebook\WebDriver\Chrome\ChromeOptions; use Facebook\WebDriver\Remote\RemoteWebDriver; use Facebook\WebDriver\Remote\DesiredCapabilities;
abstract class DuskTestCase extends BaseTestCase { use CreatesApplication;
} `
This is my .env file
`APP_NAME=Laravel APP_ENV=local APP_KEY=base64:aXlPbKtuLqJ8sRrr2i7gEyUlWWvoaED/iYdVTTujsS8= APP_DEBUG=true APP_LOG_LEVEL=debug APP_URL=http://market.test
DB_CONNECTION=mysql DB_HOST=market.test DB_PORT=3306 DB_DATABASE=market DB_USERNAME=homestead DB_PASSWORD=secret
BROADCAST_DRIVER=log CACHE_DRIVER=file SESSION_DRIVER=file SESSION_LIFETIME=120 QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1 REDIS_PASSWORD=null REDIS_PORT=6379
MAIL_DRIVER=smtp MAIL_HOST=smtp.mailtrap.io MAIL_PORT=2525 MAIL_USERNAME=null MAIL_PASSWORD=null MAIL_ENCRYPTION=null
PUSHER_APP_ID= PUSHER_APP_KEY= PUSHER_APP_SECRET= PUSHER_APP_CLUSTER=mt1 `
Based on what I have read, it may be a problem with the APP_URL in my .env file. However, I do not want to change that, because I want to be able to access my project by typing in market.test in the browser. Is there any other way to fix this issue? Thank you!