Skip to content

Commit

Permalink
test: added anvil-catalog filter search test (#4125)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpaten committed Sep 2, 2024
1 parent 8c3e797 commit ccf362a
Show file tree
Hide file tree
Showing 6 changed files with 242 additions and 26 deletions.
74 changes: 74 additions & 0 deletions explorer/e2e/anvil-catalog/anvilcatalog-filters.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import { test } from "@playwright/test";
import {
testDeselectFiltersThroughSearchBar,
testSelectFiltersThroughSearchBar,
} from "../testFunctions";
import {
anvilcatalogTabs,
ANVIL_CATALOG_FILTERS,
CONSENT_CODE_INDEX,
DBGAP_ID_INDEX,
TERRA_WORKSPACE_INDEX,
} from "./anvilcatalog-tabs";

const filterList = [CONSENT_CODE_INDEX, DBGAP_ID_INDEX, TERRA_WORKSPACE_INDEX];

test('Check that selecting filters through the "Search all Filters" textbox works correctly on the Consortia tab', async ({
page,
}) => {
await testSelectFiltersThroughSearchBar(
page,
anvilcatalogTabs.consortia,
filterList.map((i: number) => ANVIL_CATALOG_FILTERS[i])
);
});

test('Check that selecting filters through the "Search all Filters" textbox works correctly on the Studies tab', async ({
page,
}) => {
await testSelectFiltersThroughSearchBar(
page,
anvilcatalogTabs.studies,
filterList.map((i: number) => ANVIL_CATALOG_FILTERS[i])
);
});

test('Check that selecting filters through the "Search all Filters" textbox works correctly on the Workspaces tab', async ({
page,
}) => {
await testSelectFiltersThroughSearchBar(
page,
anvilcatalogTabs.workspaces,
filterList.map((i: number) => ANVIL_CATALOG_FILTERS[i])
);
});

test('Check that deselecting filters through the "Search all Filters" textbox works correctly on the Consortia tab', async ({
page,
}) => {
await testDeselectFiltersThroughSearchBar(
page,
anvilcatalogTabs.consortia,
filterList.map((i: number) => ANVIL_CATALOG_FILTERS[i])
);
});

test('Check that deselecting filters through the "Search all Filters" textbox works correctly on the Studies tab', async ({
page,
}) => {
await testDeselectFiltersThroughSearchBar(
page,
anvilcatalogTabs.studies,
filterList.map((i: number) => ANVIL_CATALOG_FILTERS[i])
);
});

test('Check that deselecting filters through the "Search all Filters" textbox works correctly on the Workspaces tab', async ({
page,
}) => {
await testDeselectFiltersThroughSearchBar(
page,
anvilcatalogTabs.workspaces,
filterList.map((i: number) => ANVIL_CATALOG_FILTERS[i])
);
});
24 changes: 24 additions & 0 deletions explorer/e2e/anvil-catalog/anvilcatalog-tabs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,27 @@

import { AnvilCatalogTabCollection, TabDescription } from "../testInterfaces";

const ANVIL_CATALOG_SEARCH_FILTERS_PLACEHOLDER_TEXT = "Search all filters...";
export const ANVIL_CATALOG_FILTERS = [
"Consent Code",
"Consortium",
"Data Type",
"dbGap Id",
"Disease (indication)",
"Study Design",
"Study",
"Terra Workspace Name",
];

export const CONSENT_CODE_INDEX = 0;
export const CONSORTIUM_INDEX = 1;
export const DATA_TYPE_INDEX = 2;
export const DBGAP_ID_INDEX = 3;
export const DISEASE_INDICATION_INDEX = 4;
export const STUDY_DESIGN_INDEX = 5;
export const STUDY_INDEX = 6;
export const TERRA_WORKSPACE_INDEX = 7;

export const anvilcatalogTabs: AnvilCatalogTabCollection = {
consortia: {
emptyFirstColumn: false,
Expand All @@ -15,6 +36,7 @@ export const anvilcatalogTabs: AnvilCatalogTabCollection = {
{ name: "Participants", sortable: true },
{ name: "Size (TB)", sortable: true },
],
searchFiltersPlaceholderText: ANVIL_CATALOG_SEARCH_FILTERS_PLACEHOLDER_TEXT,
selectableColumns: [
{ name: "Study", sortable: true },
{ name: "Workspaces", sortable: true },
Expand All @@ -36,6 +58,7 @@ export const anvilcatalogTabs: AnvilCatalogTabCollection = {
{ name: "Participants", sortable: true },
{ name: "Size (TB)", sortable: true },
],
searchFiltersPlaceholderText: ANVIL_CATALOG_SEARCH_FILTERS_PLACEHOLDER_TEXT,
selectableColumns: [],
tabName: "Studies",
url: "/data/studies",
Expand All @@ -54,6 +77,7 @@ export const anvilcatalogTabs: AnvilCatalogTabCollection = {
{ name: "Participants", sortable: true },
{ name: "Size (TB)", sortable: true },
],
searchFiltersPlaceholderText: ANVIL_CATALOG_SEARCH_FILTERS_PLACEHOLDER_TEXT,
selectableColumns: [],
tabName: "Workspaces",
url: "/data/workspaces",
Expand Down
7 changes: 7 additions & 0 deletions explorer/e2e/anvil/anvil-tabs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ export const ORGANISM_TYPE_INDEX = 8;
export const PHENOTYPIC_SEX_INDEX = 9;
export const REPORTED_ETHNICITY_INDEX = 10;

const ANVIL_CMG_SEARCH_FILTERS_PLACEHOLDER_TEXT = "Search all filters...";

export const anvilTabs: AnvilCMGTabCollection = {
activities: {
emptyFirstColumn: false,
Expand All @@ -42,6 +44,7 @@ export const anvilTabs: AnvilCMGTabCollection = {
{ name: "Organism Type", sortable: true },
{ name: "Dataset", sortable: true },
],
searchFiltersPlaceholderText: ANVIL_CMG_SEARCH_FILTERS_PLACEHOLDER_TEXT,
selectableColumns: [
{ name: "Phenotypic Sex", sortable: true },
{ name: "Reported Ethnicity", sortable: true },
Expand All @@ -61,6 +64,7 @@ export const anvilTabs: AnvilCMGTabCollection = {
{ name: "Diagnosis", sortable: true },
{ name: "Dataset", sortable: true },
],
searchFiltersPlaceholderText: ANVIL_CMG_SEARCH_FILTERS_PLACEHOLDER_TEXT,
selectableColumns: [
{ name: "Phenotypic Sex", sortable: true },
{ name: "Reported Ethnicity", sortable: true },
Expand All @@ -80,6 +84,7 @@ export const anvilTabs: AnvilCMGTabCollection = {
{ name: "Diagnosis", sortable: true },
{ name: "Data Modality", sortable: true },
],
searchFiltersPlaceholderText: ANVIL_CMG_SEARCH_FILTERS_PLACEHOLDER_TEXT,
selectableColumns: [
{ name: "Phenotypic Sex", sortable: true },
{ name: "Reported Ethnicity", sortable: true },
Expand All @@ -98,6 +103,7 @@ export const anvilTabs: AnvilCMGTabCollection = {
{ name: "Diagnosis", sortable: true },
{ name: "Dataset", sortable: true },
],
searchFiltersPlaceholderText: ANVIL_CMG_SEARCH_FILTERS_PLACEHOLDER_TEXT,
selectableColumns: [],
tabName: "Donors",
url: "/donors",
Expand All @@ -114,6 +120,7 @@ export const anvilTabs: AnvilCMGTabCollection = {
{ name: "Organism Type", sortable: true },
{ name: "Dataset", sortable: true },
],
searchFiltersPlaceholderText: ANVIL_CMG_SEARCH_FILTERS_PLACEHOLDER_TEXT,
selectableColumns: [
{ name: "Phenotypic Sex", sortable: true },
{ name: "Reported Ethnicity", sortable: true },
Expand Down
Loading

0 comments on commit ccf362a

Please sign in to comment.