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:
- Renders the dashboards list page with an empty response.
- Navigates to the dashboards landing page.
- Checks for "No data" text when the dashboard list is empty.
- Creates a new dashboard.
- Navigates to the dashboard creation page.
- Configures the dashboard name and description.
- Saves the configuration and verifies the updated values.
- Adds a time series panel.
- Configures the time series panel title
- 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