Skip to main content

index.spec.ts

index.spec.ts - Overview

This file contains Playwright tests for the Dashboards landing page. It tests the creation of a new dashboard, configuration of its name and description, and addition of a time series panel.

Detailed Documentation

test.describe('Dashboards Landing Page', () => { ... })

  • Purpose: Defines a test suite for the Dashboards landing page.
  • Parameters: None
  • Returns: None

test.beforeEach(async ({ baseURL, browser }) => { ... })

  • Purpose: Sets up the test environment before each test case. It logs in, navigates to the application, and assigns the page object.
  • Parameters:
    • baseURL: string - The base URL of the application.
    • browser: Browser - Playwright browser instance.
  • Returns: None

test('Create a new dashboard and configure the name and description', async ({}) => { ... })

  • Purpose: Tests the creation of a new dashboard, configures its name and description, and adds a time series panel.

  • Parameters: None

  • Returns: None

  • Steps:

    1. Renders the dashboards list page with an empty response.
    2. Navigates to the dashboards landing page.
    3. Checks for "No data" text when the dashboard list is empty.
    4. Creates a new dashboard.
    5. Navigates to the dashboard creation page.
    6. Configures the dashboard name and description.
    7. Saves the configuration and verifies the updated values.
    8. Adds a time series panel.
    9. Configures the time series panel title
    10. Verifies that time series widget is rendered.

loginApi(newPage)

  • Purpose: Logs in via API. (Imported from ../fixtures/common)
  • Parameters:
    • newPage: Page - Playwright page object.
  • Returns: None

dashboardsListAndCreate(page, response)

  • Purpose: Mocks the response for the dashboards list and create API calls. (Imported from ./utils)
  • Parameters:
    • page: Page - Playwright page object.
    • response: object - The mocked API response.
  • Returns: None

getIndividualDashboard(page, response, timeSeries = false)

  • Purpose: Mocks the response for the individual dashboard API calls. (Imported from ./utils)
  • Parameters:
    • page: Page - Playwright page object.
    • response: object - The mocked API response.
    • timeSeries: boolean - Flag to indicate the presence of time series data.
  • Returns: None

getTimeSeriesQueryData(page, response)

  • Purpose: Mocks the response for the time series query data API calls. (Imported from ./utils)
  • Parameters:
    • page: Page - Playwright page object.
    • response: object - The mocked API response.
  • Returns: None

Code Examples

None

Clarity and Accuracy

The documentation is based on the provided code.

Include in Getting Started: NO