Skip to content
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

feat: side by side #977

Merged
merged 2 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions client/__tests__/e2e/cell-guide.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ describe("CellGuideCXG", () => {
test("page launched", async ({ page }, testInfo) => {
await goToPage(page, pageURLCellGuide);

const element = await page.getByTestId("header").innerHTML();

expect(element).toMatchSnapshot();

await snapshotTestGraph(page, testInfo);
});

Expand Down
62 changes: 37 additions & 25 deletions client/__tests__/e2e/cellxgeneActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -605,37 +605,34 @@ export async function requestGeneInfo(gene: string, page: Page): Promise<void> {
await expect(page.getByTestId(`${gene}:gene-info`)).toBeTruthy();
}

export async function assertGeneInfoCardExists(
export async function assertInfoPanelExists(
gene: string,
page: Page
): Promise<void> {
await expect(page.getByTestId(`${gene}:gene-info`)).toBeTruthy();
await expect(page.getByTestId(`gene-info-header`)).toBeTruthy();
await expect(page.getByTestId(`min-gene-info`)).toBeTruthy();
await expect(page.getByTestId(`info-panel-header`)).toBeTruthy();
await expect(page.getByTestId(`min-info-panel`)).toBeTruthy();

await expect(page.getByTestId(`clear-info-summary`).innerText).not.toEqual(
""
);
await expect(page.getByTestId(`gene-info-synonyms`).innerText).not.toEqual(
""
);

await expect(page.getByTestId(`gene-info-link`)).toBeTruthy();
}

export async function minimizeGeneInfo(page: Page): Promise<void> {
await page.getByTestId("min-gene-info").click();
export async function minimizeInfoPanel(page: Page): Promise<void> {
await page.getByTestId("min-info-panel").click();
}

export async function assertGeneInfoCardIsMinimized(
export async function assertInfoPanelIsMinimized(
gene: string,
page: Page
): Promise<void> {
const testIds = [
`${gene}:gene-info`,
"gene-info-header",
"min-gene-info",
"clear-gene-info",
"info-panel-header",
"max-info-panel",
"close-info-panel",
];

await tryUntil(
Expand All @@ -644,27 +641,24 @@ export async function assertGeneInfoCardIsMinimized(
const result = await page.getByTestId(id).isVisible();
await expect(result).toBe(true);
}

const result = await page.getByTestId("gene-info-symbol").isVisible();
await expect(result).toBe(false);
},
{ page }
);
}

export async function removeGeneInfo(page: Page): Promise<void> {
await page.getByTestId("clear-gene-info").click();
export async function closeInfoPanel(page: Page): Promise<void> {
await page.getByTestId("close-info-panel").click();
}

export async function assertGeneInfoDoesNotExist(
export async function assertInfoPanelClosed(
gene: string,
page: Page
): Promise<void> {
const testIds = [
`${gene}:gene-info`,
"gene-info-header",
"min-gene-info",
"clear-gene-info",
"info-panel-header",
"min-info-panel",
"close-info-panel",
];
await tryUntil(
async () => {
Expand Down Expand Up @@ -786,6 +780,8 @@ export async function assertUndoRedo(
);
}

const WAIT_FOR_GRAPH_AS_IMAGE_TIMEOUT_MS = 10_000;

export async function snapshotTestGraph(page: Page, testInfo: TestInfo) {
const imageID = "graph-image";

Expand All @@ -795,7 +791,13 @@ export async function snapshotTestGraph(page: Page, testInfo: TestInfo) {
async () => {
await page.getByTestId(GRAPH_AS_IMAGE_TEST_ID).click({ force: true });

await page.getByTestId(imageID).waitFor();
await page
.getByTestId(imageID)
/**
* (thuang): Without explicit `timeout` option, the default timeout is
* 3 minutes, which is too long for this test.
*/
.waitFor({ timeout: WAIT_FOR_GRAPH_AS_IMAGE_TIMEOUT_MS });

await takeSnapshot(page, testInfo);

Expand All @@ -808,8 +810,18 @@ export async function snapshotTestGraph(page: Page, testInfo: TestInfo) {
);
}

export async function selectLayout(layoutChoice: string, page: Page) {
await page.getByTestId(LAYOUT_CHOICE_TEST_ID).click();
export async function selectLayout(
layoutChoice: string,
graphTsetId: string,
sidePanel: string,
page: Page
) {
let layoutChoiceTestId = LAYOUT_CHOICE_TEST_ID;
if (graphTsetId === sidePanel) {
layoutChoiceTestId = `${LAYOUT_CHOICE_TEST_ID}-side`;
}

await page.getByTestId(layoutChoiceTestId).click();

/**
* (thuang): For blueprint radio buttons, we need to tab first to go to the
Expand Down Expand Up @@ -845,7 +857,7 @@ export async function selectLayout(layoutChoice: string, page: Page) {
}
}

await page.getByTestId(LAYOUT_CHOICE_TEST_ID).click();
await page.getByTestId(layoutChoiceTestId).click();

await page.waitForTimeout(WAIT_FOR_SWITCH_LAYOUT_MS);
}
Expand Down
4 changes: 4 additions & 0 deletions client/__tests__/e2e/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const datasets = {
{
"coordinates-as-percent": { x1: 0.1, y1: 0.25, x2: 0.7, y2: 0.75 },
count: "930",
count_side: "1211",
},
],
invalidLasso: [
Expand Down Expand Up @@ -113,6 +114,7 @@ export const datasets = {
lasso: {
"coordinates-as-percent": { x1: 0.3, y1: 0.3, x2: 0.5, y2: 0.5 },
count: "37",
count_side: "45",
},
},
},
Expand Down Expand Up @@ -211,6 +213,7 @@ export const datasets = {
{
"coordinates-as-percent": { x1: 0.1, y1: 0.25, x2: 0.7, y2: 0.75 },
count: "2025",
count_side: "1775",
},
],
invalidLasso: [
Expand Down Expand Up @@ -284,6 +287,7 @@ export const datasets = {
lasso: {
"coordinates-as-percent": { x1: 0.3, y1: 0.3, x2: 0.5, y2: 0.5 },
count: "221",
count_side: "221",
},
},
},
Expand Down
Loading
Loading