Network - WAN : IPv4 Tab completed
This commit is contained in:
parent
948403697f
commit
3412a6d178
1 changed files with 94 additions and 46 deletions
|
@ -2,60 +2,108 @@ import { test, expect } from '@playwright/test';
|
|||
import { isValidMacAddress, isValidPrivateIPV4 } from '../../utils/utils.js';
|
||||
|
||||
test.describe('Network & Services - Network - WAN', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto('/network/wan', { waitUntil: 'networkidle' });
|
||||
});
|
||||
test.describe('IPV4 Tab', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto('/network/wan', { waitUntil: 'networkidle' });
|
||||
await page.waitForTimeout(3000);
|
||||
});
|
||||
|
||||
test('Title', async ({ page }) => {
|
||||
expect(await page.title()).toBe('Difuse - Network - WAN');
|
||||
});
|
||||
test('Title', async ({ page }) => {
|
||||
expect(await page.title()).toBe('Difuse - Network - WAN');
|
||||
});
|
||||
|
||||
test('Card Header Title', async ({ page }) => {
|
||||
const title = await page.locator('.card-header-title');
|
||||
expect(await title).toBeTruthy();
|
||||
});
|
||||
test('Card Header Title', async ({ page }) => {
|
||||
const title = await page.locator('.card-header-title');
|
||||
expect(await title).toBeTruthy();
|
||||
});
|
||||
|
||||
test('IPv4 Info Tables', async ({ page }) => {
|
||||
const rows = await page.$$('table > tbody > tr');
|
||||
test('IPv4 Info Tables', async ({ page }) => {
|
||||
const rows = await page.$$('table > tbody > tr');
|
||||
|
||||
for (let i = 0; i < rows.length && i < 6; i++) {
|
||||
const row = rows[i];
|
||||
const cells = await row.$$('td');
|
||||
if (cells.length === 2) {
|
||||
const label = await cells[0].textContent();
|
||||
const value = await cells[1].textContent();
|
||||
console.log(label + ' : ' + value);
|
||||
|
||||
if (label === 'Protocol') {
|
||||
expect(value).toBe('DHCPv4');
|
||||
} else if (label === 'Uptime') {
|
||||
expect(typeof parseInt(value)).toBe('number');
|
||||
} else if (label === 'MAC') {
|
||||
expect(isValidMacAddress(value)).toBeTruthy();
|
||||
} else if (label === 'RX' || label === 'TX') {
|
||||
expect(typeof parseInt(value)).toBe('number');
|
||||
} else if (label === 'IPv4') {
|
||||
expect(isValidPrivateIPV4(value)).toBe(true);
|
||||
for (let i = 0; i < rows.length && i < 6; i++) {
|
||||
const row = rows[i];
|
||||
const cells = await row.$$('td');
|
||||
if (cells.length === 2) {
|
||||
const label = await cells[0].textContent();
|
||||
const value = await cells[1].textContent();
|
||||
if (label === 'Protocol') {
|
||||
expect(value).toBe('DHCPv4');
|
||||
} else if (label === 'Uptime') {
|
||||
expect(typeof parseInt(value)).toBe('number');
|
||||
} else if (label === 'MAC') {
|
||||
expect(isValidMacAddress(value)).toBeTruthy();
|
||||
} else if (label === 'RX' || label === 'TX') {
|
||||
expect(typeof parseInt(value)).toBe('number');
|
||||
} else if (label === 'IPv4') {
|
||||
expect(isValidPrivateIPV4(value)).toBe(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
test('Restart WAN Interface', async ({ page }) => {
|
||||
const restartButton = await page.locator('#restartWAN');
|
||||
const visible = await restartButton.isVisible();
|
||||
expect(visible).toBeTruthy();
|
||||
});
|
||||
test('Restart WAN Interface', async ({ page }) => {
|
||||
const restartButton = await page.locator('#restartWAN');
|
||||
const visible = await restartButton.isVisible();
|
||||
expect(visible).toBeTruthy();
|
||||
});
|
||||
|
||||
test('Stop WAN Interface', async ({ page }) => {
|
||||
const stopWAN = await page.locator('#stopWAN');
|
||||
const visible = await stopWAN.isVisible();
|
||||
expect(visible).toBeTruthy();
|
||||
});
|
||||
test('Stop WAN Interface', async ({ page }) => {
|
||||
const stopWAN = await page.locator('#stopWAN');
|
||||
const visible = await stopWAN.isVisible();
|
||||
expect(visible).toBeTruthy();
|
||||
});
|
||||
|
||||
test('Disable WAN Interface', async ({ page }) => {
|
||||
const disableWAN = await page.locator('#disableWAN');
|
||||
const visible = await disableWAN.isVisible();
|
||||
expect(visible).toBeTruthy();
|
||||
test('Disable WAN Interface', async ({ page }) => {
|
||||
const disableWAN = await page.locator('#disableWAN');
|
||||
const visible = await disableWAN.isVisible();
|
||||
expect(visible).toBeTruthy();
|
||||
});
|
||||
|
||||
test('IPv4 Protocol Static IP', async ({ page }) => {
|
||||
const label = await page.locator('label:has-text("Protocol")');
|
||||
expect(label).toBeTruthy();
|
||||
|
||||
const selectElement = await page.locator('select.proto-select');
|
||||
|
||||
await selectElement.selectOption({ label: 'Static IP' });
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
const isVisible = await page.isVisible('#staticip-sub-div');
|
||||
expect(isVisible).toBe(true);
|
||||
|
||||
const ipv4Address = await page.locator('label:has-text("IPv4 Address")');
|
||||
const ipv4AddressField = await page.locator('#static-ip');
|
||||
expect(ipv4Address && ipv4AddressField).toBeTruthy();
|
||||
|
||||
const networkMask = await page.locator('label:has-text("Network Mask")');
|
||||
const networkMaskField = await page.locator('select.static-netmask-select');
|
||||
expect(networkMask && networkMaskField).toBeTruthy();
|
||||
|
||||
const ipv4Gateway = await page.locator('label:has-text("IPv4 Gateway")');
|
||||
const ipv4GatewayField = await page.locator('#static-gateway');
|
||||
expect(ipv4Gateway && ipv4GatewayField).toBeTruthy();
|
||||
|
||||
const ipv4Broadcast = await page.locator('label:has-text("IPv4 Broadcast")');
|
||||
const ipv4BroadcastField = await page.locator('#static-broadcast');
|
||||
expect(ipv4Broadcast && ipv4BroadcastField).toBeTruthy();
|
||||
});
|
||||
|
||||
test('IPv4 Protocol PPPoE', async ({ page }) => {
|
||||
const selectElement = await page.locator('select.proto-select');
|
||||
|
||||
await selectElement.selectOption({ label: 'PPPoE' });
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
const isVisible = await page.isVisible('#pppoe-sub-div');
|
||||
expect(isVisible).toBe(true);
|
||||
|
||||
const pppoeUsername = await page.locator('label:has-text("PAP/CHAP Username")');
|
||||
const pppoeUsernameField = await page.locator('#pppoe-username');
|
||||
expect(pppoeUsername && pppoeUsernameField).toBeTruthy();
|
||||
|
||||
const pppoePassword = await page.locator('label:has-text("PAP/CHAP Password")');
|
||||
const pppoePasswordField = await page.locator('#pppoe-password');
|
||||
expect(pppoePassword && pppoePasswordField).toBeTruthy();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue