-
Notifications
You must be signed in to change notification settings - Fork 21
chore: ensure /describe is not called on Database page in v2 navigation #3869
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
Open
Copilot
wants to merge
8
commits into
main
Choose a base branch
from
copilot/add-e2e-test-for-describe-check
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
4b55300
Initial plan
Copilot d810c75
e2e: add test to ensure /describe is not called on Database page in v…
Copilot aff70a7
e2e: dismiss v2 navigation alert before clicking tabs to fix test tim…
Copilot a2a1d73
Merge branch 'main' into copilot/add-e2e-test-for-describe-check
Raubzeug 83107ce
e2e: replace networkidle+click with direct goto navigation to fix CI …
Copilot 6517798
e2e: remove custom test.setTimeout, rely on default 30s timeout
Copilot e67db0b
e2e: assert all tab hrefs present and add 500ms settle wait before as…
Copilot 434fb3f
e2e: fix prettier formatting on expect() call
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
69 changes: 69 additions & 0 deletions
69
tests/suites/tenant/diagnostics/tabs/databasePageDescribeAbsence.test.ts
This file contains hidden or 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,69 @@ | ||
| import {expect, test} from '@playwright/test'; | ||
|
|
||
| import {database} from '../../../../utils/constants'; | ||
| import {TenantPage} from '../../TenantPage'; | ||
| import {VISIBILITY_TIMEOUT} from '../../constants'; | ||
|
|
||
| test.describe('Database page in v2 navigation - no /describe calls', () => { | ||
| test.beforeEach(async ({page}) => { | ||
| await page.addInitScript(() => { | ||
| localStorage.setItem('enableTenantNavigationV2', JSON.stringify(true)); | ||
| // Dismiss the "Navigation is here now" alert popover so it doesn't block interactions | ||
| localStorage.setItem('isV2NavigationAlertSeen', JSON.stringify(true)); | ||
| }); | ||
| }); | ||
|
|
||
| test('/describe is not called when navigating through Database page tabs', async ({page}) => { | ||
| const describeCalls: string[] = []; | ||
|
|
||
| page.on('request', (request) => { | ||
| if (request.url().includes('/viewer/json/describe')) { | ||
| describeCalls.push(request.url()); | ||
| } | ||
| }); | ||
|
|
||
| const tenantPage = new TenantPage(page); | ||
| await tenantPage.goto({ | ||
| schema: database, | ||
| database, | ||
| databasePage: 'database', | ||
| }); | ||
|
|
||
| await tenantPage.isDiagnosticsVisible(); | ||
|
|
||
| // Find all tab links rendered on the Database page | ||
| const tabsContainer = page.locator('.ydb-database-diagnostics-tabs__tabs'); | ||
| await tabsContainer.waitFor({state: 'visible', timeout: VISIBILITY_TIMEOUT}); | ||
|
|
||
| const tabLinks = tabsContainer.locator('a[data-tab]'); | ||
| const tabCount = await tabLinks.count(); | ||
|
|
||
| // Ensure at least one tab is visible so the test is not vacuously true | ||
| expect(tabCount).toBeGreaterThan(0); | ||
|
|
||
| // Collect all tab hrefs before navigating | ||
| const tabHrefs: string[] = []; | ||
| for (let i = 0; i < tabCount; i++) { | ||
| const href = await tabLinks.nth(i).getAttribute('href'); | ||
| if (href) { | ||
| tabHrefs.push(href); | ||
| } | ||
| } | ||
|
|
||
| // Navigate to each tab URL directly instead of clicking. | ||
| // Clicking tabs + waiting for networkidle is unreliable in a live backend | ||
| // (the app polls continuously, so networkidle never settles), which causes | ||
| // the test to consume its full timeout on every tab and eventually stall CI. | ||
| // Direct goto() waits for the page load event which is sufficient to capture | ||
| // any /describe requests triggered during component mount. | ||
| for (const href of tabHrefs) { | ||
| await page.goto(href); | ||
| await tenantPage.isDiagnosticsVisible(); | ||
|
Raubzeug marked this conversation as resolved.
|
||
| } | ||
|
|
||
| expect( | ||
|
greptile-apps[bot] marked this conversation as resolved.
|
||
| describeCalls, | ||
| `/describe should not be called on the Database page, but was called ${describeCalls.length} time(s): ${describeCalls.join(', ')}`, | ||
| ).toHaveLength(0); | ||
| }); | ||
| }); | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.