<?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 Rupesh kumar Jha on Medium]]></title>
        <description><![CDATA[Stories by Rupesh kumar Jha on Medium]]></description>
        <link>https://medium.com/@rupeshkumarjha039?source=rss-353467242be6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*jK7v-0LPopV7zo15wFCKqQ.jpeg</url>
            <title>Stories by Rupesh kumar Jha on Medium</title>
            <link>https://medium.com/@rupeshkumarjha039?source=rss-353467242be6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 12:30:51 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rupeshkumarjha039/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[TestCafe e2e UI automation framework]]></title>
            <link>https://medium.com/@rupeshkumarjha039/testcafe-e2e-ui-automation-framework-fb4cfb198e75?source=rss-353467242be6------2</link>
            <guid isPermaLink="false">https://medium.com/p/fb4cfb198e75</guid>
            <dc:creator><![CDATA[Rupesh kumar Jha]]></dc:creator>
            <pubDate>Sat, 28 Sep 2024 03:15:44 GMT</pubDate>
            <atom:updated>2024-10-17T06:57:31.192Z</atom:updated>
            <content:encoded><![CDATA[<h2>TestCafe automation testing framework</h2><p>I have created sample TestCafe automation testing framework using typescript.</p><p>So you can implement in your project.</p><p>This is the github link.</p><p><a href="https://github.com/rupesh1395/testcafe-automation-framework-typescript">GitHub - rupesh1395/testcafe-automation-framework-typescript: Testcafe automation testing framework with typescript</a></p><p>Let me know if you need any help regarding above testcafe framework.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fb4cfb198e75" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Test API in TestCafe.]]></title>
            <link>https://medium.com/@rupeshkumarjha039/how-to-test-api-in-testcafe-f6307c890b49?source=rss-353467242be6------2</link>
            <guid isPermaLink="false">https://medium.com/p/f6307c890b49</guid>
            <category><![CDATA[api]]></category>
            <category><![CDATA[testcafe]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[api-testing]]></category>
            <dc:creator><![CDATA[Rupesh kumar Jha]]></dc:creator>
            <pubDate>Sun, 14 Jul 2024 11:58:23 GMT</pubDate>
            <atom:updated>2024-07-14T11:58:23.313Z</atom:updated>
            <content:encoded><![CDATA[<p>API testing is very difficult in java we will have to create a proper framework but in case of Testcafe we do not need to spend too much time .</p><p>You can automate all API tets cases with 1 hr.</p><p>If you have existing functional testing framework then you can easily add API test cases.</p><p>Create a new file and add the below code.</p><p>import * as fs from ‘fs’;</p><p>fixture(‘API Test’)</p><p>.page(Your_URL));</p><p>const Base_URL =</p><p>‘https://testing.com&#39;;</p><p>test(‘Testing All API Resources’, async (t) =&gt; {</p><p>// Testing first API</p><p>const API_first = ‘/api/example’;</p><p>// if you have any login code for your application just add it here</p><p>const result = await t.request({</p><p>url: `${Base_URL}${API_first}`,</p><p>method: ‘GET’,</p><p>headers: {</p><p>Authorization: ‘Your_token_id’</p><p>},</p><p>});</p><p>await t.expect(result.status).eql(200);</p><p>const parsedRequestBody = JSON.parse(result_drawing.body.toString());</p><p>const data = parsedRequestBody;</p><p>await t.expect(data.attributename).eql(‘attributeValue’);</p><p>If you need read the JSON data from the file and fetch token value</p><p>const rawData = fs.readFileSync(filePath, ‘utf8’);</p><p>const json_data = JSON.parse(rawData);</p><p>const token: string = json_data.Attributbute_Name;</p><p>Thank you let me know if you face any issue.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f6307c890b49" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GitHub Action with cypress framework]]></title>
            <link>https://medium.com/@rupeshkumarjha039/github-action-with-cypress-framework-ec5b1a77bd04?source=rss-353467242be6------2</link>
            <guid isPermaLink="false">https://medium.com/p/ec5b1a77bd04</guid>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[cypress]]></category>
            <category><![CDATA[automation-testing]]></category>
            <dc:creator><![CDATA[Rupesh kumar Jha]]></dc:creator>
            <pubDate>Sun, 07 Apr 2024 15:42:20 GMT</pubDate>
            <atom:updated>2024-06-20T13:10:39.840Z</atom:updated>
            <content:encoded><![CDATA[<p>So you do not need Jenkins and TeamCity to run automation test case on daily basis. Do not need to pay for Jenkins and TeamCity.</p><p>We can execute or run the cypress Automation test case with the help of GitHub Action.</p><p>For that you need to create a folder with name “.github” inside your repository when where you have installed cypress.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bYbIcgLs886IBgG4EZjIXQ.png" /></figure><p>Inside “.github” folder create another folder with “workflows” and then create a yaml with name “main.yaml” file inside “workflows” folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l-a6Ow0cHxmvS-TG7CE0Yw.png" /></figure><p>In “Name:” You can put the title name. I used Cypress Automation Test.</p><p>You can copy paste below code in your “main.yaml” file</p><p>name: Cypress Automation Test</p><p>on:</p><p>workflow_dispatch:</p><p>schedule:</p><p>- cron: “0 12 * * 1–5”</p><p>push:</p><p>branches:</p><p>- main</p><p>pull_request:</p><p>jobs:</p><p>cypress:</p><p>runs-on: ubuntu-latest</p><p>steps:</p><p>- name: Checkout Repository</p><p>uses: actions/checkout@v2</p><p>- name: Set up Node.js</p><p>uses: actions/setup-node@v2</p><p>with:</p><p>node-version: 18</p><p>- name: Install Dependencies</p><p>run: npm install</p><p>- name: Run Cypress Tests</p><p>run: npm run cypress:run:dev</p><p>env:</p><p>CI: true</p><p>The term I used “run: npm run cypress:run:dev” In my case I set a command “npm run cypress:run:dev” in package.json file to run the all automation test case. In your case in can use according to your execute command in “run:”.</p><p>Then push this code “your repo\\.github\workflows\main.yaml” in your repository.</p><p>Once you raise the PR(Pull Request) then it will run automatically automation test case.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gnNj27iRdFWkXTMD7yBoLw.png" /></figure><p>All check passed or Failed that means your test case is running.</p><p>Then go to GitHub page and click on “Action” tab there you will also see the the executed test case</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rD5ekMAH3ZlE-2sJmopHaA.png" /></figure><p>After click on result you will see the execution result. In result you will see the how many test cases passed or failed.</p><p>Thank you. Let me know if you have any question.</p><p>Please follow so I can add more stories regarding automation testing.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ec5b1a77bd04" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to handle multiple iframe in Cypress.]]></title>
            <link>https://medium.com/@rupeshkumarjha039/how-to-handle-multiple-iframe-in-cypress-3eb0e25b4515?source=rss-353467242be6------2</link>
            <guid isPermaLink="false">https://medium.com/p/3eb0e25b4515</guid>
            <dc:creator><![CDATA[Rupesh kumar Jha]]></dc:creator>
            <pubDate>Thu, 31 Aug 2023 18:15:48 GMT</pubDate>
            <atom:updated>2024-06-20T13:11:21.530Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>How to handle multiple iframe in Cypress</strong>.</p><p>Just follow the following code.It is easy to use without Cypress plugin.</p><p>cy.get(&#39;iframe&#39;)<br> .then(($iframe) =&gt; {<br> const $iframeOneBody = $iframe.contents()<br> const $iframeTwoBody= $iframe.contents().find(&#39;#putTheNameOfTheSecondIframeHERE&#39;).contents()</p><p>const $iframeThirdBody= $iframe.contents().find(’#putTheNameOfTheThirdIframeHERE’).contents()</p><p>cy.wrap($iframeFirstBody)<br> .find(’input.button’)<br> .click({force: true})<br> })</p><p>cy.wrap($iframeTwoBody)<br> .find(’input#elementName’)<br> .click({force: true})<br> .type(’type your data’, { force: true })</p><p>cy.wrap($iframeThirdBody)<br> .find(’input.button’)<br> .click({force: true})<br> })</p><p>Please follow so I can add more stories regarding automation testing.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3eb0e25b4515" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to fix when you are testing two different domains Https and Http in the same test case in…]]></title>
            <link>https://medium.com/@rupeshkumarjha039/how-to-fix-when-you-are-testing-two-different-domains-https-and-http-in-the-same-test-case-in-dda4da17b97d?source=rss-353467242be6------2</link>
            <guid isPermaLink="false">https://medium.com/p/dda4da17b97d</guid>
            <dc:creator><![CDATA[Rupesh kumar Jha]]></dc:creator>
            <pubDate>Sun, 20 Aug 2023 09:24:31 GMT</pubDate>
            <atom:updated>2024-06-20T13:13:04.401Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>How to fix when you are testing two different domains Https and Http in the same test case in Cypress</strong>.</p><p>When I was trying to fix this issue it took lots of time to debug. Finally I found a solution for it.</p><p>So you need to pass chromeWebSecurity as false in Cypress.config.ts</p><p>Look in attached screenshot for example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hEaxUnwwi7ZrmmTQjgTkpw.jpeg" /></figure><p>Please follow so I can add more stories regarding automation testing.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dda4da17b97d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to fix if Cypress gives 404 response when you visit Http URL in E2E UI testing.]]></title>
            <link>https://medium.com/@rupeshkumarjha039/how-to-fix-if-cypress-gives-404-response-when-you-visit-http-url-in-e2e-ui-testing-c3961fffc34c?source=rss-353467242be6------2</link>
            <guid isPermaLink="false">https://medium.com/p/c3961fffc34c</guid>
            <dc:creator><![CDATA[Rupesh kumar Jha]]></dc:creator>
            <pubDate>Sun, 20 Aug 2023 09:16:52 GMT</pubDate>
            <atom:updated>2023-08-20T09:27:26.445Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>How to fix if Cypress gives 404 response when you visit Http URL in E2E UI testing.</strong></p><p>You need to pass failsOnStatusCode as false in visit action.</p><p>For example:</p><p>cy.visit(’your url’, {’failOnStatusCode’: false}):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T-kj35WbGZEhuloEREXoUQ.jpeg" /></figure><p>So it will not fail your test case when Cypress will return 404 over Http URL.</p><p>Let me know in the comments if you are still facing the issue.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c3961fffc34c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setting Up Cypress on Ubuntu WSL2]]></title>
            <link>https://medium.com/@rupeshkumarjha039/setting-up-cypress-on-ubuntu-wsl2-44811b47ff67?source=rss-353467242be6------2</link>
            <guid isPermaLink="false">https://medium.com/p/44811b47ff67</guid>
            <category><![CDATA[ubuntu-wsl2]]></category>
            <category><![CDATA[cypress]]></category>
            <category><![CDATA[automation-framework]]></category>
            <category><![CDATA[nunit]]></category>
            <category><![CDATA[testing]]></category>
            <dc:creator><![CDATA[Rupesh kumar Jha]]></dc:creator>
            <pubDate>Tue, 08 Aug 2023 01:20:24 GMT</pubDate>
            <atom:updated>2024-06-20T13:14:00.521Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>SetUp Cypress framework on Ubuntu WSL2 in Windows</strong></p><p>Steps 1 : Run this command in your project folder</p><p>sudo apt install libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev \<br> libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb \<br> x11-apps build-essential ca-certificates libcurl3-gnutls \<br> libcurl4 libcurl4-openssl-dev</p><p>Step 2</p><p>mkdir ~/bin</p><p>Step 3</p><p>echo &quot;export PATH=~/bin:\$PATH&quot; &gt;&gt; ~/.bashrc</p><p>Step 4</p><p>cd ~/bin</p><p>Step 5</p><p>wget --no-check-certificate https://gist.githubusercontent.com/pjobson<br>/c7983da02ddb81c2c7457775111a4266/raw/<br>90d23250c3466b7a39a76c2082591bd4880b7f5d/install_certs.sh</p><p>steps 6</p><p>chmod +x install_certs.sh</p><p>Step 7<br>sudo ./install_certs.sh</p><p>Make sure you have installed node js and npm</p><p>If not installed then run this command</p><p>curl -k -L https://git.io/n-install | bash</p><p>source ~/.bashrc</p><p>n lts</p><p>To verify run this command<br>node --version<br>npm --version</p><p>Step 8</p><p>Check interface status</p><p>netsh.exe interface show interface</p><p>Step 9</p><p>npm install cypress --save-dev</p><p>Step 10</p><p>If you get a certificate error, disable strict-ssl in npm.</p><p>npm config set strict-ssl false</p><p>Step 11<br> Start running with this command</p><p>./node_modules/.bin/cypress open</p><p>Now you will see cypress configuration setup.</p><p>If you want to add custom report in your project ten follow these steps.</p><p>install cypress-mochawesome-reporter in yor project folder</p><p>npm i --save-dev cypress-mochawesome-reporter</p><p>Change cypress reporter</p><p>Edit config file (cypress.config.js)</p><p>const { defineConfig } = require(&#39;cypress&#39;);</p><p>module.exports = defineConfig({<br> reporter: &#39;cypress-mochawesome-reporter&#39;,<br> e2e: {<br> setupNodeEvents(on, config) {<br> require(&#39;cypress-mochawesome-reporter/plugin&#39;)(on);<br> },<br> },<br>});</p><p>Add to cypress/support/e2e.js</p><p>import &#39;cypress-mochawesome-reporter/register&#39;;</p><p>Run your cypress test, You wil see your html report in reports folder.</p><p>Please follow so I can add more stories regarding automation testing.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=44811b47ff67" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Create selenium C#(CSharp)Data driven framework in 1 hour.]]></title>
            <link>https://medium.com/@rupeshkumarjha039/how-to-create-selenium-c-csharp-data-driven-framework-in-1-hour-deb39047323f?source=rss-353467242be6------2</link>
            <guid isPermaLink="false">https://medium.com/p/deb39047323f</guid>
            <category><![CDATA[framework]]></category>
            <category><![CDATA[selenium-test-automation]]></category>
            <category><![CDATA[c-sharp-programming]]></category>
            <dc:creator><![CDATA[Rupesh kumar Jha]]></dc:creator>
            <pubDate>Sat, 12 Nov 2022 13:00:24 GMT</pubDate>
            <atom:updated>2024-06-20T13:14:45.305Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Prerequisite</strong>:- You should have Visual studio.</p><p>Open Visual studio, go to File-&gt;New-&gt;Project</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/485/1*UZi1qJLTQYPIbPlYbBm4_Q.png" /></figure><ol><li>) Search template “NUnit Test Project” in template search input field.Selct that NUnit Test Project and click on Next button.</li><li>Put the Project name and click on Next button</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*M_3yNFcVOWL3MEv16IlSfQ.png" /></figure><p>Now you should see project in Solution Explorer.</p><p>3.) Right click on on project name and click Mangae NuGet Packages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/463/1*xXXjJ0xbPRit5q2hbohy1g.png" /></figure><p>4.) Install few packges to create data driven framework.</p><p>Following Package you need to install:</p><p>4.1) DotNetSeleniumExtras.pageObjects</p><p>4.2) DotNetSeleniumExtras.pageObjects.core</p><p>4.3) Selenium.Support</p><p>4.4) Selenium.WebDriver</p><p>4.5) SeleniumExtras.WaitHelpers</p><p>4.6)system.configuration.configurationManager</p><p>4.7) WebdriverManager</p><p>4.8) Seleium.community.PageObjects</p><p>4.9) ExtentReports</p><p>If any packages is missing it will give the error no Such Package ..Find package and install.</p><p>5.) Create 3 folders</p><p>Right click on framework go to Add-&gt;New Folder</p><ol><li>Utilities</li><li>Tests</li><li>pageObjects</li></ol><p>6.) Add a App.config file (Right click on framework, go to Add-&gt;New Item and select Application configuration File then click on add button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gDdWXV-hT9aI08yrsXLknA.png" /></figure><p>Paste the Below code in you App.cofig file</p><p>&lt;?xml version=”1.0&quot; encoding=”utf-8&quot; ?&gt;<br>&lt;configuration&gt;<br> &lt;appSettings&gt;<br> &lt;add key =”browser” value=”Chrome”/&gt;<br> &lt;/appSettings&gt;<br>&lt;/configuration&gt;</p><p>7) Inside Utilities folder Cereate 3 files.</p><p><strong>Base.cs</strong></p><p>Add below code in <strong>Base.cs </strong>file</p><p>public class Base<br> {<br> public ExtentReports extent;<br> public ExtentTest test;<br> String browserName;<br> [OneTimeSetUp]<br> public void setup()<br> {<br> string workingDirectory = Environment.CurrentDirectory;<br> string projectDirectory = Directory.GetParent(workingDirectory).Parent.Parent.FullName;<br> String reportPath = projectDirectory + “//index.html”;<br> var htmlReporter = new ExtentHtmlReporter(reportPath);<br> extent = new ExtentReports();<br> extent.AttachReporter(htmlReporter);<br> extent.AddSystemInfo(“Host Name”, “Your Host name”);<br> extent.AddSystemInfo(“Environment”, “Dev”);<br> extent.AddSystemInfo(“Username”, “Your name (Test name)”);<br> }<br> //public IWebDriver driver;<br> public ThreadLocal&lt;IWebDriver&gt; driver = new ThreadLocal&lt;IWebDriver&gt;();<br> [SetUp]<br> public void startBrowser()<br> {<br> test = extent.CreateTest(TestContext.CurrentContext.Test.Name);<br> browserName= TestContext.Parameters[“browserName”];<br> if(browserName==null)<br> {<br> browserName = ConfigurationManager.AppSettings[“browser”];</p><p>}</p><p>InitBrowser(browserName);<br> driver.Value.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5);<br> driver.Value.Manage().Window.Maximize();<br> driver.Value.Url = “https://google.com&quot;;</p><p>}</p><p>public void InitBrowser(string broeserName)<br> {<br> switch(broeserName)<br> {<br> case “Firefox”:<br> <br> new WebDriverManager.DriverManager().SetUpDriver(new FirefoxConfig()); <br> driver.Value = new FirefoxDriver();<br> break;</p><p>case “Chrome”:</p><p>new WebDriverManager.DriverManager().SetUpDriver(new ChromeConfig());<br> driver.Value = new ChromeDriver();<br> break;</p><p>case “edge”:</p><p>new WebDriverManager.DriverManager().SetUpDriver(new EdgeConfig());<br> driver.Value = new EdgeDriver();<br> break;<br> }</p><p>}<br> public IWebDriver getDriver()<br> {<br> return driver.Value;<br> }<br> public static JsonReader getDataParser()<br> {<br> return new JsonReader();<br> }</p><p>[TearDown]<br> public void afterTest()</p><p>{<br> var status = TestContext.CurrentContext.Result.Outcome.Status;<br> var stackTrace = TestContext.CurrentContext.Result.StackTrace;<br> DateTime time = DateTime.Now;<br> String fileName = “Screenshot_” + time.ToString(“h_mm_ss”) + “.png”;</p><p>if (status == TestStatus.Failed)<br> {</p><p>test.Fail(“Test failed”, captureScreenShot(driver.Value, fileName));<br> test.Log(Status.Fail, “test failed with logtrace” + stackTrace);</p><p>}<br> else if(status==TestStatus.Passed)<br> {</p><p>}<br> extent.Flush();<br> driver.Value.Quit();<br> }<br> public MediaEntityModelProvider captureScreenShot(IWebDriver driver, string screenshotName)<br> {<br> ITakesScreenshot ts = (ITakesScreenshot)driver;<br> var screenshot = ts.GetScreenshot().AsBase64EncodedString;<br> return MediaEntityBuilder.CreateScreenCaptureFromBase64String(screenshot, screenshotName).Build();</p><p>}</p><p>}</p><p><strong>JsonReader.cs</strong></p><p>Add Below code in <strong>JsonReader.cs</strong> file</p><p>public JsonReader()<br> {</p><p>}</p><p>public string extractData(String tokenName)<br> {<br> var myjsonString = File.ReadAllText(“utilities/testData.json”);<br> var jsonObject = JToken.Parse(myjsonString);<br> return jsonObject.SelectToken(tokenName).Value&lt;string&gt;();<br> <br> }<br> public string[] extractDataArray(String tokenName)<br> {<br> var myjsonString = File.ReadAllText(“utilities/testData.json”);<br> var jsonObject = JToken.Parse(myjsonString);<br> List&lt;String&gt; productList= jsonObject.SelectTokens(tokenName).Values&lt;string&gt;().ToList();<br> return productList.ToArray();</p><p>}<br> }</p><p><strong>TestData.json</strong></p><p>Add below code in TestData.json file</p><p>{<br> “username”: “yourusernamedetails”,<br> “password”: “yourpassword”</p><p>}</p><p>8.) Inside pageObjects folder create <strong>LoginPage.cs</strong> file</p><p>Add below code in your <strong>Loginpage.cs file</strong></p><p>private IWebDriver driver;<br> public LoginPage(IWebDriver driver) {<br> this.driver = driver;<br> PageFactory.InitElements(driver, this);</p><p>}</p><p>and Write Login amthod or any specfic code according to your requirement.</p><p>You can follow this way.</p><p>//Pageobject factory</p><p>[FindsBy(How = How.Id, Using = “username”)] private IWebElement username;</p><p>[FindsBy(How = How.Name, Using = “password”)] private IWebElement password;</p><p>public ProductsPage LoginMethod(string user, string pass)</p><p>{<br> username.SendKeys(user);<br> password.SendKeys(pass);<br> signInButton.Click();</p><p>}</p><p>Finally, you can create your own test in Test folder and run Test .If you are getting stuck you can comment here.</p><p>Thank you.</p><p>Please follow so I can add more stories regarding automation testing.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=deb39047323f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mostly Used XPath syntax to find unique XPath In Selenium]]></title>
            <link>https://medium.com/@rupeshkumarjha039/mostly-used-xpath-in-selenium-acd57506efe7?source=rss-353467242be6------2</link>
            <guid isPermaLink="false">https://medium.com/p/acd57506efe7</guid>
            <dc:creator><![CDATA[Rupesh kumar Jha]]></dc:creator>
            <pubDate>Fri, 26 Nov 2021 13:34:38 GMT</pubDate>
            <atom:updated>2021-11-30T07:26:12.492Z</atom:updated>
            <content:encoded><![CDATA[<p>Mostly Used XPath syntax to find unique XPath In Selenium</p><p>You can find any xpath with the following syntax.</p><ol><li>//*[text()=’textvalue’]. //* Means it will apply on all HTML tags.(eg.- div,span,button)</li><li>//*[contains(text(),’textvalue’)]</li><li>//*[contains(@class,’classname’)]</li><li>//*[@attrbutename=’attributevalue’]</li><li>//*[contains(text(),’textvalue’)]/following::tagname. (Example-button,span,div)</li><li>//*[contains(text(),’textvalue’)]/following-sibling::tagname</li><li>//*[contains(text(),’textvalue’)]/preceding-sibling::tagname</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=acd57506efe7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to use codeception in MFTF( Magento Functional Testing Framework)]]></title>
            <link>https://medium.com/@rupeshkumarjha039/codeception-commands-in-the-magento-functional-testing-framework-mftf-457b9d17be7e?source=rss-353467242be6------2</link>
            <guid isPermaLink="false">https://medium.com/p/457b9d17be7e</guid>
            <category><![CDATA[magento]]></category>
            <dc:creator><![CDATA[Rupesh kumar Jha]]></dc:creator>
            <pubDate>Mon, 03 Sep 2018 10:12:13 GMT</pubDate>
            <atom:updated>2024-06-20T13:15:11.967Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Note:- If you are using latest magento then Use “mftf” instead of “robo” command</blockquote><blockquote><strong>First Install the Magento</strong></blockquote><blockquote>First Go to your magento root directory.</blockquote><ol><li><strong>Install Composer</strong></li></ol><p><strong>2. Go to dev/tests/acceptance folder</strong></p><p><strong>install composer</strong></p><p>After installed Composer then Run this command</p><p>3.) vendor/bin/mftf build:project :- this command create Functional.suite.yml file and .env file</p><p>Go to .env file update the 4 data.</p><ol><li><strong>MAGENTO_BASE_URL</strong></li></ol><p>For example, MAGENTO_BASE_URL=http://test.com</p><p><strong>2.) MAGENTO_BACKEND_NAME:- Your site admin URL</strong></p><p>For Example, MAGENTO_BACKEND_NAME=admin</p><p><strong>3.) MAGENTO_ADMIN_USERNAME:- Site admin Username</strong></p><p>For Example, MAGENTO_ADMIN_USERNAME=admin</p><p><strong>4.) MAGENTO_ADMIN_PASSWORD:- Site admin password</strong></p><p>For Example, MAGENTO_ADMIN_PASSWORD=adminpassword</p><p>If you do not have the Selenium server yet:</p><ol><li><strong>Go to this site and download the selenium server:- </strong><a href="https://www.seleniumhq.org/download/">https://www.seleniumhq.org/download/</a></li><li><strong>Download chrome driver also from this site:- </strong><a href="https://chromedriver.storage.googleapis.com/index.html?path=2.41/">https://chromedriver.storage.googleapis.com/index.html?path=2.41/</a></li></ol><p>Keep both files selenium server and chromedriver at one place.</p><p>For example, you can keep both files in the htdocs folder or the Magento root directory.</p><p>Open command prompt where you kept selenium server and chromedriver files and run this command:</p><p><strong>java -jar selenium-server-standalone-3.12.0.jar</strong></p><p>Last part is Magento configuration</p><h3>WYSIWYG settings</h3><p>A Selenium web driver cannot enter data to fields with WYSIWYG.</p><p>To disable the WYSIWYG and enable the web driver to process these fields as simple text areas:</p><ol><li><strong>Log in to the Magento Admin as an administrator.</strong></li><li>Navigate to <strong>Stores &gt; Configuration &gt; General &gt; Content Management</strong>.</li><li>In the WYSIWYG Options section set the <strong>Enable WYSIWYG Editor</strong> option to <strong>Disabled Completely</strong>.</li><li>Click <strong>Save Config</strong>.</li></ol><h3>Security settings</h3><p>To enable the <strong>Admin Account Sharing</strong> setting, to avoid unpredictable log out during a testing session, and disable the <strong>Add Secret Key in URLs</strong> setting, to open pages using direct URLs:</p><ol><li>Navigate to <strong>Stores &gt; Configuration &gt; Advanced &gt; Admin &gt; Security</strong>.</li><li>Set <strong>Admin Account Sharing</strong> to <strong>Yes</strong>.</li><li>Set <strong>Add Secret Key to URLs</strong> to <strong>No</strong>.</li><li>Click <strong>Save Config</strong>.</li></ol><p><strong>5. Flush the Magento cache</strong></p><p><strong>Write Your First Test Case for your any Module</strong></p><p>First, Open any IDE script editor -&gt; open this folder</p><p><strong>Magento root directory-&gt;dev/tests/acceptance/tests/functional/Magento/FunctionalTest</strong></p><p>1.) Give the module name for which you want to write a test case.</p><p><strong>For example, Module name:- Sample</strong></p><p>2.) Inside Module, Create 4 folder:-</p><ol><li><strong>Data</strong></li><li><strong>Page</strong></li><li><strong>Section</strong></li><li><strong>Test</strong></li></ol><p><strong>For Example, Sample-&gt;Data,Page,Section,Test</strong></p><p>Now Start a writing a test case</p><p>First, we will start with Page Folder</p><p><strong>1.) Go to Page Folder-&gt;Create a TestPage.xml File</strong></p><p>Depends on You can give any page name. But at end of the name please put <strong>Page.xml</strong></p><p><strong>Sample/Page/TestPage.xml</strong></p><p>The <strong>format</strong> of the TestPage.xml</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br><br>&lt;pages xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;<br>        xsi:noNamespaceSchemaLocation=&quot;../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd&quot;&gt;<br>    &lt;page name=&quot;&quot; url=&quot;&quot; module=&quot;&quot; area=&quot;&quot;&gt;<br>        &lt;section name=&quot;&quot;/&gt;<br>        &lt;section name=&quot;&quot;/&gt;<br>    &lt;/page&gt;<br>&lt;/pages&gt;</pre><p>Now I’ll explain one by one.</p><ol><li><strong>&lt;page name=”name is the same as the file name”</strong></li></ol><p><strong>For Example, &lt;page name=”Testpage”</strong></p><p>2. url= “here you can give Page URL where you can test”</p><p>For Example, I want to test on the product details page.</p><p><strong>url=”/mona-pullover-hoodlie.html”</strong></p><p>3.) Module=” Here you can give the module name(Sample)”</p><p>For Example, I took Sample module name so I put the module name Sample</p><p><strong>Module=”Sample”</strong></p><p>4.) Now area=”Here if your page related to frontend then give the name “<strong>storefront</strong>” Or if your page related to Backend then give the name “<strong>admin</strong>”. ”</p><p>For Example, I gave the page name (product details page) it is related to frontend</p><p><strong>area=”storefront”</strong></p><p><strong>5.)Last Part Section name. Page File may contain several Section name.</strong></p><p>For Example, &lt;section name=”TestSection”/&gt;</p><p>In Section file we write Elemet selector of that page.</p><p><strong>Now We will create Section file inside the Section Folder.</strong></p><p>Sample(Module name)/Section/TestSection.xml</p><p>Depends on You can give any section name. But at end of the name please put <strong>Section.xml</strong></p><p>The Format of the Section file.</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br><br>&lt;sections xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;<br>        xsi:noNamespaceSchemaLocation=&quot;../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd&quot;&gt;<br>    &lt;section name=&quot;&quot;&gt;<br>        &lt;element name=&quot;&quot; type=&quot;&quot; selector=&quot;&quot; /&gt;<br>        &lt;element name=&quot;&quot; type=&quot;&quot; selector=&quot;&quot;/&gt;<br>    &lt;/section&gt;<br>&lt;/sections&gt;</pre><p>Now we will explain one by one inside the section file.</p><p>1 &lt;section name=”Same as file name”&gt;</p><p><strong>For example, &lt;section name=”TestSection”&gt;</strong></p><p>2. &lt;element name=”Here give the name where you want to action of the element”</p><p><strong>For example, Suppose I want to click on “ADD TO CART” button on produt details page in the frontend.</strong></p><p><strong>&lt;element name=”AddtoCart”</strong></p><p>3. type=” here it depends on elements.some elements are like <strong>button</strong>, <strong>input</strong>, <strong>text</strong>, <strong>select</strong> and etc.”</p><p><strong>For Example, I want to click on add to cart button that means it is button So</strong></p><p><strong>type=”button”</strong></p><p>4.)Last part is:- selector=” Here give CSS selector of that element where you want to action.</p><p><strong>For example, I want to click on add to cart button on the product details page so I will give the add to cart button CSS selector</strong></p><p><strong>selector=”button.action.tocart.primary”</strong></p><p><strong>Now we will create the Test file.</strong></p><p><strong>Sample(Module Name)/Test/ProductDetailTest.xml</strong></p><p>Depends on You can give any test name. But at end of the name please put <strong>Test.xml</strong></p><p>The Format of the Test file.</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br><br>&lt;tests xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;<br>       xsi:noNamespaceSchemaLocation=&quot;../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd&quot;&gt;<br>        &lt;test name=&quot;ProductDetailTest&quot;&gt;<br>            &lt;annotations&gt;<br>  &lt;features value=&quot;Add product to the cart on product details page&quot;/&gt;<br>      &lt;stories value=&quot;Add product to the cart on product details page&quot;/&gt;<br>      &lt;description value=&quot;Add product to the cart on product details page&quot;/&gt;<br>      &lt;severity value=&quot;MAJOR&quot;/&gt;<br>      &lt;testCaseId value=&quot;MAGETWO-1312&quot;/&gt;<br>      &lt;group value=&quot;Sample&quot;/&gt;</pre><pre>            &lt;/annotations&gt;</pre><pre>            &lt;before&gt;<br>                &lt;!-- ACTIONS AND ACTION GROUPS PERFORMED BEFORE THE TEST --&gt;</pre><pre>&lt;/before&gt;<br>            &lt;after&gt;<br>                &lt;!-- ACTIONS AND ACTION GROUPS PERFORMED AFTER THE TEST --&gt;<br>&lt;amOnPage url=&quot;admin/admin/auth/logout/&quot; stepKey=&quot;amOnLogoutPage&quot;/&gt;</pre><pre>            &lt;/after&gt;</pre><pre>            &lt;!-- TEST ACTIONS, ACTION GROUPS, AND ASSERTIONS--&gt;</pre><pre>&lt;amOnPage url=&quot;{{TestPage.url}}&quot; stepKey=&quot;NavigateToProductDetalsPage&quot;/&gt;</pre><pre>&lt;click selector=&quot;{{TestSection.AddtoCart}}&quot; stepKey=&quot;clickonAddtoCartButton<strong>”</strong>&quot;/&gt;<br>    &lt;/test&gt;<br>    &lt;/tests&gt;<br>&lt;/config&gt;</pre><p>Now I will explain one by one</p><p><strong>1 . As a beginner, please ignore &lt;before&gt; &lt;/before&gt; this part.</strong></p><p>Because in <strong>&lt;before&gt;</strong> Here you can an action before the test executed like <strong>create a product, create a category &lt;/before&gt;</strong></p><p>2. In<strong> &lt;after&gt;</strong>Here you can any action after the test executed lik<strong>e Log out from admin &lt;/after&gt;</strong></p><p><strong>3 . &lt;amOnPage url=”Here give the Page name.url”</strong></p><p><strong>example, &lt;amOnPage url=”{{TestPage.url}}”</strong></p><p><strong>4. stepKey=” here give the title what are you doing ? in this case I want to go on the product details page. So</strong></p><p><strong>stepKey=”NavigateToProductDetalsPage”</strong></p><p><strong>5. &lt;click selector=”Here give the Section name.element name”</strong></p><p><strong>Example, &lt;click selector=”{{TestSection.AddtoCart}}”</strong></p><p>6. <strong>stepKey=” here give the title what are you doing ? in this case I want to click on add to cart button.So</strong></p><p><strong>stepKey=”clickonAddtoCartButton”</strong></p><blockquote><strong>Go to dev/tests/acceptance folder</strong></blockquote><blockquote>Run this command:-</blockquote><blockquote><strong>“your PHP path” vendor/bin/robo generate: tests</strong></blockquote><blockquote>Then Run</blockquote><p><strong>(Your PHP path) vendor/bin/codecept run tests/functional/Magento/FunctionalTest/_generated/ProductDetailTestCest.php</strong></p><blockquote><strong>vendor/bin/codecept run :- for all test cases.</strong></blockquote><blockquote>List of commands to use in Magento Functional Testing Framework.</blockquote><p><strong>Some Commands in Codeception.</strong></p><p><strong>How to use these all Commands in Magento functional testing framework.</strong></p><p>1.) <strong>click</strong>:- Clicks an element according to given selector or selectorArray</p><p>&lt;<strong>click</strong> selector=”Selector of the element” <strong>stepKey</strong>=”Name of the steps”/&gt;</p><p>For Example:</p><p>&lt;<strong>click</strong> selector=”{{SectionName. ElementName}}” <strong>stepKey</strong>=”ClickOnLoginButton”/&gt;</p><p>2.) <strong>clickWithLeftButton</strong>:- Performs a Left Click on an element according to given selector or selectorArray, or on given x/y coordinate.</p><p>3.)<strong>clickWithRightButton:- </strong>Performs a Right Click on an element according to given selector or selectorArray, or on given x/y coordinate.</p><p>4.)<strong>stepKey:- </strong>Unique identifier for test action.</p><p>For Example:</p><p>&lt;<strong>click</strong> selector=”{{SectionName. ElementName}}” <strong>stepKey</strong>=”ClickOnLoginButton”/&gt;</p><p>5.)<strong>after :- </strong>stepKey of preceding action.</p><p>For example:</p><p>&lt;<strong>after</strong>&gt;<br> &lt;amOnPage url=”admin/admin/auth/logout/” stepKey=”amOnLogoutPage”/&gt;<br> &lt;/<strong>after</strong>&gt;</p><p>6.)<strong>userInput :- </strong>Data or value for Test Action.</p><p>&lt;fillField <strong>userInput</strong>=”Test Data” selector=”Selector of the element” stepKey=”Name of the steps”/&gt;</p><h4>Suppose if you want to take data from element and that data you want to use for assertion .</h4><p>Then You can use following Syntax for this.</p><p><strong>&lt;grabMultiple selector=”Here write CSS Selctor of the element” stepKey=”grabProducts”/&gt;</strong></p><p>Here “grabProducts” used as a variable. That can be Used in Actual Result.</p><p><strong>&lt;assertContains stepKey=”assertContains”&gt;<br> &lt;expectedResult type=”string”&gt;Here Write your expected Result&lt;/expectedResult&gt;<br> &lt;actualResult type=”variable”&gt;grabProducts&lt;/actualResult&gt;</strong></p><p><strong>&lt;/assertContains&gt;</strong></p><p>&lt;expectedResult type it depends on variable which type of data are you using.</p><p>Suppose you are using DIGIT or Count then you can use like</p><p><strong>&lt;expectedResult type=”int”&gt;12&lt;/expectedResult&gt;</strong></p><h4>2.) How to fetch the value from the element used for DATA.</h4><p>If you want to grab or fetch the value from the element and then want use for Fill the Form.</p><p>There is a simple syntax for that</p><p><strong>&lt;grabValueFrom selector=”Here write CSS Selctor of the element” stepKey=”grabProducts”/&gt;</strong></p><p>Here “grabProducts” used as a variable.</p><p><strong>&lt;fillField userInput=”{$grabProducts}” selector=”{{SectionName.elementName}}” stepKey=”FillgrabProductVariableData”/&gt;</strong></p><p>Please follow so I can add more stories regarding automation testing.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=457b9d17be7e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>