<?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: Cesar Augusto Rayo Zapata</title>
    <description>The latest articles on DEV Community by Cesar Augusto Rayo Zapata (@carz_co).</description>
    <link>https://dev.to/carz_co</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%2F634160%2F50744e5e-ed3d-4133-9c3c-ba9c791a5082.jpeg</url>
      <title>DEV Community: Cesar Augusto Rayo Zapata</title>
      <link>https://dev.to/carz_co</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/carz_co"/>
    <language>en</language>
    <item>
      <title>Docker-Selenium Video Recorder</title>
      <dc:creator>Cesar Augusto Rayo Zapata</dc:creator>
      <pubDate>Fri, 20 Jan 2023 22:07:09 +0000</pubDate>
      <link>https://dev.to/carz_co/docker-selenium-video-recorder-1l2k</link>
      <guid>https://dev.to/carz_co/docker-selenium-video-recorder-1l2k</guid>
      <description>&lt;p&gt;This post is intended for all those who use docker-selenium.&lt;/p&gt;

&lt;p&gt;Since I started using "dockerized" Selenium grid, I was always curious about the possibility of recording the actions we perform within a browser container (chrome, edge, firefox) and when I saw there was a &lt;a href="https://github.com/SeleniumHQ/docker-selenium#video-recording" rel="noopener noreferrer"&gt;solution&lt;/a&gt; in place for it, I just jumped into it, it was basically by using &lt;a href="https://hub.docker.com/layers/selenium/video/ffmpeg-4.3.1-20221219/images/sha256-a4bf701ff9c7d2cbce4f0b0b1bbe7ed9eb8043e858f346b054b30e514069b4c1?context=explore" rel="noopener noreferrer"&gt;selenium/video:ffmpeg-XXXX&lt;/a&gt; Docker image; starting and stoping containers manually, but it was quite too raw, mainly because of the fact we need to kill the container in order to get the video file.&lt;/p&gt;

&lt;p&gt;So I tried to create a logic layer whose main task was going to be handle this situation; avoid start/stop containers every time. As the thing got more complex and wanted to get more control, I ended up creating a service that can be deployed either using docker-compose or Helm Chart.&lt;/p&gt;

&lt;p&gt;The service is intended to be exposed in the port 5001 of the machine where Selenium Grid is running, and it will look something similar to this:&lt;/p&gt;

&lt;h3&gt;
  
  
  Start recording the screen of a given node:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;curl &lt;span class="nt"&gt;-X&lt;/span&gt; POST http://localhost:5001/start &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{"videoName":"my_video","targetDisplay":"chrome-display"}'&lt;/span&gt;
&lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"file"&lt;/span&gt;: &lt;span class="s2"&gt;"my_video.mp4"&lt;/span&gt;, &lt;span class="s2"&gt;"status"&lt;/span&gt;: &lt;span class="s2"&gt;"recording"&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Stop recoding
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ curl -v -X POST http://localhost:5001/stop
{"file": "my_video.mp4", "status": "stopped"}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The file will be saved on the path you have specified in the deployment (keep reading for more details)&lt;/p&gt;

&lt;p&gt;It's obviously the first steps for having a robust service that can take advantage of the replicas we might have in the Helm Chart or the Compose deployment, but this is a solution that worked for me and hope it does for you!&lt;/p&gt;

&lt;p&gt;All that intro just for sharing this with you &lt;a href="https://github.com/cesar-rayo/docker-selenium#video-recording" rel="noopener noreferrer"&gt;Selenium Grid + Video Recorder&lt;/a&gt;, Happy testing!!&lt;/p&gt;

</description>
      <category>gratitude</category>
    </item>
    <item>
      <title>Step Functions as Test Automation Framework?</title>
      <dc:creator>Cesar Augusto Rayo Zapata</dc:creator>
      <pubDate>Mon, 21 Feb 2022 16:58:57 +0000</pubDate>
      <link>https://dev.to/carz_co/step-functions-as-test-automation-framework-120g</link>
      <guid>https://dev.to/carz_co/step-functions-as-test-automation-framework-120g</guid>
      <description>&lt;p&gt;Have you ever faced any issue with your infrastructure when running Test Automation scripts? Have you wondered if there is an easy way to find where the test is broken? perhaps a kind of graph where it tells you where the test got broken?.&lt;/p&gt;

&lt;p&gt;Probably this is not your case, or maybe you already are using a good framework that solves all these issues, but what I want to share with you is an idea that we were able to put in place some years ago.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--X9nxo70c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/144k61v839hiyd07e5zy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--X9nxo70c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/144k61v839hiyd07e5zy.png" alt="Image description" width="596" height="335"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For starters, we will have to understand what a test case really is:&lt;/p&gt;

&lt;p&gt;A test case is just a bunch of actions that we have to perform in a given order to finally get a predictable result, which in most of the cases we ended up creating a script so we can run it whenever we want and even make it part of a CI/CD solution.&lt;/p&gt;

&lt;p&gt;But how is this related to AWS and Step Functions? what's the benefit we saw there? so if we take a look to what actually the Cloud Computing solves, or what actually Serverless mean, it goes to the simple fact that you don't have to worry about the infrastructure.. meaning you don't deal with OS updates, plugins, or even security gabs.. and guess what.. that was exactly what we were looking for.&lt;/p&gt;

&lt;p&gt;So if we go to the definition of a Step Function, and we think of it as a States Machines, that's exactly what a test case is a group of steps that we perform in a given order". All we have to know is that there will be a "context" that needs to be share between states.&lt;/p&gt;

&lt;p&gt;Imagine using Selenium, Python, AWS Step Function and AWS Lambas to create this solution.&lt;/p&gt;

&lt;p&gt;We faced several issues there, but the biggest one, taking in account we used lambdas as the mechanism in each state to execute a piece of code that uses Selenium web driver, was to share the driver between states.&lt;/p&gt;

&lt;p&gt;How to solve this? one of our best options; use a place where we can store this "driver" so the next state will know what to do, we decided to use AWS Dynamo DB, meaning somehow we will have to convert and store the driver there.&lt;/p&gt;

&lt;p&gt;Back in those days we were using python as the main PL that was executed in the lambdas functions, and TBH there were a lot of options to "convert" the driver object to a format Dynamo DB could understand.&lt;/p&gt;

&lt;p&gt;Having the serialized object, it was a matter to use Boto3 and a couple of IAM roles to be able to write/read from Dynamo, so it became the pre and post steps we executed in each state.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Us3iUUeV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7rx6wkrwjk9bxzz93yrb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Us3iUUeV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7rx6wkrwjk9bxzz93yrb.png" alt="Image description" width="474" height="540"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We ended with a test case that looked much as any state machine, so if a state failed for any reason (a lambda) we could see that in a nice graph and for details we always could take a look to the AWS CloudWatch logs.&lt;/p&gt;

</description>
      <category>serverless</category>
      <category>aws</category>
      <category>testing</category>
    </item>
  </channel>
</rss>
