MuukTest offers integration with Playwright. This way to execute a test is local in your machine and you can modify the script if you want to do that.
To execute a test using Playwright, you need to follow the next steps.
Prerequisites
In this section, we will install the prerequisites. If you have it, you can pass it directly to set up.
List of prerequisites:
- Creating a new folder for the project
- Node JS 14.X installation
- Installing gcc/g++/make
- Download unzip
- Using JSON on shell
Create a folder project
Create a new folder. You can choose any name for it and can be located anywhere. In this example, we are naming it playwright.
Verify that the folder was created.
Enter your new folder to next continue with the installation.
Node.js installation
To ensure you are using the required Node.js version run the steps below to install it
- Run the following command to get the required Node.js version.
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
- Install Node.js 14.x and npm using the next command
sudo apt-get install -y nodejs
Installing gcc/g++/make
You may also need development tools to build native addons, to acquire them run the following command. If you know that you have it, can skip this step.
sudo apt-get install gcc g++ make
Download unzip
When you download the test to execute it on Playwright, you will get a zip file. To avoid errors on the executor, verify that you have unzip or install it with the next command.
sudo apt-get install -y unzip
Using JSON on shell
Another package that you need is jq to use JSON on shell or bash files. To verify that you have installed or install it, use the next command.
sudo apt-get install jq
Installing Playwright
Go to the folder you created previously in the Prerequisites section. If you skipped that section, then create a new directory to use Playwright. You can decide where and the name.
In the folder, install Playwright using the next command:
npm install -D @playwright/test
Then, use the following command to install all dependencies and browsers for Playwright.
npx playwright install --with-deps
Axios
To use this script you need to use Axios. Install axios using the next command:
npm install axios
Download the executor
To download the executor, use this command to clone the git project to your machine.
git clone https://github.com/muuklabs/pw_executor.git
Once you have the zip file with the project, unzip it to your project folder and you will have a new file called mkclipw.sh
Before to use it, you need to change the script to execution mode using the following command.
chmod +x mkclipw.sh
Once you have done it, you can start to use your MuukTest Playwright Executor
Execute a test
Once you installed and configured Playwright and the executor, you can start to execute tests with them.
The executor has this structure to use:
./mkclipw.sh {{property}} {{value}} {{key}}
Where:
- property is to indicate if you want to execute by tag or by hashtag.
- value the TC# for the test (in the case of Tag) or the name of the hashtag (in the case of Hashtag)
- key (optional) the content of the file that you download from your Account in the MuukTest Portal.
In this section you will practice using the key.pub on your project folder or writing on the shell.
Examples
- Using with Hashtag
./mkclipw.sh hashtag "#sample"
- Using with Tag
./mkclipw.sh tag "TC15123"
- Using with the key on the shell
./mkclipw.sh tag "TC12345" "Wesadsdad_asdadWWWCASsdd..."
Example with key.pub on project folder
Download your Key.pub file from your MuukTest account. You can download it from your Account in MuukTest Portal. Once you have it, put the file in the folder project.
On your shell, write the usage command with your tag/hashtag and value:
You will get an output like this (depending your result).
Example without key.pub on project folder
Download your Key.pub file from your MuukTest account. You can download it from your Account in MuukTest Portal. Open it and copy the value:
Then, in your shell, write the usage command with your tag/hashtag, value and key:
Depending on your test result, you will receive an output like that in your shell.
And that is it! You can go to MuukTest Portal to see the execution result.
Bonus
If you want to see the browser execution. Open the mkclipw.sh file and go to the line 22 to change this value:
npx playwright test --workers=4
For the next value:
npx playwright test --headed
And then, when you use your executor, you will see the browser and your execution.
And that's all! 🎉
Enjoy using MuukTest + Playwright.
Comments
0 comments
Please sign in to leave a comment.