difuse-playwright/tests/dashboards/telephony.spec.js
hayzam e87dc83fbc
cleanup
: more stds
2024-02-09 00:36:05 +05:30

39 lines
1.5 KiB
JavaScript

import { test, expect } from '@playwright/test';
test.describe('General - Dashboard - Telephony', () => {
test.beforeEach(async ({ page }) => {
await page.goto('/telephony', { waitUntil: 'networkidle' });
});
test('Title', async ({ page }) => {
const title = await page.title();
expect(title).toBe('Difuse - Dashboard - Telephony');
});
test('Top Cards', async ({ page }) => {
const sipExtensions = await page.getByRole('heading', { name: 'SIP Extensions' });
const sipTrunks = await page.getByRole('heading', { name: 'SIP Trunks' });
const currentChannels = await page.getByRole('heading', { name: 'Current Channels' });
const completedCalls = await page.getByRole('heading', { name: 'Completed Calls' });
expect(sipExtensions && sipTrunks && currentChannels && completedCalls).toBeTruthy();
});
test('Endpoint Table', async ({ page }) => {
expect(await page.getByText('Page Size')).toBeTruthy();
});
test('PBX Information', async ({ page }) => {
const yearRegex = /\b\d{4}\b/;
const coreReloadText = await page.textContent('td:has-text("Core Last Reload") + td');
expect(yearRegex.test(coreReloadText)).toBeTruthy();
const asteriskVersionText = await page.textContent('td:has-text("Asterisk Version") + td');
const versionRegex = /^\d+\.\d+\.\d+$/;
expect(versionRegex.test(asteriskVersionText.replaceAll(/\s/g, ''))).toBeTruthy();
const coreStartupTimeText = await page.textContent('#core-startup-time');
expect(yearRegex.test(coreStartupTimeText)).toBeTruthy();
});
});