DPI : Settings checkbox Enable and Disable function test added

This commit is contained in:
Ajas 2024-06-07 23:08:38 +05:30
parent d599517375
commit fe9ce1d8c9

View file

@ -63,7 +63,6 @@ test.describe('General - Dashboard - Network Analyzer - Deep Packet Inspection',
const dpiMap = await page.locator('#dpi-map');
const isVisible = await dpiMap.isVisible();
const isEnabled = await dpiMap.isEnabled();
expect(isVisible && isEnabled).toBeTruthy();
});
@ -123,6 +122,7 @@ test.describe('General - Dashboard - Network Analyzer - Deep Packet Inspection',
});
await page.click('#detail-tab-dpi');
await page.waitForTimeout(15000)
});
test('Detail Explorer Top Cards', async ({ page }) => {
@ -215,6 +215,8 @@ test.describe('General - Dashboard - Network Analyzer - Deep Packet Inspection',
await page.goto('network-analyzer/deep-packet-inspector', { waitUntil: 'networkidle' });
await page.click('#liveview-tab-dpi');
await page.waitForTimeout(15000)
});
test('Toggle icon is Pause', async ({ page }) => {
@ -242,6 +244,8 @@ test.describe('General - Dashboard - Network Analyzer - Deep Packet Inspection',
test.beforeEach(async ({ page }) => {
await page.goto('network-analyzer/deep-packet-inspector', { waitUntil: 'networkidle' });
await page.click('#settings-tab-dpi');
await page.waitForTimeout(15000)
});
test('Enable Label', async ({ page }) => {
@ -253,6 +257,56 @@ test.describe('General - Dashboard - Network Analyzer - Deep Packet Inspection',
expect(checkbox).toBeTruthy();
});
test('Enable Switch Function', async ({ page }) => {
const checkBox = page.locator('.cb-enable');
const isChecked = await checkBox.isChecked();
if (!isChecked) {
await page.evaluate((checkbox) => checkbox.click(), await checkBox.elementHandle());
const saveButton = await page.getByRole('button', { name: 'Save' });
await saveButton.click();
await page.waitForTimeout(8000);
}
const overviewTab = await page.locator('#overview-tab-dpi');
const overviewTabElement = await overviewTab.elementHandle();
const overviewIsEnabled = await overviewTabElement.isEnabled();
const detailExplorerTab = await page.locator('#detail-tab-dpi');
const detailExplorerTabElement = await detailExplorerTab.elementHandle();
const detailExplorerTabIsEnabled = await detailExplorerTabElement.isEnabled();
const liveViewTab = await page.locator('#liveview-tab-dpi');
const liveViewTabElement = await liveViewTab.elementHandle();
const liveViewIsEnabled = await liveViewTabElement.isEnabled();
expect(overviewIsEnabled && detailExplorerTabIsEnabled && liveViewIsEnabled).toBe(true);
});
test('Disable Switch Function', async ({ page }) => {
const checkBox = page.locator('.cb-enable');
const isChecked = await checkBox.isChecked();
if (isChecked) {
await page.evaluate((checkbox) => checkbox.click(), await checkBox.elementHandle());
const saveButton = await page.getByRole('button', { name: 'Save' });
await saveButton.click();
await page.waitForTimeout(8000);
}
const overviewTabElement = await page.locator('#overview-tab-dpi').elementHandle();
const detailExplorerTabElement = await page.locator('#detail-tab-dpi').elementHandle();
const liveViewTabElement = await page.locator('#liveview-tab-dpi').elementHandle();
const overviewIsDisable = await overviewTabElement.getAttribute('disabled');
const detailExplorerIsDisable = await detailExplorerTabElement.getAttribute('disabled');
const liveViewIsDisable = await liveViewTabElement.getAttribute('disabled');
expect(overviewIsDisable && detailExplorerIsDisable && liveViewIsDisable).toBe('disabled');
});
test('Ignore Bittorrent Traffic', async ({ page }) => {
expect(await page.$('label:has-text("Ignore Bittorrent Traffic")')).toBeTruthy();
});