forked from siglens/siglens
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Playwright Test : SLOs, Minion Searches & Saved Queries Screen (sigle…
…ns#1678) * Playwright Test : SLOs, Minion Searches & Saved Queries Screen * Fix Flaky Test
- Loading branch information
1 parent
4bc0c62
commit a21ddfa
Showing
4 changed files
with
141 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const { test, expect } = require('@playwright/test'); | ||
const { testThemeToggle } = require('./common-functions'); | ||
|
||
test.describe('SLO Screen Test', () => { | ||
test('should have SLOs div with correct heading and message', async ({ page }) => { | ||
// Navigate to the page containing the SLOs div | ||
await page.goto('http://localhost:5122/all-slos.html'); | ||
|
||
// Check if the SLOs div is present | ||
const slosDiv = page.locator('#all-slos'); | ||
await expect(slosDiv).toBeVisible(); | ||
|
||
// Check if the heading is correct | ||
await expect(slosDiv.locator('h1.myOrg-heading')).toHaveText('SLOs'); | ||
|
||
// Check if the enterprise version message is present | ||
await expect(slosDiv).toContainText('This feature is available in Enterprise version'); | ||
|
||
// Theme Button | ||
await testThemeToggle(page); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
const { test, expect } = require('@playwright/test'); | ||
const { testThemeToggle } = require('./common-functions'); | ||
|
||
test.describe('Minion Searches Page Tests', () => { | ||
test('should load minion searches page correctly', async ({ page }) => { | ||
// Navigate to the minion searches page | ||
await page.goto('http://localhost:5122/minion-searches.html'); | ||
|
||
// Check if the main heading is present | ||
await expect(page.locator('.main-heading')).toHaveText('Minion Searches'); | ||
|
||
// Check if all log level buttons are present | ||
const logLevels = ['Error', 'Warning', 'Debug', 'Info']; | ||
for (const level of logLevels) { | ||
const button = page.locator(`.log-pane button#${level.toLowerCase()}`); | ||
await expect(button).toBeVisible(); | ||
await expect(button.locator('h3')).toHaveText(level); | ||
await expect(button.locator('h4')).toHaveText('0'); | ||
} | ||
|
||
// Check if the ag-grid is present | ||
await expect(page.locator('#ag-grid')).toBeVisible(); | ||
await expect(page.locator('.ag-root-wrapper')).toBeVisible(); | ||
|
||
// Check if the grid headers are correct | ||
const expectedHeaders = ['Log Statement', 'Filename', 'Line Number', 'Level', 'State']; | ||
const headers = page.locator('.ag-header-cell-text'); | ||
await expect(headers).toHaveCount(expectedHeaders.length); | ||
for (let i = 0; i < expectedHeaders.length; i++) { | ||
await expect(headers.nth(i)).toHaveText(expectedHeaders[i]); | ||
} | ||
|
||
// Check if the "No Rows To Show" message is visible | ||
await expect(page.locator('.ag-overlay-no-rows-center')).toHaveText('No Rows To Show'); | ||
|
||
// Check if the pagination panel is present | ||
await expect(page.locator('.ag-paging-panel')).toBeVisible(); | ||
|
||
// Check if the result pane is present | ||
await expect(page.locator('.result-pane .header')).toHaveText('Result'); | ||
await expect(page.locator('.result-pane .result-body')).toBeVisible(); | ||
|
||
// Theme Button | ||
await testThemeToggle(page); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
const { test, expect } = require('@playwright/test'); | ||
const { testDateTimePicker, testThemeToggle } = require('./common-functions'); | ||
|
||
test.describe('Saved Queries Tests', () => { | ||
test('Save query, open it, and delete it', async ({ page }) => { | ||
// Save a query | ||
await page.goto('http://localhost:5122/index.html'); | ||
await testDateTimePicker(page); | ||
await page.locator('#query-builder-btn').click(); | ||
await page.waitForTimeout(1000); | ||
await expect(page.locator('#logs-result-container')).toBeVisible(); | ||
|
||
await page.click('#saveq-btn'); | ||
|
||
const dialog = page.locator('[aria-describedby="save-queries"]'); | ||
await dialog.waitFor({ state: 'visible' }); | ||
|
||
await page.fill('[aria-describedby="save-queries"] #qname', 'Test-Query'); | ||
await page.fill('[aria-describedby="save-queries"] #description', 'This is a test query'); | ||
|
||
const saveButton = dialog.locator('.saveqButton'); | ||
await saveButton.waitFor({ state: 'visible' }); | ||
await saveButton.click(); | ||
|
||
const toast = page.locator('#message-toast'); | ||
await expect(toast).toContainText('Query saved successfully'); | ||
|
||
// Open saved-queries.html and verify the saved query | ||
await page.goto('http://localhost:5122/saved-queries.html'); | ||
|
||
// Wait for the ag-grid to load | ||
await page.waitForSelector('.ag-root-wrapper'); | ||
|
||
// Check if the saved query is present in the grid | ||
const cellWithTestQuery = page.locator('.ag-cell-value:has-text("Test-Query")'); | ||
await expect(cellWithTestQuery).toBeVisible(); | ||
|
||
// Click on the saved query | ||
await cellWithTestQuery.click(); | ||
|
||
// Verify that it opens the index page with the table visible | ||
await expect(page).toHaveURL(/index\.html/); | ||
await expect(page.locator('#logs-result-container')).toBeVisible(); | ||
|
||
// Go back to saved queries page | ||
await page.goto('http://localhost:5122/saved-queries.html'); | ||
|
||
// Wait for the ag-grid to load again | ||
await page.waitForSelector('.ag-root-wrapper'); | ||
|
||
// Find and click the delete button for the Test-Query | ||
const deleteButton = page.locator('.ag-row:has-text("Test-Query") .btn-simple'); | ||
await deleteButton.click(); | ||
|
||
// Confirm deletion in the popup | ||
await page.locator('#delete-btn').click(); | ||
|
||
// Verify that the query is no longer in the grid | ||
await expect(cellWithTestQuery).not.toBeVisible(); | ||
|
||
// Theme Button | ||
await testThemeToggle(page); | ||
}); | ||
}); |