Giter Club home page Giter Club logo

sisense-playwright-test-examples's Introduction

Using Playwright for Testing Sisense

Introduction

Playwright is a modern automation library for testing web applications. It provides powerful tools to simulate user interactions and verify the functionality of web applications, including Sisense. This documentation will guide you through setting up a test project with Playwright for testing your Sisense dashboards and widgets.

Prerequisites

Before you begin, ensure you have the following installed:

  • Git
  • Node.js (version 18.16.0 or higher)
  • npm (Node Package Manager)
  • A Sisense environment to test against

Setting up a test project with Playwright

Clone the Playwright test project with tests.

Install/Update all project dependancies

npm install

Install Playwright with browser engines (Chromium, Firefox, WebKit)

npx playwright-core install

Specify Sisense user credentials and Sisense base url in the env.config.ts file

Sisense credentials

Run with VS Code

Getting started with Playwright and VS Code

Run the whole test project

npx playwright test --project=example --headed

Run tests by file name

npx playwright test addUser.test.ts --project=example

Run a test by its name

npx playwright test -g "X-RAY-00001" --project=all

Tests examples description

API test examples can be found in the tests/api folder, which contains:

  • Add user test (addUser.test.ts)
  • Add dashboard and share it test (dashboard.test.ts)
  • Restart pods test (pod.test.ts)

UI test examples can be found in the tests/ui folder, which contains:

  • Build cube test (build.test.ts)
  • Create cube with database connector (connectors.test.ts)
  • Create dashboard test (dashboard.test.ts)
  • Navigate through application test (navigation.test.ts)
  • Create pulse alert (pulse.test.ts)

Create your own tests

You can choose any way to implement your test: Layer1 > Layer2 > Layer3 or vice versa. Each test case consists of several actions (UI or API) = STEPS.

UI: Locator (\src\pages) → UIStep (UIStepClass \src\steps\ui) → Test (\tests) API: Controller (\src\api\controllers) → ApiStep (\src\steps\api) → Test (\tests)

Tests structure

First, search for existing UI/API steps. If the step already exists, you can just add it to your test case. If the step doesn’t exist yet, you can create it using the map above.

To implement a new step:

  • UI: PageObject locator + primitive action (e.g. click(), fill(), innerText(), etc.)
  • API: Controller (get, post, patch, etc.)

Each new UI Steps Class should be added to the Page fixtures (src\fixtures\pages.fixtures.ts) and fixtures you need should be added to your test.

Best Practices

  • Use Page Object Model: Organize your tests using the Page Object Model pattern to improve maintainability and readability.
  • Handle Dynamic Content: Use appropriate waiting strategies to handle dynamic content that may take time to load.
  • Use Environment Variables: Store sensitive information like usernames and passwords in environment variables instead of hardcoding them in your tests.

sisense-playwright-test-examples's People

Contributors

humenskyivlad avatar

Watchers

Moti avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.