-
Notifications
You must be signed in to change notification settings - Fork 715
test:Updated logs #4902
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test:Updated logs #4902
Conversation
WalkthroughThe pull request introduces enhancements to the UI testing suite using Playwright, specifically targeting time precision across multiple pages. New test cases for relative seconds have been added to the Logs, Traces, Reports, Dashboard, Alerts, and Metrics pages. Existing tests for absolute seconds have been modified to include time verification steps. Additionally, new methods for setting and verifying time to the past 30 seconds have been added to various page classes. The overall structure and control flow of the tests remain consistent. Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (4)
tests/ui-testing/playwright-tests/secondsPrecisionAdded.spec.js (4)
Line range hint
1-11: Clean up imports and remove debug code.
- Remove commented imports as they clutter the code
- Remove debug console.log statements
import { test, expect } from '@playwright/test'; import { LoginPage } from '../pages/loginPage.js'; import { LogsPage } from '../pages/logsPage.js'; -//import { TracesPage } from '../pages/tracesPage.js'; -//import { ReportsPage } from '../pages/reportsPage.js'; -//import { DashboardPage } from '../pages/dashboardPage.js'; -//import { AlertPage } from '../pages/alertsPage.js'; -//import { MetricsPage } from '../pages/metricsPage.js'; import{ startTimeValue, endTimeValue, startDateTimeValue, endDateTimeValue } from '../pages/CommonLocator.js'; -//import {CommomnLocator} from '../pages/CommonLocator' -//console.log ('Login Started')
Line range hint
13-42: Improve test reliability and assertions.Several improvements needed:
- Replace hardcoded
waitForTimeoutwith proper wait conditions- Add assertions for critical steps
- Remove commented code
test('Relative Seconds on Logs page', async ({ page }) => { const loginPage = new LoginPage(page); const logsPage = new LogsPage(page); await page.goto(process.env["ZO_BASE_URL"]); await loginPage.gotoLoginPage(); await loginPage.login(process.env["ZO_ROOT_USER_EMAIL"], process.env["ZO_ROOT_USER_PASSWORD"]); + await expect(page).toHaveURL(/.*dashboard/); // Verify successful login - await page.waitForTimeout(4000); // Wait for login process + await page.waitForSelector('.logs-page', { state: 'visible' }); // Wait for logs page to be visible await logsPage.navigateToLogs(); - await page.waitForTimeout(3000); // Wait for logs page to load - // await logsPage.selectIndexAndStream(); + await page.waitForSelector('.time-selector', { state: 'visible' }); // Wait for time selector to be visible await logsPage.setTimeToPast30Seconds(); await logsPage.verifyTimeSetTo30Seconds(); await logsPage.signOut(); });
Line range hint
44-589: Remove commented test code and maintain consistency.
- Large blocks of commented code should be removed and tracked in version control instead
- Time value parameters are passed inconsistently:
// Some tests use direct values await tracesPage.fillTimeRange(startTimeValue, endTimeValue); // While others use array syntax await reportsPage.fillTimeRange(["startTimeValue"], ["endTimeValue"]);
- Remove console.log statements from test code
Consider creating separate test files for each page type (e.g.,
logs.spec.js,traces.spec.js, etc.) instead of keeping all tests in one file. This will improve maintainability and make it easier to run specific test suites.
Based on the shell script results, I can now generate a final response since we have clear evidence of the test organization patterns in the codebase.
Split seconds precision tests into feature-specific files to match existing patterns
The codebase already follows a clear pattern of organizing tests by feature, with dedicated spec files for each major functionality:
logspage.spec.js,logsqueries.spec.js,logsquickmode.spec.jsfor logs featuresdashboard.spec.js,dashboardtype.spec.jsfor dashboard featuresalerts.spec.jsfor alerts featuresreports.spec.jsfor reports featuresThe seconds precision tests in
secondsPrecisionAdded.spec.jsshould be split and moved into their respective feature-specific test files to maintain consistency with the existing organization pattern. This will:
- Keep related tests together for better maintainability
- Follow the established project convention
- Make it easier to find and update time-related tests for each feature
🔗 Analysis chain
Line range hint
1-589: Verify test file organization across the codebase.Let's check if other test files follow better organization patterns that we can adopt.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check test file organization patterns # Find all playwright test files and their sizes echo "Test file sizes and line counts:" fd -e spec.js -e test.js . tests/ui-testing/playwright-tests/ -x sh -c 'echo "$(wc -l {}) ($(ls -lh {} | awk "{print \$5}"))"' # Check for test files that might be split by feature echo -e "\nPotential feature-specific test files:" fd -e spec.js -e test.js . tests/ui-testing/playwright-tests/ | grep -iE '(logs|traces|metrics|dashboard|alerts|reports)'Length of output: 2048
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- tests/ui-testing/playwright-tests/secondsPrecisionAdded.spec.js (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
tests/ui-testing/playwright-tests/secondsPrecisionAdded.spec.js (1)
Pattern
**/*.js: You are a smart javascript/typescript pull request reviewer.
You are going to review all the javascript/typescript files.
Be concise, and add a brief explanation to your suggestionsMake sure the responses are not too verbose and keep the suggestions to the point i.e. actionable.
Summary by CodeRabbit
New Features
Bug Fixes