Network and Services : Network Overview added
This commit is contained in:
parent
254dede49b
commit
514c855fea
3 changed files with 64 additions and 13 deletions
|
@ -122,7 +122,7 @@ test.describe('General - Dashboard - Network Analyzer - Deep Packet Inspection',
|
||||||
});
|
});
|
||||||
|
|
||||||
await page.click('#detail-tab-dpi');
|
await page.click('#detail-tab-dpi');
|
||||||
await page.waitForTimeout(15000)
|
await page.waitForTimeout(15000);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Detail Explorer Top Cards', async ({ page }) => {
|
test('Detail Explorer Top Cards', async ({ page }) => {
|
||||||
|
@ -216,7 +216,7 @@ test.describe('General - Dashboard - Network Analyzer - Deep Packet Inspection',
|
||||||
|
|
||||||
await page.click('#liveview-tab-dpi');
|
await page.click('#liveview-tab-dpi');
|
||||||
|
|
||||||
await page.waitForTimeout(15000)
|
await page.waitForTimeout(15000);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Toggle icon is Pause', async ({ page }) => {
|
test('Toggle icon is Pause', async ({ page }) => {
|
||||||
|
@ -245,7 +245,7 @@ test.describe('General - Dashboard - Network Analyzer - Deep Packet Inspection',
|
||||||
await page.goto('network-analyzer/deep-packet-inspector', { waitUntil: 'networkidle' });
|
await page.goto('network-analyzer/deep-packet-inspector', { waitUntil: 'networkidle' });
|
||||||
await page.click('#settings-tab-dpi');
|
await page.click('#settings-tab-dpi');
|
||||||
|
|
||||||
await page.waitForTimeout(15000)
|
await page.waitForTimeout(15000);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Enable Label', async ({ page }) => {
|
test('Enable Label', async ({ page }) => {
|
||||||
|
|
37
tests/network/overview.spec.js
Normal file
37
tests/network/overview.spec.js
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
import { test, expect } from '@playwright/test';
|
||||||
|
|
||||||
|
test.describe('Network & Services - Network - Overview', () => {
|
||||||
|
test.beforeEach(async ({ page }) => {
|
||||||
|
await page.goto('/network/overview', { waitUntil: 'networkidle' });
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Title', async ({ page }) => {
|
||||||
|
expect(await page.title()).toBe('Difuse - Network - Overview');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Overview Header', async ({ page }) => {
|
||||||
|
const header = await page.locator('.card-heaer-title');
|
||||||
|
expect(header).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Notification', async ({ page }) => {
|
||||||
|
const notification = await page.locator('.notification');
|
||||||
|
const isVisible = await notification.isVisible();
|
||||||
|
expect(isVisible).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('WAN Label', async ({ page }) => {
|
||||||
|
const wan = await page.$('span:has-text("WAN")');
|
||||||
|
expect(wan).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Lan Label', async ({ page }) => {
|
||||||
|
const wan = await page.$('span:has-text("LAN - SFP / Ethernet")');
|
||||||
|
expect(wan).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('LAN - WiFi Label', async ({ page }) => {
|
||||||
|
const wan = await page.$('span:has-text("LAN - WiFi")');
|
||||||
|
expect(wan).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
|
@ -1,7 +1,7 @@
|
||||||
import IPCIDR from 'ip-cidr';
|
import IPCIDR from "ip-cidr";
|
||||||
import IPAddress from 'ip-address';
|
import IPAddress from "ip-address";
|
||||||
|
|
||||||
export function isValidMacAddress (mac) {
|
export function isValidMacAddress(mac) {
|
||||||
try {
|
try {
|
||||||
const regex = /^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/;
|
const regex = /^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/;
|
||||||
return regex.test(mac);
|
return regex.test(mac);
|
||||||
|
@ -10,7 +10,7 @@ export function isValidMacAddress (mac) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isValidCidr (cidr, type = 0) {
|
export function isValidCidr(cidr, type = 0) {
|
||||||
let [isV4, isV6] = [false, false];
|
let [isV4, isV6] = [false, false];
|
||||||
let tempCidr = null;
|
let tempCidr = null;
|
||||||
|
|
||||||
|
@ -46,20 +46,25 @@ export function isValidCidr (cidr, type = 0) {
|
||||||
|
|
||||||
export async function clickSelect2Dropdown(page, selectSelector) {
|
export async function clickSelect2Dropdown(page, selectSelector) {
|
||||||
const select2ContainerSelector = `${selectSelector} + .select2-container`;
|
const select2ContainerSelector = `${selectSelector} + .select2-container`;
|
||||||
const select2ContainerExists = await page.$(select2ContainerSelector) !== null;
|
const select2ContainerExists =
|
||||||
|
(await page.$(select2ContainerSelector)) !== null;
|
||||||
|
|
||||||
if (!select2ContainerExists) {
|
if (!select2ContainerExists) {
|
||||||
throw new Error('Select2 container not found');
|
throw new Error("Select2 container not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
const select2Selection = `${select2ContainerSelector} .select2-selection`;
|
const select2Selection = `${select2ContainerSelector} .select2-selection`;
|
||||||
await page.click(select2Selection);
|
await page.click(select2Selection);
|
||||||
await page.waitForSelector('.select2-dropdown .select2-results__option');
|
await page.waitForSelector(".select2-dropdown .select2-results__option");
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function hasToastText(page, text) {
|
export async function hasToastText(page, text) {
|
||||||
try {
|
try {
|
||||||
return (await (await page.waitForSelector('.swal2-popup', {state: 'visible'})).textContent()).includes(text);
|
return (
|
||||||
|
await (
|
||||||
|
await page.waitForSelector(".swal2-popup", { state: "visible" })
|
||||||
|
).textContent()
|
||||||
|
).includes(text);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
return false;
|
return false;
|
||||||
|
@ -67,5 +72,14 @@ export async function hasToastText(page, text) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function sleep(ms) {
|
export async function sleep(ms) {
|
||||||
return new Promise(resolve => setTimeout(resolve, ms));
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function isValidDate(date) {
|
||||||
|
try {
|
||||||
|
const dateRegex = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/;
|
||||||
|
return dateRegex.test(date);
|
||||||
|
} catch (error) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue