Skip to content

Commit a720f16

Browse files
committed
fix: updated variable names and created constants (#4068)
1 parent 6ac5bb0 commit a720f16

File tree

3 files changed

+51
-11
lines changed

3 files changed

+51
-11
lines changed

explorer/e2e/anvil/anvil-filters.spec.ts

+34-11
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,33 @@ import {
88
testFilterPersistence,
99
testFilterPresence,
1010
} from "../testFunctions";
11-
import { anvilFilters, anvilTabs, anvilTabTestOrder } from "./anvil-tabs";
11+
import {
12+
anvilFilters,
13+
anvilTabs,
14+
anvilTabTestOrder,
15+
BIOSAMPLE_TYPE_INDEX,
16+
CONSENT_GROUP_INDEX,
17+
DATASET_INDEX,
18+
DATA_MODALITY_INDEX,
19+
DIAGNOSIS_INDEX,
20+
FILE_FORMAT_INDEX,
21+
REPORTED_ETHNICITY_INDEX,
22+
} from "./anvil-tabs";
23+
24+
const FILTER_INDEX_LIST = [
25+
DATA_MODALITY_INDEX,
26+
DATASET_INDEX,
27+
DIAGNOSIS_INDEX,
28+
REPORTED_ETHNICITY_INDEX,
29+
FILE_FORMAT_INDEX,
30+
CONSENT_GROUP_INDEX,
31+
];
32+
const FILTER_INDEX_LIST_SHORT = [
33+
BIOSAMPLE_TYPE_INDEX,
34+
FILE_FORMAT_INDEX,
35+
DIAGNOSIS_INDEX,
36+
];
1237

13-
const filterIndexList = [3, 4, 5, 10, 6, 2];
14-
const filterIndexListShort = [1, 10, 3];
1538
test("Check that all filters exist on the Datasets tab and are clickable", async ({
1639
page,
1740
}) => {
@@ -77,7 +100,7 @@ test("Check that filter checkboxes are persistent across pages on an arbitrary f
77100
}) => {
78101
await testFilterPersistence(
79102
page,
80-
anvilFilters[3],
103+
anvilFilters[FILE_FORMAT_INDEX],
81104
anvilTabTestOrder.map((x) => anvilTabs[x])
82105
);
83106
});
@@ -88,8 +111,8 @@ test("Check that filter menu counts match actual counts on the Datasets tab", as
88111
const result = await testFilterCounts(
89112
page,
90113
anvilTabs.datasets,
91-
filterIndexList.map((x) => anvilFilters[x]),
92-
25
114+
FILTER_INDEX_LIST.map((x) => anvilFilters[x]),
115+
anvilTabs.datasets.maxPages ?? 0
93116
);
94117
if (!result) {
95118
test.fail();
@@ -102,8 +125,8 @@ test("Check that filter menu counts match actual counts on the Activities tab",
102125
await testFilterCounts(
103126
page,
104127
anvilTabs.activities,
105-
filterIndexList.map((x) => anvilFilters[x]),
106-
25
128+
FILTER_INDEX_LIST.map((x) => anvilFilters[x]),
129+
anvilTabs.activities.maxPages ?? 0
107130
);
108131
});
109132

@@ -114,7 +137,7 @@ test("Check that the blue filter bubbles match the selected filter for an arbitr
114137
await testFilterBubbles(
115138
page,
116139
anvilTabs.files,
117-
filterIndexListShort.map((x) => anvilFilters[x])
140+
FILTER_INDEX_LIST_SHORT.map((x) => anvilFilters[x])
118141
);
119142
});
120143

@@ -125,7 +148,7 @@ test("Check that the blue filter bubbles match the selected filter for an arbitr
125148
await testFilterBubbles(
126149
page,
127150
anvilTabs.biosamples,
128-
filterIndexListShort.map((x) => anvilFilters[x])
151+
FILTER_INDEX_LIST_SHORT.map((x) => anvilFilters[x])
129152
);
130153
});
131154

@@ -136,6 +159,6 @@ test("Check that the clear all button functions on the files tab", async ({
136159
await testClearAll(
137160
page,
138161
anvilTabs.files,
139-
filterIndexListShort.map((x) => anvilFilters[x])
162+
FILTER_INDEX_LIST_SHORT.map((x) => anvilFilters[x])
140163
);
141164
});

explorer/e2e/anvil/anvil-tabs.ts

+16
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,22 @@ export const anvilFilters: string[] = [
1818
"Phenotypic Sex",
1919
"Reported Ethnicity",
2020
];
21+
export const ANATOMICAL_SITE_INDEX = 0;
22+
export const BIOSAMPLE_TYPE_INDEX = 1;
23+
export const CONSENT_GROUP_INDEX = 2;
24+
export const DATA_MODALITY_INDEX = 3;
25+
export const DATASET_INDEX = 4;
26+
export const DIAGNOSIS_INDEX = 5;
27+
export const FILE_FORMAT_INDEX = 6;
28+
export const IDENTIFIER_INDEX = 7;
29+
export const ORGANISM_TYPE_INDEX = 8;
30+
export const PHENOTYPIC_SEX_INDEX = 9;
31+
export const REPORTED_ETHNICITY_INDEX = 10;
2132

2233
export const anvilTabs: AnvilCMGTabCollection = {
2334
activities: {
2435
emptyFirstColumn: false,
36+
maxPages: 25,
2537
preselectedColumns: [
2638
{ name: "Document Id", sortable: true },
2739
{ name: "Activity Type", sortable: true },
@@ -40,6 +52,7 @@ export const anvilTabs: AnvilCMGTabCollection = {
4052
},
4153
biosamples: {
4254
emptyFirstColumn: false,
55+
maxPages: 25,
4356
preselectedColumns: [
4457
{ name: "BioSample Id", sortable: true },
4558
{ name: "Anatomical Site", sortable: true },
@@ -57,6 +70,7 @@ export const anvilTabs: AnvilCMGTabCollection = {
5770
},
5871
datasets: {
5972
emptyFirstColumn: false,
73+
maxPages: 25,
6074
preselectedColumns: [
6175
{ name: "Dataset", sortable: true },
6276
{ name: "Access", sortable: false },
@@ -75,6 +89,7 @@ export const anvilTabs: AnvilCMGTabCollection = {
7589
},
7690
donors: {
7791
emptyFirstColumn: false,
92+
maxPages: 25,
7893
preselectedColumns: [
7994
{ name: "Donor Id", sortable: true },
8095
{ name: "Organism Type", sortable: true },
@@ -89,6 +104,7 @@ export const anvilTabs: AnvilCMGTabCollection = {
89104
},
90105
files: {
91106
emptyFirstColumn: true,
107+
maxPages: 25,
92108
preselectedColumns: [
93109
{ name: "Name", sortable: true },
94110
{ name: "File Format", sortable: true },

explorer/e2e/testInterfaces.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export interface TabDescription {
22
emptyFirstColumn: boolean;
3+
maxPages?: number;
34
preselectedColumns: columnDescription[];
45
selectableColumns: columnDescription[];
56
tabName: string;

0 commit comments

Comments
 (0)