Before you begin automation testing with Selenium, you would need to:
-
Make sure that you have the latest PHP installed on your system. You can download and install PHP using following commands in the terminal:
- MacOS:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" brew install php
or if you already have Homebrew package manager
brew install php
-
Download composer in the project directory (Linux/MacOS, Windows).
Note: To use the composer command directly, it either should have been downloaded in the project directory or should be accessible globally which can be done by the command below:
mv composer.phar /usr/local/bin/composer
Step 1: Clone this repository and go to crocoblock-automation folder:
git clone https://github.com/Crocoblock/crocoblock-automation
cd crocoblock-automation
Step 2: Install the composer dependencies in the current project directory using the command below:
composer install
Make sure you have your LambdaTest credentials with you to run test automation scripts on LambdaTest Selenium Grid. You can obtain these credentials from the LambdaTest Automation Dashboard or through LambdaTest Profile.
Step 3: Set LambdaTest username
and access_key
into config.json.
Create in folder crocoblock-automation file config.json with next content
{
"username": "YOUR_USERNAME",
"access_key": "YOUR_ACCESS_KEY"
}
Step 4: The tests can be executed in the terminal using the following command:
php dispatch-tests.php
Your test results would be displayed on the test console (or command-line interface if you are using terminal/cmd) and on LambdaTest automation dashboard.
![image](https://private-user-images.githubusercontent.com/4987981/271245976-6d1bc3d8-c232-404d-be1e-8ff3f7903c66.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjUyODU1OTMsIm5iZiI6MTcyNTI4NTI5MywicGF0aCI6Ii80OTg3OTgxLzI3MTI0NTk3Ni02ZDFiYzNkOC1jMjMyLTQwNGQtYmUxZS04ZmYzZjc5MDNjNjYucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDkwMiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA5MDJUMTM1NDUzWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MTcwYjIwYTYwODZhMzA1MDY5NWM3YWFiMDc0MDY4NDM5ZTMyNjgyNjJjMjViYzE4ZTE0Zjk0YzEwMTA5MTM5MyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.iQGZP7UlT4P1I5s83OAa2qxVyWNu7lVWkDBoyFDDVD0)
1. Run CMD as administrator
2. Paste this code to install choco
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
3. Restart CMD as administrator and run this command
choco install php
4. Restart CMD as administrator and run this command
choco install composer
5.* Restart CMD as administrator and run this command
choco install git
6. Clone the repository to your computer by creating the necessary folder for this in advance and going to it
git clone https://github.com/Crocoblock/crocoblock-automation.git
7. In the folder with the project, run the command
composer update
Note: Most likely we will receive a message that you need to install the extension for the zip archive, you can simply enable it in the php.ini file where php itself is installed. There will be a hint where to look at the file location
8. Enable zip extension, in the file php.ini itself you just need to remove the ";" before the name of the extension. Next, run the command again
composer update
9. In the project folder, create a config.json file with the following contents
{
"username": "YOUR_USERNAME",
"access_key": "YOUR_ACCESS_KEY"
}
Note: take your login and access key from your LambdaTest account
10. Run the test
php dispatch-tests.php
11. If the test does not run due to an error in the ssl certificate, then take the following steps. Download this file cacert.pem Save it in the project folder. In the php.ini file, write the path to the cacert.pem file here
12. Run the test
php dispatch-tests.php