| import { test, expect } from '@playwright/test' |
| import { adminSessionFile } from './lib' |
| import Chance from 'chance' |
| import { createService } from './lib/service' |
| const c = new Chance() |
| test.describe.configure({ mode: 'parallel' }) |
| test.use({ storageState: adminSessionFile }) |
|
|
| test('Admin', async ({ page }) => { |
| const name = 'pw-service ' + c.name() |
| const description = c.sentence() |
| await createService(page, name, description) |
|
|
| await page.goto('./admin/service-metrics') |
|
|
| |
| await expect(page.locator('.MuiDataGrid-overlay')).toHaveCount(0) |
|
|
| const totalServicesLocator = page |
| .locator('.MuiCardHeader-content', { hasText: 'Total Services' }) |
| .locator('.MuiCardHeader-title') |
|
|
| |
| |
| await expect(totalServicesLocator).toHaveText(/^[1-9]\d*$/) |
|
|
| |
| const missingIntsLocator = page |
| .locator('.MuiCardHeader-content', { |
| hasText: 'Services With No Integrations', |
| }) |
| .locator('.MuiCardHeader-title') |
| await expect(missingIntsLocator).toHaveText(/^[1-9]\d*$/) |
|
|
| |
| const missingNotifLocator = page |
| .locator('.MuiCardHeader-content', { |
| hasText: 'Services With Empty Escalation Policies', |
| }) |
| .locator('.MuiCardHeader-title') |
| await expect(missingNotifLocator).toHaveText('0') |
|
|
| |
| const alertLimitLocator = page |
| .locator('.MuiCardHeader-content', { |
| hasText: 'Services Reaching Alert Limit', |
| }) |
| .locator('.MuiCardHeader-title') |
| await expect(alertLimitLocator).toHaveText('0') |
| }) |
|
|