Traffic Monitor: Period Date test changed to yyyy-mm-dd format validation

This commit is contained in:
Ajas 2024-06-09 01:42:07 +05:30
parent fe9ce1d8c9
commit 254dede49b

View file

@ -1,4 +1,5 @@
import { test, expect } from '@playwright/test';
import { isValidDate } from '../../../utils/utils.js';
test.describe('General - Dashboard - Network Analyzer - Traffic Monitor', () => {
test.describe('Traffic Distribution', () => {
@ -22,20 +23,15 @@ test.describe('General - Dashboard - Network Analyzer - Traffic Monitor', () =>
test('Traffic Monitor select Date', async ({ page }) => {
const selectElement = page.locator('select.period-select');
const options = await selectElement.locator('option');
await expect(selectElement).toBeVisible();
const optionCount = await options.count();
const date = [];
for (let i = 0; i < optionCount; i++) {
const option = options.nth(i);
const value = await option.getAttribute('value');
date.push(value);
const currentValue = await selectElement.inputValue();
if (currentValue === 'Period') {
expect(currentValue).toBe('Period');
} else {
expect(isValidDate(currentValue)).toBeTruthy();
}
await selectElement.selectOption(date[1]);
const selectedValue = await selectElement.inputValue();
expect(selectedValue).toBe(date[1]);
});
test('Tabs', async ({ page }) => {