Taiko - Installation And Start Writing Your Test Scripts...
@GIFER

Taiko - Installation And Start Writing Your Test Scripts...

Writing your first Taiko script is a simple process, as Taiko is designed to have a user-friendly and straightforward API. Here's a step-by-step guide to writing your first Taiko script:

Prerequisites:

Ensure you have Node.js installed on your system. You can download it from the official website: https://nodejs.org/

Advisable is to download the LTS version as it would be more stable

Downloaded Node.js Version

Click on the downloaded Window Installer Package

We will get the below screen and click on Next Button> Accept the End User License Agreement and click on Next > Click on Next >Click on Next>Click on Next>Click Install

Select Yes and it will take some secs to install > click Finish

Setup Screen

Check that node is install on your system , we can check on cmd as below

Node version

Quick Installation:

If you want to experiment or quickly automate a web page you can get started with Taiko using Node's npx package runner.

Type below command in cmd

Use Taiko using Node's npx package runner

This will download chromium browser and launch Taiko's recorder.

Taiko Started on cmd

To see what all APIs are available in Taiko , Type below command and it will display the API references.

Shortcut to get Taiko API References

Here, with the help of API reference you can start with Baby Step, Bingo we open browser > navigated to google > clicked on "I'm Feeling Lucky" button and navigated to doodles page.

This is just a start, we have to learn lot more

First Taiko Script

Taiko’s REPL keeps a history of all successful commands. Once you finish an execution flow, generate a test script using the special command .code

Now , You can save this script in .js file (All taiko scripts should be saved with .js extension)

Type .code

Generate Code

You can save the code in .js file as below

Check the saved file in users folder

We can run the same google.js from cmd and it will perform the same actions as we did above.

First get out the existing session by .exit

and Type Below command to run google.js script

Run first save taiko script


Taiko Runs in headless mode , we will see in our next article how to run in headful mode or in visible browser.

Global Installation #

If prefer having the taiko command installed globally, you can run below command on cmd. We need to wait for sometime for the download and can check the version as below

Taiko Global Installation and Version

Local installation #

As any other Node.js library Taiko, you can add Taiko to your node projects by running

npm install -D taiko        

This will add Taiko as a dev dependency in your project's package.json

You can also run

npx taiko
        

To launch the Taiko recorder locally. This will refer to the local installation of Taiko in the node_modules folder.

Install options #

You can skip downloading chromium while running or install Taiko by setting the environment variable TAIKO_SKIP_CHROMIUM_DOWNLOAD to true for example in bash or zsh

TAIKO_SKIP_CHROMIUM_DOWNLOAD=true npx taiko
        

Each Operating System has it's own way of setting environment variables please refer OS specific instructions on how to do that.

Feel free to drop your thoughts and suggestions in the comments, and don’t hesitate to share them with your friends.

Let’s embark on this learning adventure together, grow our skills, and share our knowledge!

Happy Testing ??????

要查看或添加评论,请登录

Karishma Yadav的更多文章

  • JAVA Singleton Design Pattern

    JAVA Singleton Design Pattern

    Introduction Ensuring that only one class instance exists can be crucial in software development. The Singleton Pattern…

  • JAVA - String Vs StringBuilder Vs StringBuffer

    JAVA - String Vs StringBuilder Vs StringBuffer

    String It is a sequence of characters. String Class objects are immutable, meaning they cannot be changed once created.

  • Java - Marker Interface

    Java - Marker Interface

    Interface with no fields or methods i.e.

  • Selenium 4- Launch Chrome, Firefox and Edge Browser

    Selenium 4- Launch Chrome, Firefox and Edge Browser

    Pre-requisite to run the selenium test script IDE - Eclipse IDE for Java Developers (version- 4.26.

  • Fundamentals of Git and GitHub

    Fundamentals of Git and GitHub

    What is Git? It is a Version Control System that helps us to track code changes. Why Git? Free and Open Source Fast And…

  • Assertions in Taiko

    Assertions in Taiko

    Assertions is a mechanism used to compare the actual output with the expected output while testing the functionality…

    1 条评论
  • Javascript - Miscellaneous

    Javascript - Miscellaneous

    Difference between null and undefined null and undefined are two distinct types that represent different values. By…

    3 条评论
  • Functions in Javascript

    Functions in Javascript

    A JavaScript function is a block of code designed to perform a particular task. Function Definition - Before we use a…

  • Higher-order Functions in JS

    Higher-order Functions in JS

    Higher order functions are functions that take one or more functions as arguments, or returns a function as its result.…

  • Arrow Functions In Javascript

    Arrow Functions In Javascript

    Arrow functions were introduced in the ES6 version. They make the code more structured and readable.

社区洞察

其他会员也浏览了