Skip to content

A easy way to implement and write Selenium with TypeScript using Deno 🦕

License

Notifications You must be signed in to change notification settings

kinotio/drowser

Repository files navigation

Drowser

build deno module deno compatibility license

A easy way to implement and write Selenium with TypeScript using Deno 🦕

Features

  • Easy handling on driver side web browser to isolate each test ✅.
  • Get a daily log file to check all test process if passed or failed ✅.
  • Export each test case inside the reports ✅.

Configuration

Create a drowser.json in root directory and define some configuration like this:

  • url: The url of platform or website that need to be test
{
  "url": "http://url_of_the_platform_need_to_be_tested"
}

Deno 2

Install npm dependecies on node_modules with this command:

deno install --allow-scripts

Usage

In test file , Define a sample test like this:

With this test we only test this sample code inside a Chrome ,Firefox but create a test for another web browser like Edge, Safari 🚀

import { driver } from "https://deno.land/x/drowser@v0.1.6/mod.ts";

driver({ browser: "chrome" })
  .then(({ service }) => {
    service.cases = [
      {
        name: "Verify Failed Title",
        fn: async ({ builder, assert }) => {
          const title = await builder.getTitle();
          assert.assertEquals(title, "Drowsers");
        },
      },
      {
        name: "Verify Title",
        fn: async ({ builder, assert }) => {
          const title = await builder.getTitle();
          assert.assertEquals(title, "Drowser");
        },
      },
    ];
  })
  .catch((error) => console.log(error));

driver({ browser: "firefox" })
  .then(({ service }) => {
    service.cases = [
      {
        name: "Verify Failed Title",
        fn: async ({ builder, assert }) => {
          const title = await builder.getTitle();
          assert.assertEquals(title, "Drowsers");
        },
      },
      {
        name: "Verify Title",
        fn: async ({ builder, assert }) => {
          const title = await builder.getTitle();
          assert.assertEquals(title, "Drowser");
        },
      },
    ];
  })
  .catch((error) => console.log(error));

Drowser Studio

Each test case is saved inside the drowser-reports.json file , and this file is exploitable inside the Drowser Studio who is developed by the Kinotio Team in this repo , who is open-source

Import this reports inside of the studio to visualize all the metrics for main cases or each test case

LICENSE

This project is licensed under the MIT License - see the LICENSE file for details.