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