-
Notifications
You must be signed in to change notification settings - Fork 5
chore: update findable-ui to latest v38.0.0 (#4528) #4532
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
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
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 |
---|---|---|
@@ -1,28 +1,94 @@ | ||
import test from "@playwright/test"; | ||
import { | ||
testBulkDownloadIndexExportWorkflow, | ||
testIndexExportSummary, | ||
} from "../testFunctions"; | ||
import test, { ElementHandle, Response, Page } from "@playwright/test"; | ||
import { expect } from "@playwright/test"; | ||
import { testBulkDownloadIndexExportWorkflow } from "../testFunctions"; | ||
import { ANVIL_TABS } from "./anvil-tabs"; | ||
import { MUI_CLASSES, TEST_IDS } from "../features/common/constants"; | ||
|
||
test("Smoke test File Manifest Request index export workflow on the Files tab", async ({ | ||
page, | ||
}) => { | ||
test.setTimeout(120000); | ||
const testResult = await testBulkDownloadIndexExportWorkflow( | ||
test.describe("AnVIL Data Explorer Export", () => { | ||
test("Smoke test File Manifest Request index export workflow on the Files tab", async ({ | ||
page, | ||
ANVIL_TABS.FILES | ||
); | ||
if (!testResult) { | ||
test.fail(); | ||
} | ||
}); | ||
}) => { | ||
test.setTimeout(120000); | ||
const testResult = await testBulkDownloadIndexExportWorkflow( | ||
page, | ||
ANVIL_TABS.FILES | ||
); | ||
if (!testResult) { | ||
test.fail(); | ||
} | ||
}); | ||
|
||
test("Verifies that the Selected Data Summary on the export page displays the same label and count as the summary on the BioSamples tab", async ({ | ||
page, | ||
}) => { | ||
await page.goto("/biosamples"); | ||
await page.waitForURL(/\/biosamples/); | ||
await Promise.all([waitForTestId(page, TEST_IDS.ENTITY_SUMMARY)]); | ||
|
||
// Export button should be visible. | ||
const button = page.getByTestId(TEST_IDS.EXPORT_BUTTON); | ||
await expect(button).toBeVisible(); | ||
|
||
// Summary should be visible. | ||
const summaryLocator = page.getByTestId(TEST_IDS.ENTITY_SUMMARY); | ||
await expect(summaryLocator).toBeVisible(); | ||
|
||
// Get each summary span's inner text. | ||
const innerTexts = await summaryLocator | ||
.locator(MUI_CLASSES.TYPOGRAPHY) // Retrieves the count and label and omits the dot separator. | ||
.allTextContents(); | ||
|
||
test("Check that figures in the Selected Data Summary tab on the index export page matches figures on the index page on the BioSamples tab", async ({ | ||
page, | ||
}) => { | ||
const testResult = await testIndexExportSummary(page, ANVIL_TABS.BIOSAMPLES); | ||
if (!testResult) { | ||
test.fail(); | ||
} | ||
// Pair each summary item's label and count by iterating through the text contents | ||
// two at a time, and store them as [label, count] tuples in the summary array. | ||
const summary: [string, string][] = []; | ||
for (let i = 0; i < innerTexts.length; i += 2) { | ||
summary.push([innerTexts[i + 1], innerTexts[i]]); | ||
} | ||
|
||
// Click the export button and wait for the summary API to be called. | ||
await Promise.all([ | ||
button.click(), | ||
page.waitForURL(/\/export/), | ||
page.waitForResponse(urlOrPredicate), | ||
waitForTestId(page, TEST_IDS.EXPORT_SUMMARY), | ||
]); | ||
|
||
// Export summary should be visible. | ||
const exportSummaryLocator = page.getByTestId(TEST_IDS.EXPORT_SUMMARY); | ||
await expect(exportSummaryLocator).toBeVisible(); | ||
|
||
// Test that each summary item is present in the export summary | ||
// with corresponding count. | ||
for (const [label, count] of summary) { | ||
const summaryItem = exportSummaryLocator | ||
.locator("> div") | ||
.filter({ hasText: label }); | ||
await expect(summaryItem).toBeVisible(); | ||
await expect(summaryItem).toContainText(count, { timeout: 5000 }); | ||
} | ||
}); | ||
}); | ||
|
||
/** | ||
* Checks if the response is the index summary API. | ||
* @param r - Response. | ||
* @returns boolean. | ||
*/ | ||
function urlOrPredicate(r: Response): boolean { | ||
return r.url().includes("/index/summary") && r.status() === 200; | ||
} | ||
|
||
/** | ||
* Waits for a locator to be visible. | ||
* @param page - Page. | ||
* @param testId - Test ID. | ||
* @returns Promise<void>. | ||
*/ | ||
function waitForTestId( | ||
page: Page, | ||
testId: string | ||
): Promise<ElementHandle<HTMLElement | SVGElement>> { | ||
return page.waitForSelector(`[data-testid="${testId}"]`, { | ||
state: "visible", | ||
}); | ||
} |
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
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
Oops, something went wrong.
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.
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.
[nitpick] Relying on the generic
.MuiTypography-root
selector can make tests brittle if other typography elements are added. Consider adding or using a dedicateddata-testid
on the summary items to target them more reliably.Copilot uses AI. Check for mistakes.
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.
Leaving it as, for now.