<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ekanto</title>
    <description>The latest articles on DEV Community by Ekanto (@ekanto).</description>
    <link>https://dev.to/ekanto</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F737640%2F1331092d-052b-4fd6-a5aa-6447c8aec83d.jpeg</url>
      <title>DEV Community: Ekanto</title>
      <link>https://dev.to/ekanto</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ekanto"/>
    <language>en</language>
    <item>
      <title>Integrate your playwright test suite with BrowserStack</title>
      <dc:creator>Ekanto</dc:creator>
      <pubDate>Mon, 28 Oct 2024 15:32:27 +0000</pubDate>
      <link>https://dev.to/ekanto/integrate-your-playwright-test-suite-with-browserstack-42f5</link>
      <guid>https://dev.to/ekanto/integrate-your-playwright-test-suite-with-browserstack-42f5</guid>
      <description>&lt;p&gt;Do you have an existing playwright automation suite? Then you can integrate your suite with BrowserStack with just a few easy steps. I will try to break down the process, keeping it as simple as possible. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Prerequisites&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An existing playwright automation suite&lt;/li&gt;
&lt;li&gt;NodeJS installed(Version 14 and above)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Integration Steps
&lt;/h2&gt;

&lt;h4&gt;
  
  
  Step 1:
&lt;/h4&gt;

&lt;p&gt;We need to set our BrowserStack credentials as your environment variable. We can do this by opening up CMD/terminal/bash from Windows, Linux, and MacOS.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;macOS or Linux
export BROWSERSTACK_USERNAME="&amp;lt;your_user_name&amp;gt;"
export BROWSERSTACK_ACCESS_KEY="&amp;lt;your_bs_access_key&amp;gt;"

Windows PowerShell
$env:BROWSERSTACK_USERNAME="&amp;lt;your_user_name&amp;gt;"
$env:BROWSERSTACK_ACCESS_KEY="&amp;lt;your_bs_access_key&amp;gt;"

Windows Cmd
set BROWSERSTACK_USERNAME=&amp;lt;your_user_name&amp;gt;
set BROWSERSTACK_ACCESS_KEY=&amp;lt;your_bs_access_key&amp;gt;`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can get these credentials by clicking on the profile icon and &lt;strong&gt;Account and Profile&lt;/strong&gt; and &lt;strong&gt;My Profile&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frg0ixw327xoblnywfn5n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frg0ixw327xoblnywfn5n.png" alt="Image description" width="800" height="242"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 2: Install NodeJS BrowserStack SDK
&lt;/h4&gt;

&lt;p&gt;Execute the following command to enable BrowserStack SDK for our project&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm i -D browserstack-node-sdk@latest
npx setup --username "&amp;lt;your_user_name&amp;gt;" --key "&amp;lt;your_bs_access_key&amp;gt;"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step 3:
&lt;/h4&gt;

&lt;p&gt;Create the config file for BrowserStack in your project's root directory by creating the &lt;code&gt;browserstack.yml&lt;/code&gt; file. The &lt;strong&gt;.yml&lt;/strong&gt; file can be configured like this -&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;userName: &amp;lt;your_user_name&amp;gt;
accessKey: &amp;lt;your_bs_access_key&amp;gt;
framework: playwright
platforms:
  - os: Windows
    osVersion: 11
    browserName: chrome
    browserVersion: latest
  - os: OS X
    osVersion: Ventura
    browserName: playwright-webkit
    browserVersion: latest
  - os: Windows
    osVersion: 11
    browserName: playwright-firefox
    browserVersion: latest
browserstackLocal: true
buildName: bstack-demo
buildIdentifier: ${BUILD_NUMBER}
projectName: BrowserStack Sample
testObservability: true
debug: true
consoleLogs: info
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Of course, you can configure this &lt;strong&gt;.yml&lt;/strong&gt; according to your preference. But for now, it just should work. &lt;/p&gt;

&lt;h4&gt;
  
  
  Step 4: Run your suite
&lt;/h4&gt;

&lt;p&gt;Now your suite is ready to run on BrowserStack. Use the following command to execute your test - &lt;br&gt;
&lt;code&gt;npx browserstack-node-sdk &amp;lt;Your existing command for running your test suite&amp;gt;&lt;/code&gt;&lt;br&gt;
In general cases, for running playwright project this command should work with BrowserStack - &lt;br&gt;
&lt;code&gt;npx browserstack-node-sdk playwright test&lt;br&gt;
&lt;/code&gt; &lt;br&gt;
After that, you should be able to see your tests running on BrowserStack. To see the tests, go to Automate and check the results from there. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo3wexcjbu2g5qtcx5umt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo3wexcjbu2g5qtcx5umt.png" alt="Image description" width="800" height="397"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hope it helps! Thanks for reading out :) &lt;/p&gt;

</description>
      <category>automation</category>
      <category>playwright</category>
      <category>browserstack</category>
    </item>
    <item>
      <title>Integrate playwright with Jenkins and docker</title>
      <dc:creator>Ekanto</dc:creator>
      <pubDate>Mon, 07 Oct 2024 17:32:36 +0000</pubDate>
      <link>https://dev.to/ekanto/integrate-playwright-with-jenkins-and-docker-3hic</link>
      <guid>https://dev.to/ekanto/integrate-playwright-with-jenkins-and-docker-3hic</guid>
      <description>&lt;p&gt;I will try to demonstrate how I integrated my playwright project with Jenkins and dockerized it. Let's jump into that - &lt;/p&gt;

&lt;p&gt;First, open your playwright project and add the &lt;code&gt;Dockerfile&lt;/code&gt; to the project's root folder like the image below. &lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpxpao8ao0o2501jbsdjc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpxpao8ao0o2501jbsdjc.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now it's time to update the &lt;code&gt;Dockerfile&lt;/code&gt;. You can add this to your &lt;code&gt;Dockerfile&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FROM node:18-bookworm



WORKDIR /usr/src/app

COPY package*.json ./


COPY . .

RUN npm install \ 
    &amp;amp;&amp;amp; npx playwright install-deps  \
    &amp;amp;&amp;amp; npx playwright install chromium \
    &amp;amp;&amp;amp; npx playwright install firefox 


# Expose the port the app runs on
EXPOSE 8080

# Define the command to run the app
CMD ["npx", "playwright", "test"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's a bare minimum but obviously, you can update this according to your preferences. We are done with Docker config. Now, we will integrate our project with Jenkins. &lt;/p&gt;

&lt;p&gt;Before integrating our project to Jenkins, we need to configure Jenkins a bit. To do that, go to &lt;strong&gt;Manage Jenkins&lt;/strong&gt; and click on &lt;strong&gt;Plugins&lt;/strong&gt;. Now from the search bar, install the following plugins-&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; NodeJS Plugin
&lt;/li&gt;
&lt;li&gt; CloudBees Docker Build and Publish plugin&lt;/li&gt;
&lt;li&gt; Docker plugin&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When you are done with the installation, go to the home page and click on &lt;strong&gt;New item&lt;/strong&gt;. From the next window, Click on &lt;strong&gt;Freestyle project&lt;/strong&gt; and choose a name for your project. Then, hit Ok. It should look like this - &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fciby6ooemrd5invtgs59.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fciby6ooemrd5invtgs59.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
Select the option &lt;strong&gt;Git&lt;/strong&gt; from Source Code Management as we will be using Git. And below in the Repository URL, put the link to your GitHub repo or any other source code repository. If your repo is private, use the &lt;strong&gt;Credentials&lt;/strong&gt; option. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpw7ea856xufbnuf0lps5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpw7ea856xufbnuf0lps5.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
Now from Branches to build, mention the branch that you will be building from. In our case, I will be using my main branch so putting that. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpzly5l1ccjcejsr3czzq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpzly5l1ccjcejsr3czzq.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
Now head to the build step. Click on &lt;strong&gt;Add build step&lt;/strong&gt; and select the option &lt;strong&gt;Execute shell&lt;/strong&gt;. Put the following commands there.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install 
npx playwright install 
npx playwright test --headed --project=firefox
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will trigger the build process of your playwright project inside Jenkins. You can modify the commands if you want to. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft3n2xj30lpswvt0m2b4t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft3n2xj30lpswvt0m2b4t.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
Now select &lt;strong&gt;Add build step ** again and select **Docker build and publish&lt;/strong&gt;. In the &lt;strong&gt;Repository Name&lt;/strong&gt;, put your docker repo name where you are going to containerize your project. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi188a5neogax471gg689.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi188a5neogax471gg689.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
When you are done, hit Apply and Save. Now your project is ready to be built and deployed on Docker. Once it's ready, you will see your project is now ready to be built. Click on your project name and hit Build Now. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz4kp3240mlvia98fvm1q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz4kp3240mlvia98fvm1q.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkdkxrqgv2ygx2cx9qnpn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkdkxrqgv2ygx2cx9qnpn.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
Once it starts building, you can see the status of your current build by clicking here&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fknc7ucm3t7pbgcync3ox.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fknc7ucm3t7pbgcync3ox.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7tkkw45tmvizdspsinks.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7tkkw45tmvizdspsinks.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once done, you will see your newly built docker image is ready for conteinerization. &lt;/p&gt;

</description>
      <category>playwright</category>
      <category>jenkins</category>
      <category>docker</category>
      <category>automation</category>
    </item>
    <item>
      <title>Integrate playwright with Jenkins and docker</title>
      <dc:creator>Ekanto</dc:creator>
      <pubDate>Mon, 07 Oct 2024 17:32:36 +0000</pubDate>
      <link>https://dev.to/ekanto/integrate-playwright-with-jenkins-and-docker-3mlc</link>
      <guid>https://dev.to/ekanto/integrate-playwright-with-jenkins-and-docker-3mlc</guid>
      <description>&lt;p&gt;I will try to demonstrate how I integrated my playwright project with Jenkins and dockerized it. Let's jump into that - &lt;/p&gt;

&lt;p&gt;First, open your playwright project and add the &lt;code&gt;Dockerfile&lt;/code&gt; to the project's root folder like the image below. &lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpxpao8ao0o2501jbsdjc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpxpao8ao0o2501jbsdjc.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now it's time to update the &lt;code&gt;Dockerfile&lt;/code&gt;. You can add this to your &lt;code&gt;Dockerfile&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FROM node:18-bookworm



WORKDIR /usr/src/app

COPY package*.json ./


COPY . .

RUN npm install \ 
    &amp;amp;&amp;amp; npx playwright install-deps  \
    &amp;amp;&amp;amp; npx playwright install chromium \
    &amp;amp;&amp;amp; npx playwright install firefox 


# Expose the port the app runs on
EXPOSE 8080

# Define the command to run the app
CMD ["npx", "playwright", "test"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's a bare minimum but obviously, you can update this according to your preferences. We are done with Docker config. Now, we will integrate our project with Jenkins. &lt;/p&gt;

&lt;p&gt;Before integrating our project to Jenkins, we need to configure Jenkins a bit. To do that, go to &lt;strong&gt;Manage Jenkins&lt;/strong&gt; and click on &lt;strong&gt;Plugins&lt;/strong&gt;. Now from the search bar, install the following plugins-&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; NodeJS Plugin
&lt;/li&gt;
&lt;li&gt; CloudBees Docker Build and Publish plugin&lt;/li&gt;
&lt;li&gt; Docker plugin&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When you are done with the installation, go to the home page and click on &lt;strong&gt;New item&lt;/strong&gt;. From the next window, Click on &lt;strong&gt;Freestyle project&lt;/strong&gt; and choose a name for your project. Then, hit Ok. It should look like this - &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fciby6ooemrd5invtgs59.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fciby6ooemrd5invtgs59.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
Select the option &lt;strong&gt;Git&lt;/strong&gt; from Source Code Management as we will be using Git. And below in the Repository URL, put the link to your GitHub repo or any other source code repository. If your repo is private, use the &lt;strong&gt;Credentials&lt;/strong&gt; option. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpw7ea856xufbnuf0lps5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpw7ea856xufbnuf0lps5.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
Now from Branches to build, mention the branch that you will be building from. In our case, I will be using my main branch so putting that. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpzly5l1ccjcejsr3czzq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpzly5l1ccjcejsr3czzq.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
Now head to the build step. Click on &lt;strong&gt;Add build step&lt;/strong&gt; and select the option &lt;strong&gt;Execute shell&lt;/strong&gt;. Put the following commands there.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install 
npx playwright install 
npx playwright test --headed --project=firefox
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will trigger the build process of your playwright project inside Jenkins. You can modify the commands if you want to. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft3n2xj30lpswvt0m2b4t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft3n2xj30lpswvt0m2b4t.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
Now select &lt;strong&gt;Add build step ** again and select **Docker build and publish&lt;/strong&gt;. In the &lt;strong&gt;Repository Name&lt;/strong&gt;, put your docker repo name where you are going to containerize your project. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi188a5neogax471gg689.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi188a5neogax471gg689.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
When you are done, hit Apply and Save. Now your project is ready to be built and deployed on Docker. Once it's ready, you will see your project is now ready to be built. Click on your project name and hit Build Now. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz4kp3240mlvia98fvm1q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz4kp3240mlvia98fvm1q.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkdkxrqgv2ygx2cx9qnpn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkdkxrqgv2ygx2cx9qnpn.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
Once it starts building, you can see the status of your current build by clicking here&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fknc7ucm3t7pbgcync3ox.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fknc7ucm3t7pbgcync3ox.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7tkkw45tmvizdspsinks.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7tkkw45tmvizdspsinks.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once done, you will see your newly built docker image is ready for conteinerization. &lt;/p&gt;

</description>
      <category>playwright</category>
      <category>jenkins</category>
      <category>docker</category>
      <category>automation</category>
    </item>
    <item>
      <title>Why we need test automation framework and how to develop it?</title>
      <dc:creator>Ekanto</dc:creator>
      <pubDate>Sat, 18 Mar 2023 14:19:42 +0000</pubDate>
      <link>https://dev.to/ekanto/why-we-need-test-automation-framework-and-how-to-develop-it-154j</link>
      <guid>https://dev.to/ekanto/why-we-need-test-automation-framework-and-how-to-develop-it-154j</guid>
      <description>&lt;p&gt;Test automation is a fundamental process along with testing applications manually. To make this whole automation process easier and performing automation testing in an effective and efficient way, QA engineers use automation frameworks. There are different types of frameworks available that serve different purposes. Some of the popular testing frameworks are: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cypress&lt;/strong&gt; - For E2E(End to End) Testing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Selenium&lt;/strong&gt; - For Web automation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;RESTAssured&lt;/strong&gt; - A Java library to test REST API's.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cucumber&lt;/strong&gt; - Simple Gherkin used framework for BDD testing. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All the test automation frameworks serves some similar objectives. Those are: &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reusability&lt;/strong&gt;: Frameworks gives the power to QA engineers to make their test automation process in a more non-redundant way and reuse the automated test cases. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Maintainability&lt;/strong&gt;: Requirement changes most often. To maintain the test cases with the changing requirements, framework gives QA the additional benefits to make the changes more efficiently. Also, anyone can add more test cases or modify existing test cases if needed. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Readability&lt;/strong&gt;: Framework makes it easier for QA engineers to read and understand the code more easily.&lt;/p&gt;

&lt;p&gt;Test automation framework gives a boost to QA engineers to get their job done in a more convenient way. But there some phases to develop a test automation framework. The key phases are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Requirement gathering&lt;/strong&gt;: Before designing a framework, it's important to understand the requirements first. What type resources a QA engineer needs, URL's or API all these things need to be considered first before developing a framework. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Choosing automation tool&lt;/strong&gt;: Considering the needs and purpose of automation, tools should be chosen accordingly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Designing the framework&lt;/strong&gt;: It's one of the crucial phase of developing a framework. A framework with good design model makes handling the automation code in a more non-redundant way, makes it more maintainable and readable. One of the popular automation design model is POM(Page Object Model).
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Development and execution&lt;/strong&gt;: After choosing and designing the framework, the QA engineer needs to implement the files. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CI/CD&lt;/strong&gt;: After development and execution, the framework can be deployed in CI/CD to maintain the continuous integration of automation codes. &lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>testing</category>
      <category>automation</category>
      <category>framework</category>
    </item>
    <item>
      <title>Capture screenshot in Selenium for failing conditions using Java</title>
      <dc:creator>Ekanto</dc:creator>
      <pubDate>Sun, 17 Jul 2022 01:25:38 +0000</pubDate>
      <link>https://dev.to/ekanto/capture-screenshot-in-selenium-for-failing-conditions-using-java-1pdo</link>
      <guid>https://dev.to/ekanto/capture-screenshot-in-selenium-for-failing-conditions-using-java-1pdo</guid>
      <description>&lt;p&gt;We testers often do this task frequently, capturing evidence for failing test cases or conditions as screenshots or video. Accomplishing this task manually is a quite hectic process. Here comes automation handy. I am going to write about the process how we can capture screenshots in Selenium using Java. We will try avoiding hard coding and reduce redundancy so that it goes well with &lt;strong&gt;&lt;em&gt;POM(Page object model)&lt;/em&gt;&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;First things first, let's create a project called &lt;em&gt;&lt;strong&gt;XYZ&lt;/strong&gt;&lt;/em&gt;. It's better if it's a Maven project. Inside of it, we create a package (suppose I name it) &lt;strong&gt;&lt;em&gt;com.screenshot&lt;/em&gt;&lt;/strong&gt; and inside of the package, we create a class &lt;strong&gt;&lt;em&gt;ScreenShot.java&lt;/em&gt;&lt;/strong&gt;. Inside, we are adding this following code.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;File ss = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This will take the screenshot for us. But if we want to save it somewhere in our project or to view the captured file, we are going to need a utility called &lt;strong&gt;&lt;em&gt;commons.io&lt;/em&gt;&lt;/strong&gt;. We can get this file from this &lt;a href="https://commons.apache.org/" rel="noopener noreferrer"&gt;link&lt;/a&gt;. For &lt;em&gt;&lt;strong&gt;Maven&lt;/strong&gt;&lt;/em&gt; project, we just need to edit the &lt;em&gt;&lt;strong&gt;pom.xml&lt;/strong&gt;&lt;/em&gt; file and this following code in the dependencies section. &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;


&amp;lt;!-- https://mvnrepository.com/artifact/commons-io/commons-io --&amp;gt;
      &amp;lt;dependency&amp;gt;
            &amp;lt;groupId&amp;gt;commons-io&amp;lt;/groupId&amp;gt;
            &amp;lt;artifactId&amp;gt;commons-io&amp;lt;/artifactId&amp;gt;
            &amp;lt;version&amp;gt;2.7&amp;lt;/version&amp;gt;
      &amp;lt;/dependency&amp;gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;This should be enough. To save the screenshot that we captured, we just need to add the following code right after we added the earlier. Before that, let's assume we created a directory/folder called &lt;em&gt;screenshot&lt;/em&gt; in our class path, so that we can save our captured screenshots there. So in total the code looks like this-&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

File ss = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
        FileUtils.copyFile(ss, new File(".//screenshot//"your_file_name".png"));



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;If it's done correctly, we shall have a screenshot with .png extension in our screenshot folder. We can keep it using any format we want by modifying the format. &lt;/p&gt;

&lt;p&gt;It's done!! But wait, still some left. In most cases, we have more than one failing cases in our project and we need to keep multiple screenshots. But since we have defined the name statically, every time the capture will be replaced by the new one. To work on this, we can name the file dynamically. As an example, we can save the files with dates or time. One way of doing this,&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

Date dt = new Date();
String st = dt.toString().replace(" ", "-").replace(":", "-"); 


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The &lt;strong&gt;&lt;em&gt;Date&lt;/em&gt;&lt;/strong&gt; class will have the time and to convert the &lt;em&gt;date&lt;/em&gt; object to string, we can use the &lt;strong&gt;&lt;em&gt;toString()&lt;/em&gt;&lt;/strong&gt; method. We can also change the format using the &lt;strong&gt;&lt;em&gt;replace()&lt;/em&gt;&lt;/strong&gt; method according to our choice. Lastly, we are going to add the string as the name of the file. It looks like this-&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

FileUtils.copyFile(ss, new File(".//screenshot//" + st + ".png"));


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;After this, we shall have a screenshot file in our folder. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbscoegxjvbatr1suq5v2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbscoegxjvbatr1suq5v2.png" alt="Image description" width="360" height="53"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Sometimes we may need to change the directory of our screenshots, so it's better to handle the whole process in a separate package/class/method so that we can change it efficiently. It may look like this-&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

public class ScreenShot {
    public static File screenShot(WebDriver driver) throws IOException {
        Date dt = new Date();
        String st = dt.toString().replace(" ", "-").replace(":", "-");
        File ss = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
        FileUtils.copyFile(ss, new File(".//screenshot//" + st + ".png"));
        return ss;
    }


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Since it's a static method, we can use this anywhere in our testcases just by using &lt;code&gt;ScreenShot.screenShot(driver);&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;That's it!! &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Thanks for reading this out. Pardon me for the mistakes I may have made as I am still a learner and exploring everyday. I would be glad if it helps anyone. :) &lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>java</category>
      <category>selenium</category>
      <category>automation</category>
    </item>
    <item>
      <title>Adding logs to your selenium script using python</title>
      <dc:creator>Ekanto</dc:creator>
      <pubDate>Sun, 29 May 2022 10:45:59 +0000</pubDate>
      <link>https://dev.to/ekanto/adding-logs-into-your-selenium-script-using-python-ig3</link>
      <guid>https://dev.to/ekanto/adding-logs-into-your-selenium-script-using-python-ig3</guid>
      <description>&lt;p&gt;Ever wondered running your selenium script but also thinking of saving the logs of every execution of your test cases? There is a much convenient way of doing this task in Selenium using Python. This article is all about this. &lt;/p&gt;

&lt;h1&gt;
  
  
  Main code
&lt;/h1&gt;

&lt;p&gt;First of all, you need to create a python package, let's say it's name &lt;em&gt;log&lt;/em&gt;. Inside of the package, create a python file (lets say it's &lt;em&gt;logCapture.py&lt;/em&gt;). Then in this file, import a python package called &lt;em&gt;logging&lt;/em&gt;. &lt;code&gt;import logging&lt;/code&gt;  It should be included in the python when you install.&lt;/p&gt;

&lt;p&gt;Then you can create a class and define method inside of it. It's better if you declare the method as a static method so that you can access the method from anywhere of your project without creating any objects of it's class. Then you can add the piece of code given below: &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

import logging

class LogGen:
    @staticmethod
    def loggen():
        logger  = logging.getLogger("Test Login")
        fileHandler  = logging.FileHandler('.\\YourDesiredFolderName')
        formatter = logging.Formatter("%(asctime)s :%(levelname)s : %(name)s :%(message)s")
        fileHandler.setFormatter(formatter)
        logger.addHandler(fileHandler)
        logger.setLevel(logging.INFO)
        return logger


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;You can pass the name of your test case as a parameter inside the &lt;em&gt;getLogger()&lt;/em&gt; method. The &lt;em&gt;filehandler&lt;/em&gt; class will handle the your desired location for your logs. &lt;em&gt;Formatter&lt;/em&gt; method will make sure your logs are being stored following a proper format. The &lt;em&gt;logger&lt;/em&gt; variable will return the log at the end of the execution. &lt;/p&gt;

&lt;h1&gt;
  
  
  Driver code
&lt;/h1&gt;

&lt;p&gt;Now it's time to use that &lt;em&gt;loggen()&lt;/em&gt; function. Create another python file to add the driver code. Inside of this file, import the &lt;em&gt;loggen&lt;/em&gt; function by simply using this code &lt;code&gt;from log.logCapture import logGen&lt;/code&gt;. The code is basically for accessing the LogGen class which we created earlier. Then use the logging by just calling the &lt;em&gt;logger&lt;/em&gt; variable.&lt;/p&gt;

&lt;p&gt;Let's say we want to test a login page. So you can add logs by using &lt;code&gt;logger.info("You desired massage")&lt;/code&gt; right before the execution of the test case or where ever you want. After executing the test cases, you will see a log file has been created in your desired folder. The log should look something like this&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl0l5wcqxjz2qcb5q3skr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl0l5wcqxjz2qcb5q3skr.png" alt="Image description" width="800" height="245"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is the output of my logs after executing the test cases. This is how my code looks like behind this&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsu9g6zdgko1kwvjxo420.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsu9g6zdgko1kwvjxo420.png" alt="Image description" width="800" height="248"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You should be able to use log if you follow this procedure :)&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Thanks for reading. Pardon me for the mistakes I may have made as I am new to automation testing and still exploring everyday. I would be glad if it helps anyone. :) &lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>python</category>
      <category>selenium</category>
      <category>testing</category>
    </item>
  </channel>
</rss>
