Skip to content

Commit

Permalink
#130 : Test
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentD06 committed Dec 17, 2024
1 parent a3ab21e commit 7abd03d
Showing 1 changed file with 44 additions and 5 deletions.
49 changes: 44 additions & 5 deletions e2e/tests/wizard.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ import crypto from 'node:crypto';
test('statistics rule should retain field', async ({ page }) => {
await page.goto('/wizard/AlertRules');

const title = `AAA - ${crypto.randomUUID()}`
await page.getByLabel('Username').fill('admin');
await page.getByLabel('Password').fill('admin');
await page.getByLabel('Sign in').click();
//await page.getByLabel('Cancel').click();
await _login_steps(page);

const title = `AAA - ${crypto.randomUUID()}`;

await page.getByRole('link', { name: 'Create' }).click();
await page.getByRole('button', { name: 'Statistics' }).click();
Expand All @@ -28,3 +26,44 @@ test('statistics rule should retain field', async ({ page }) => {
await page.getByRole('link', { name: 'Edit' }).click();
await expect(page.getByText('source – string')).toBeVisible();
});


test('go_on_search_page_when_click_on_search_button', async ({ page }) => {
await page.goto('/wizard/AlertRules');

await _login_steps(page);

// Fill Title
const title = `AAA - ${crypto.randomUUID()}`;
await page.getByRole('link', { name: 'Create' }).click();
await page.locator('#title').fill(title);

// Add Field Condition
await page.getByRole('button', { name: 'add_circle' }).click();
await page.locator('#field-input').fill('message');
await page.waitForTimeout(200);
await page.getByText('arrow_drop_down').nth(2).click();
await page.getByRole('option', { name: 'matches exactly' }).click();
await page.locator('#value').fill('abc');

// Fill Search Query
const searchQuery = 'a?c';
await page.locator('#search_query').fill(searchQuery);

// Save
await page.getByRole('button', { name: 'Save' }).click();

// Go on search page
await page.getByPlaceholder('Filter alert rules').fill(title);
await page.waitForTimeout(2000);
await page.getByRole('link', { name: 'play_arrow' }).click();

await expect(page.getByText(title)).toBeVisible();
await expect(page.getByText(searchQuery)).toBeVisible();
});

async function _login_steps(page) {
await page.getByLabel('Username').fill('admin');
await page.getByLabel('Password').fill('admin');
await page.getByLabel('Sign in').click();
}

0 comments on commit 7abd03d

Please sign in to comment.