Network - DHCP : DHCP options test done
This commit is contained in:
parent
7ba89b995a
commit
1fa86050b3
1 changed files with 86 additions and 0 deletions
|
@ -262,4 +262,90 @@ test.describe('Network & Services - Network - DHCP', () => {
|
|||
expect(page.locator('div:has-text("42,192.168.1.4")')).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('DHCP Options Tab', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto('/network/dhcp', { waitUntil: 'networkidle' });
|
||||
await page.waitForSelector('#options-tab-dndh');
|
||||
const staticLeasesTab = await page.locator('#options-tab-dndh');
|
||||
await staticLeasesTab.click();
|
||||
await page.waitForTimeout(1000);
|
||||
});
|
||||
|
||||
test('Option table', async ({ page }) => {
|
||||
expect(await page.locator('#options-t'));
|
||||
});
|
||||
|
||||
test('Check Add DHCP option Elements', async ({ page }) => {
|
||||
const addButton = await page.locator('#addNewOption');
|
||||
await addButton.click();
|
||||
|
||||
await page.waitForSelector('#newOption');
|
||||
|
||||
const header = await page.$('p:has-text("New DHCP Option")');
|
||||
expect(header).toBeTruthy();
|
||||
|
||||
const optionLabel = await page.$('label:has-text("Option")');
|
||||
expect(optionLabel).toBeTruthy();
|
||||
|
||||
const optionSelectField = await page.locator('.dhcp-opts-options');
|
||||
expect(optionSelectField).toBeTruthy();
|
||||
|
||||
const interfaceLabel = await page.$('label:has-text("Interface")');
|
||||
expect(interfaceLabel).toBeTruthy();
|
||||
|
||||
const interfaceSelectField = await page.locator('.dhcp-opt-iface');
|
||||
expect(interfaceSelectField).toBeTruthy();
|
||||
|
||||
const valueLabel = await page.$('label:has-text("Value")');
|
||||
expect(valueLabel).toBeTruthy();
|
||||
|
||||
const valueInput = await page.locator('#dhcp-opts-value');
|
||||
expect(valueInput).toBeTruthy();
|
||||
|
||||
const saveButton = await page.locator('#saveNewOption');
|
||||
expect(saveButton).toBeTruthy();
|
||||
|
||||
const discardButton = await page.locator('#discardNewOption');
|
||||
expect(discardButton).toBeTruthy();
|
||||
});
|
||||
|
||||
test('Add DHCP Options Values', async ({ page }) => {
|
||||
const addButton = await page.locator('#addNewOption');
|
||||
await addButton.click();
|
||||
|
||||
await page.waitForSelector('#newOption');
|
||||
|
||||
const selectOptionElement = await page.locator('select.dhcp-opts-options');
|
||||
await selectOptionElement.selectOption({ label: '6 - dns-server' });
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
const selectInterfaceElement = await page.locator('select.dhcp-opt-iface');
|
||||
await selectInterfaceElement.selectOption({ label: 'LAN' });
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await page.fill('#dhcp-opts-value', '192.168.1.100');
|
||||
|
||||
const saveButton = await page.locator('#newOptionForm #saveNewOption');
|
||||
await saveButton.click();
|
||||
|
||||
await page.waitForSelector('#options-t');
|
||||
|
||||
await page.waitForSelector('.tabulator-cell[tabulator-field="option"]');
|
||||
const optionValue = await page.$eval('.tabulator-cell[tabulator-field="option"]', cell => cell.textContent.trim());
|
||||
expect(optionValue).toBe('6');
|
||||
|
||||
await page.waitForSelector('.tabulator-cell[tabulator-field="iface"]');
|
||||
const interfaceValue = await page.$eval('.tabulator-cell[tabulator-field="iface"]', cell => cell.textContent.trim());
|
||||
expect(interfaceValue).toBe('LAN');
|
||||
|
||||
await page.waitForSelector('.tabulator-cell[tabulator-field="optionName"]');
|
||||
const optionName = await page.$eval('.tabulator-cell[tabulator-field="optionName"]', cell => cell.textContent.trim());
|
||||
expect(optionName).toBe('dns-server');
|
||||
|
||||
await page.waitForSelector('.tabulator-cell[tabulator-field="value"]');
|
||||
const currentValue = await page.$eval('.tabulator-cell[tabulator-field="value"]', cell => cell.textContent.trim());
|
||||
expect(currentValue).toBe('192.168.1.100');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue