Laravel application with an authentication starter kit laravel breeze, cypress tests and homestead development environment.
These instructions will get you a copy of the project up and running on your virtual box for development and testing purposes.
- Vagrant (2.2.1+)
- VirtualBox
- Make sure that
IP Address and URL
are added at the bottom of the hosts file. The directory of the host file isC:/Windows/System32/drivers/etc/hosts
. It is very important that these match with the site name in theHomestead.yaml
file.
192.168.10.10 homestead.test
- Clone the repository and change the
map:
path to your projectdirectory
inHomestead.yaml
file.
folders:
-
map: 'C:\laravel-apps\sphera-assessment'
to: /home/vagrant/code
- Run
vagrant up
in the project directory. - After provisioning you can access the application:
- through the URL - http://homestead.test/
- To get access to the box and the features provided by Homestead, SSH into it, then change to the
code
directory:
vagrant ssh
cd code
From here, you can run NPM, composer, git and more. You can also run Laravel commands with:
php artisan
Run this command in the project directory to generate database migrations
php artisan migrate
Homestead by default creates a database with name homestead
and credentials homestead / secret
. This application uses the default homestead
database.
To connect to the mysql database from ssh run this from the code
directory:
mysql -u homestead -p
password: secret
To view database:
SHOW DATABASES;
To run Cypress
tests
- Run
npm install
fromcode
directory to install the node modules. This installs all node modules from package.json. Includescypress@6.3.0
.
npm install
- Make sure the application is up and running. To serve application run this command from
code
directory:
php artisan serve
- Once the application is up. Run Cypress tests from
code
directory:
npx cypress run
This automatically runs Authentication.spec.js
file with Electron browser in the command line.
Please wait until all tests finish executing. Once it is completed the result can be seen in the command line.
- Xvfb dependency error
Your system is missing the dependency: Xvfb
Install Xvfb and run Cypress again.
Read our documentation on dependencies for more information:
https://on.cypress.io/required-dependencies
If you are using Docker, we provide containers with all required dependencies installed.
----------
Error: spawn Xvfb ENOENT
----------
Platform: linux (Ubuntu - 20.04)
Cypress Version: 6.3.0
This issue can be solved by installing Xvbf in linux from code
directory:
sudo apt-get install xvfb
- Cypress verification time out error
Cypress verification timed out.
This command failed with the following output:
/home/vagrant/.cache/Cypress/6.3.0/Cypress/Cypress --no-sandbox --smoke-test --ping=827
----------
Command timed out after 30000 milliseconds: /home/vagrant/.cache/Cypress/6.3.0/Cypress/Cypress --no-sandbox --smoke-test --ping=827
Timed out
----------
Platform: linux (Ubuntu - 20.04)
Cypress Version: 6.3.0
This issue can be solved by executing the below command from code
directory:
npx cypress verify
- Laravel - The web framework used
- Cypress - Cypress test runner
- Node.js - Javascript runtime environment
Full official documentation of original Homestead project is located here.