How can we setup and run locally?
-
If you don’t have Visual Studio on your system, first we need to install it from this link: https://code.visualstudio.com/download.
-
If you don’t have git in your system, we need to install git from this link for Windows: https://git-scm.com/download/win; for Mac: https://git-scm.com/download/mac.
-
Copy the repository link: https://github.com/anishcb/crowdbotics_automation.git Go to any location on your system where you want to store your project.
-
Open your git bash command.
-
Type the command Git clone https://github.com/anishcb/crowdbotics_automation.git and click the enter keyword.
-
Then check your system location to see where you want to store the project.
-
Open Visual Studio and click on the file option, which is available at the top of the IDE.
-
Select the Open Folder option.
-
Browser your project and open it in Visual Studio.
-
Open your terminal, which is available at the bottom of Visual Studio.
-
Install Cypress using this command: npm install cypress --save-dev.
-
Now your system is ready for coding.
-
If you want to run your project, you will use this command: npx cypress open.
-
Open your Cypress open screen, then select the E2E Testing Option.
-
Select the browser in which you want to execute.
-
Select your spec file so your test will automatically start.
How can you run the code from GitHub actions?
-
Open the test.yml file and change the run command. If you want to run smoke, enter the smoke command, then save it.
-
Push your code to your repository.
-
Go to the repository and select the Actions option.
-
Where you found your project is already running.
-
Click on the build option, and you can check your status.
How can I check the report?
-
Go to the terminal, which is available at the bottom of Visual Studio.
-
Type this command to generate the macho report. (Command is already available on the package.) json file).
-
Copy the macho report file path and paste it in the browser.
-
Click on the enter key.
How to Test API Endpoints with Different User Roles (e.g., Normal User, Sales User, Super User):
-
Update Credentials in Fixture File: First, go to the fixture file named api_for_different_user_login.json and update it with the username and password of the user role you want to test. For example, if you're testing as a Normal User, enter the Normal User’s credentials in this file.
-
Run Tests Based on User Role Using Tags: Once you've set the appropriate credentials, you can run the tests for that specific user role using tags. For example, to run tests for the Normal User, use the following command:
User Credentials 👤 Normal User Email: [email protected]
Password: Test@123456789
💼 Sales User Email: [email protected]
Password: VinaySales@123