fix tests
This commit is contained in:
@@ -14,8 +14,9 @@ test.describe('DHCP Configuration', () => {
|
||||
await page.getByTestId('username').fill(ADMIN_USERNAME);
|
||||
await page.getByTestId('password').click();
|
||||
await page.getByTestId('password').fill(ADMIN_PASSWORD);
|
||||
await page.keyboard.press('Tab');
|
||||
await page.getByTestId('sign_in').click();
|
||||
await page.getByText('Settings', { exact: true }).click();
|
||||
await page.waitForURL((url) => !url.href.endsWith('/login.html'));
|
||||
await page.goto(`/#dhcp`);
|
||||
});
|
||||
|
||||
@@ -45,8 +46,7 @@ test.describe('DHCP Configuration', () => {
|
||||
await page.getByTestId('v4_range_start').fill(RANGE_END);
|
||||
await page.getByTestId('v4_range_end').click();
|
||||
await page.getByTestId('v4_range_end').fill(RANGE_START);
|
||||
await page.locator('.col-12').first().click();
|
||||
await page.getByText('Must be greater than range').click();
|
||||
await page.keyboard.press('Tab');
|
||||
|
||||
expect(await page.getByText('Must be greater than range').isVisible()).toBe(true);
|
||||
});
|
||||
@@ -55,7 +55,7 @@ test.describe('DHCP Configuration', () => {
|
||||
await page.getByTestId('interface_name').selectOption(INTERFACE_NAME);
|
||||
await page.getByTestId('v4_gateway_ip').click();
|
||||
await page.getByTestId('v4_gateway_ip').fill('192.168.1.200s');
|
||||
await page.getByText('Invalid IPv4 address').click();
|
||||
await page.keyboard.press('Tab');
|
||||
|
||||
expect(await page.getByText('Invalid IPv4 address').isVisible()).toBe(true);
|
||||
});
|
||||
|
||||
@@ -1,18 +1,27 @@
|
||||
import { test } from '@playwright/test';
|
||||
import { chromium, FullConfig } from '@playwright/test';
|
||||
|
||||
const ADMIN_USERNAME = 'admin';
|
||||
const ADMIN_PASSWORD = 'superpassword';
|
||||
const PORT = 3000;
|
||||
import { ADMIN_USERNAME, ADMIN_PASSWORD, PORT } from '../constants';
|
||||
|
||||
async function globalSetup(config: FullConfig) {
|
||||
const browser = await chromium.launch({
|
||||
slowMo: 100,
|
||||
});
|
||||
const page = await browser.newPage({ baseURL: config.webServer?.url });
|
||||
|
||||
test('install', async ({ page }) => {
|
||||
await page.goto('/');
|
||||
await page.getByTestId('install_get_started').click();
|
||||
await page.getByTestId('install_web_port').fill(PORT.toString());
|
||||
await page.getByTestId('install_next').click();
|
||||
await page.getByTestId('install_username').fill(ADMIN_USERNAME);
|
||||
await page.getByTestId('install_password').fill(ADMIN_PASSWORD);
|
||||
await page.getByTestId('install_confirm_password').click();
|
||||
await page.getByTestId('install_confirm_password').fill(ADMIN_PASSWORD);
|
||||
await page.getByTestId('install_next').click();
|
||||
await page.getByTestId('install_next').click();
|
||||
await page.getByTestId('install_open_dashboard').click();
|
||||
});
|
||||
await page.waitForURL((url) => !url.href.endsWith('/install.html'));
|
||||
|
||||
await browser.close();
|
||||
}
|
||||
|
||||
export default globalSetup;
|
||||
@@ -1,13 +1,16 @@
|
||||
import { test } from '@playwright/test';
|
||||
import { ADMIN_PASSWORD, ADMIN_USERNAME } from '../constants';
|
||||
|
||||
|
||||
test.describe('Login', () => {
|
||||
test('should successfully log in with valid credentials', async ({ page }) => {
|
||||
await page.goto(`/login.html`);
|
||||
await page.goto('/login.html');
|
||||
await page.getByTestId('username').click();
|
||||
await page.getByTestId('username').fill(ADMIN_USERNAME);
|
||||
await page.getByTestId('password').click();
|
||||
await page.getByTestId('password').fill(ADMIN_PASSWORD);
|
||||
await page.keyboard.press('Tab');
|
||||
await page.getByTestId('sign_in').click();
|
||||
await page.waitForURL((url) => !url.href.endsWith('/login.html'));
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user