<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Michal Drajna on Medium]]></title>
        <description><![CDATA[Stories by Michal Drajna on Medium]]></description>
        <link>https://medium.com/@michaldrajna?source=rss-12c7a34474cd------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*yOZ3a26TZst32L2umDexig.jpeg</url>
            <title>Stories by Michal Drajna on Medium</title>
            <link>https://medium.com/@michaldrajna?source=rss-12c7a34474cd------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 04:22:30 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@michaldrajna/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to Test SMS OTP Authentication with Playwright without Using a Paid Service]]></title>
            <link>https://medium.com/@michaldrajna/how-to-test-sms-otp-authentication-with-playwright-without-using-a-paid-service-60b2556a5560?source=rss-12c7a34474cd------2</link>
            <guid isPermaLink="false">https://medium.com/p/60b2556a5560</guid>
            <category><![CDATA[sms-service]]></category>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[playwright-test]]></category>
            <category><![CDATA[playwright-community]]></category>
            <category><![CDATA[authentication]]></category>
            <dc:creator><![CDATA[Michal Drajna]]></dc:creator>
            <pubDate>Tue, 24 Jan 2023 06:36:28 GMT</pubDate>
            <atom:updated>2023-01-24T06:36:28.165Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*aRO2QvVBPG2jjm7k" /></figure><p>Are you looking for a cost-effective solution to automate SMS OTP authentication testing? Look no further! In this article, I’ll show you how I used Playwright, a free automation library, to automate SMS OTP authentication testing. I’ll walk you through the process step-by-step and provide code examples so you can implement it in your own projects. Whether you’re a QA engineer or just someone looking to automate SMS OTP authentication testing, this article is for you.</p><p>I assume you already have your Playwright framework up and running, so I won’t bother with installing and setting up the environment.</p><p>In your step test where you need to enter the SMS OTP code, continue with the following code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qBn_esseAgUw7z_8" /></figure><p>The code starts by opening a new browser tab and then disables Google ads by routing all requests that start with “https://googleads.&quot; and aborting them.</p><p>The problem with such websites is the amount of advertisements. You never know when and what kind of ads will pop up. We solve this by simply blocking all ads.</p><p>I used <a href="https://receive-smss.com/">https://receive-smss.com/</a>, but there are many, so Google it if it doesn’t suit you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wPN_AuZLAkVF0z3h" /></figure><p>Let’s take a look at this piece of code:</p><ol><li>The first line is using the goto method of the smsPage object to navigate to the website ‘<a href="https://receive-smss.com/">https://receive-smss.com/</a>&#39;. The waitUntil option is set to ‘domcontentloaded’, which means that the script will wait for the DOM (Document Object Model) to be fully loaded before moving on to the next step.</li><li>The next line is using the locator method of the smsPage object to find and click on the first element that matches the provided CSS selector — (//a[contains(text(),”Open”)])[1]. This is likely clicking on a button that opens up a tooltip containing a phone number.</li><li>The following line of code is using the locator method again to find the element that matches the provided CSS selector (//div[contains(@class, “tooltip”)]/a). Once the element is found it gets the inner text of that element and assigns it to textWithNumber variable.</li><li>Next, it uses the substring method to extract the phone number from the text. The substring method is used to extract a section of the text, starting at the 4th character (index 3) and ending at the 16th character (index 15). The extracted phone number is assigned to the phoneNumber variable.</li><li>Then, it uses the enterPhoneNumber method of the registrationPage object to enter the phone number that was just obtained into the corresponding input field on the registration page.</li><li>Finally, it uses the clickSendSms method of the registrationPage object to click on a button that sends the SMS message with the OTP.</li></ol><p>The SMS code has been sent successfully, now we just have to wait for it.</p><p>This is achieved by polling, which I used and explained in my previous <a href="https://www.linkedin.com/pulse/sending-graphql-post-request-playwright-michal-drajna/">article</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jHM10JN9ZXPAELXJ" /></figure><p>You need to wait for a text message with your text. The page refreshes for 60 seconds, which was enough for me for this page. SMS messages arrived mostly within 15 seconds.</p><p>If an SMS message with the specified text arrives, we continue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WUxXTrqiWDWkHP5S" /></figure><p>The final bit of code will do the following:</p><ol><li>The first line is using the locator method of the smsPage object to find the first element that matches the provided CSS selector — //td[contains(string(),”seconds ago”)]/preceding-sibling::td[contains(string(),”Your authentication code is:”)]. This selector is likely trying to find a table cell containing the text “Your authentication code is:” that is preceded by another table cell containing the text “seconds ago” . Once the element is found the inner text of that element is assigned to the smsMessage variable.</li><li>Then, it uses the substring method to extract the OTP from the SMS message. The substring method is used to extract a section of the text, starting at the 19th character (index 18) and ending at the 25th character (index 24). The extracted OTP is assigned to the finalCode variable.</li><li>Finally, it uses the enterSmsCode method of the registrationPage object to enter the OTP that was just obtained into the corresponding input field on the registration page.</li></ol><p>After entering the SMS code and confirming it, you are authenticated, congratulations.</p><p>Thank you for reading and please let me know if you have any comments.</p><p>You can find the full code on my Github:</p><p><a href="https://github.com/drajnamichal/playwright">GitHub - drajnamichal/playwright</a></p><p><a href="https://www.linkedin.com/feed/hashtag/playwright">#playwright</a> <a href="https://www.linkedin.com/feed/hashtag/authentication">#authentication</a> <a href="https://www.linkedin.com/feed/hashtag/automationtesting">#automationtesting</a> <a href="https://www.linkedin.com/feed/hashtag/otp">#otp</a> <a href="https://www.linkedin.com/feed/hashtag/sms">#sms</a> <a href="https://www.linkedin.com/feed/hashtag/polling">#polling</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=60b2556a5560" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sending a GraphQL POST Request with Playwright]]></title>
            <link>https://medium.com/@michaldrajna/sending-a-graphql-post-request-with-playwright-65e57ae3b747?source=rss-12c7a34474cd------2</link>
            <guid isPermaLink="false">https://medium.com/p/65e57ae3b747</guid>
            <category><![CDATA[playwright-test]]></category>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[playwright-community]]></category>
            <dc:creator><![CDATA[Michal Drajna]]></dc:creator>
            <pubDate>Tue, 24 Jan 2023 06:30:53 GMT</pubDate>
            <atom:updated>2023-01-24T06:30:53.000Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*8TE9F9OcCMQ355jj" /></figure><p>Have you ever struggled with how to send a GraphQL request using Playwright like I did? I spent hours trying to figure it out, but I finally cracked the code. In this article, I will share my solution with you and walk you through the step-by-step process of sending a GraphQL POST request with headers in Playwright using TypeScript. Whether you’re a beginner or an experienced tester, this guide will provide you with the knowledge and tools you need to easily send GraphQL requests with Playwright. So, say goodbye to frustration and hello to success as I guide you through the process of sending GraphQL requests with Playwright.</p><p>I assume that you already have Playwright installed and running within your own framework, so I won’t go into the installation and setup process. Instead, I will jump straight to the point and show you how to send a GraphQL POST request with headers in Playwright using TypeScript. With this guide, you will be able to easily send GraphQL requests with Playwright and take your development skills to the next level. So, let’s get started!</p><p>First I needed to get an authorization token from the cookies.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Wj94-FbR4eLdPzkN" /></figure><p>Get acess token from cookies</p><p>So it first gets the cookies from the context and extracts the idToken cookie value, which it uses as an authorization token in the request headers.</p><p>The request generates a transactionId, which I needed to get because it is part of the GraphQL POST query.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Z0_qSwJK4OUjSiUE" /></figure><p>Get transactionId from request</p><p>The code then waits for a request to the /invoice/api/graphql endpoint and extracts the transactionId from the request’s postDataJSON.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*svvoZMBHTQTO26aB" /></figure><p>Send GraphQL POST request with header for 60 seconds until status is not InProgress</p><p>It then refreshes the page and sends a new request to the /invoice/api/graphql endpoint using the request object.</p><p>This new request queries the Invoice field with the transactionId and waits for the status field to not be InProgress. If the status field is not InProgress within 60 seconds, the poll function returns true. Otherwise, it will continue to poll until the timeout is reached.</p><p>Yes, the <a href="https://playwright.dev/docs/test-assertions#polling">“poll”</a> function in Playwright allows you to repeatedly check for a certain condition or state, at a specified interval, until the condition is met or the timeout is reached. It is often used when working with asynchronous tasks or waiting for certain events to occur. In this code snippet, the poll function is used to refresh the page and check the status of the order until it is no longer “InProgress” or until the timeout of 60 seconds is reached. This helps to ensure that the order status is updated before proceeding with any further actions.</p><p>In summary, this code demonstrates how to send a GraphQL POST request with headers in Playwright using Typescript by retrieving an access token from cookies, waiting for a specific response, sending a request to the GraphQL endpoint, and checking the status of the invoice.</p><p>Thank you for reading this article. I hope that you found it helpful and informative. If you have any questions or need further assistance, please don’t hesitate to reach out. Once again, thank you for reading and I wish you all the best in your QA journey.</p><p>You can find the full code on my Github:</p><p><a href="https://github.com/drajnamichal/playwright">GitHub - drajnamichal/playwright</a></p><p>#playwright #graphql</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=65e57ae3b747" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploring the Benefits and Challenges of AI-Assisted Automation Testing]]></title>
            <link>https://medium.com/@michaldrajna/exploring-the-benefits-and-challenges-of-ai-assisted-automation-testing-55b2fa276644?source=rss-12c7a34474cd------2</link>
            <guid isPermaLink="false">https://medium.com/p/55b2fa276644</guid>
            <category><![CDATA[automation-testing]]></category>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[automation]]></category>
            <dc:creator><![CDATA[Michal Drajna]]></dc:creator>
            <pubDate>Tue, 10 Jan 2023 13:57:12 GMT</pubDate>
            <atom:updated>2023-01-10T13:57:12.022Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*VfHWVOJaxo7C4aTteYoSoA.png" /><figcaption>AI assisted automation testing</figcaption></figure><p>Artificial intelligence (AI) and automation have revolutionized many industries, and software testing is no exception. AI-assisted automation testing is a new approach to testing software that uses AI algorithms to automate and improve the testing process. One of the AI techniques that is used for automation testing is the use of pre-trained language model such as GPT-3 or other similar models like chatGPT.</p><p>ChatGPT, a specific implementation of the GPT-3 model is trained on a large dataset of conversational text, is capable of understanding natural language inputs and provide human-like responses. This capability can be used in the context of software testing to generate natural language test cases and test scripts, which can be executed to validate the functionality of the software.</p><p>Pros of AI-assisted Automation Testing:</p><ul><li>It can perform repetitive tasks with high accuracy and efficiency</li><li>It can perform tests that are difficult or impossible for humans to perform manually</li><li>It has the potential to reduce the costs associated with software testing</li><li>It can improve the efficiency and accuracy of the testing process</li><li>It can generate natural language test cases and test scripts with the use of pre-trained language models like chatGPT.</li></ul><p>Cons of AI-assisted Automation Testing:</p><ul><li>Quality of the data used to train the AI algorithms is crucial, if the data is inaccurate, representative, and biased the AI may not be able to accurately identify bugs and other issues in the software.</li><li>Limitations of pre-trained language models like chatGPT, such as not being able to understand the context behind the text, generated test cases and scripts still have to be reviewed by human testers</li><li>AI-assisted automation testing is not a replacement for human testing, humans are still needed to interpret the results and make decisions based on the findings.</li><li>It can be a costly investment to implement and maintain the AI algorithms.</li></ul><p>One of the key benefits of AI in automation testing is its ability to perform repetitive tasks with high accuracy and efficiency. AI algorithms can quickly identify patterns and anomalies in the software being tested, making it possible to catch bugs and other issues before they become a problem for users. Additionally, AI can learn from its previous testing experience and adapt to new situations, becoming more efficient and accurate over time.</p><p>Another benefit of AI-assisted automation testing is its ability to perform tests that are difficult or impossible for humans to perform manually. For example, AI can test the software’s ability to handle large amounts of data or perform complex calculations. AI can also test the software’s ability to handle different user inputs and scenarios, which is especially useful for testing applications with a high degree of complexity.</p><p>AI-assisted automation testing also has the potential to reduce the costs associated with software testing. By automating repetitive tasks and reducing the need for human intervention, AI can help to lower labor costs and improve the efficiency of the testing process. This can also help to reduce the overall time required for testing, which can save time and resources for both the testing team and the development team.</p><p>There are a few things to consider when implementing AI-assisted automation testing. The first is the quality of the data that is used to train the AI algorithms. The AI will learn from the data it is trained on, so it is essential to make sure that the data is accurate, representative, and unbiased. This will help to ensure that the AI is able to accurately identify bugs and other issues in the software.</p><p>Another thing to consider is the type of AI that is used. There are different types of AI, such as supervised learning and unsupervised learning, and each has its own strengths and weaknesses. The type of AI that is best suited to a particular task will depend on the specific requirements</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=55b2fa276644" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>