Posts

Showing posts from February, 2021

Cypress: Storing Values Into A Variable Synchronously

Image
  Hello People, As I have moved towards a new venture in my career, with which I have got opportunity to work with a great and an amazing tool named Cypress.IO . With my previous experience all being into Selenium and JAVA, it was challenging to learn and quickly get into the shoe with Cypress. In my journey of leaning, I got many difficulties as a beginner in Cypress, which I would like to share with all of you. So that it is easier for the people to quickly look and learn from it. So as we all know JavaScript is asynchronous due to its single-threaded programming feature. Thus it becomes very cumbersome to store the variable value taken out from any calculation or on-screen UI element to be used further for any verification purpose. It would always give a undefined  value. Like in the below given example: Simply I visited a site and fetched an attribute using class, invoked its text and saved it into a variable named var1. Now as required, I printed the value of the variable...

Verify a Key exists in a Hashmap

Image
  In a very vast or old Automation suites project, where we have more than 10,000 lines of code and about 1000's test cases. For a new joiner into such projects, ould really find it difficult to understand the existing methods and whether to write new methods for new things or to accommodate into the existing ones only.  Thus, in such cumbersome situations where one feels that a functional method needs to be revamped by the addition of a parameter or a special conditional statement, but doing so may give a massive amount of errors in the entire suite. So instead of adding an additional parameter one way I thought of great help was the use of HashMaps. So let's first understand the concept and working of a HashMap in Java. What is HashMap? Hash table based implementation of the  Map  interface. This implementation provides all of the optional map operations and permits  null  values and the  null  key. (The  HashMap  class is roughly equi...