Skip to content

Commit cfdb82c

Browse files
committed
test: added tests for anvil-cmg datasets backpages (#4080)
1 parent 3861aa1 commit cfdb82c

File tree

4 files changed

+399
-20
lines changed

4 files changed

+399
-20
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { test } from "@playwright/test";
2+
import {
3+
testBackpageAccess,
4+
testBackpageDetails,
5+
testExportBackpage,
6+
} from "../testFunctions";
7+
import { anvilTabs } from "./anvil-tabs";
8+
test("Smoke test `Export to Terra` button on the first available dataset", async ({
9+
context,
10+
page,
11+
}) => {
12+
test.setTimeout(120000);
13+
await testExportBackpage(context, page, anvilTabs.datasets);
14+
});
15+
16+
test("Check access controls on the datasets backpages work for the first two tabs", async ({
17+
page,
18+
}) => {
19+
test.setTimeout(120000);
20+
await testBackpageAccess(page, anvilTabs.datasets);
21+
});
22+
23+
test("Check that information on the backpages matches information in the data tables", async ({
24+
page,
25+
}) => {
26+
test.setTimeout(120000);
27+
await testBackpageDetails(page, anvilTabs.datasets);
28+
});

explorer/e2e/anvil/anvil-tabs.ts

Lines changed: 83 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,28 @@ export const ORGANISM_TYPE_INDEX = 8;
3030
export const PHENOTYPIC_SEX_INDEX = 9;
3131
export const REPORTED_ETHNICITY_INDEX = 10;
3232

33+
const anvilDatasetsPreselectedColumns = [
34+
{ name: "Dataset", sortable: true },
35+
{ name: "Access", sortable: false },
36+
{ name: "Identifier", sortable: true },
37+
{ name: "Consent Group", sortable: true },
38+
{ name: "Organism Type", sortable: true },
39+
{ name: "Diagnosis", sortable: true },
40+
{ name: "Data Modality", sortable: true },
41+
];
42+
const anvilDatasetsSelectableColumns = [
43+
{
44+
name: "Phenotypic Sex",
45+
pluralizedLabel: "phenotypic sexes",
46+
sortable: true,
47+
},
48+
{
49+
name: "Reported Ethnicity",
50+
pluralizedLabel: "reported ethnicities",
51+
sortable: true,
52+
},
53+
];
54+
3355
export const anvilTabs: AnvilCMGTabCollection = {
3456
activities: {
3557
emptyFirstColumn: false,
@@ -62,28 +84,74 @@ export const anvilTabs: AnvilCMGTabCollection = {
6284
{ name: "Dataset", sortable: true },
6385
],
6486
selectableColumns: [
65-
{ name: "Phenotypic Sex", sortable: true },
66-
{ name: "Reported Ethnicity", sortable: true },
87+
{
88+
name: "Phenotypic Sex",
89+
pluralizedLabel: "phenotypic sexes",
90+
sortable: true,
91+
},
92+
{
93+
name: "Reported Ethnicity",
94+
pluralizedLabel: "reported ethnicities",
95+
sortable: true,
96+
},
6797
],
6898
tabName: "BioSamples",
6999
url: "/biosamples",
70100
},
71101
datasets: {
102+
backpageAccessTags: {
103+
deniedLongName: "Access Required",
104+
deniedShortName: "Required",
105+
grantedLongName: "Access Granted",
106+
grantedShortName: "Granted",
107+
},
108+
backpageExportButtons: {
109+
accessNotGrantedMessage:
110+
"To export this dataset, please sign in and, if necessary, request access.",
111+
detailsName: "Dataset Details",
112+
exportTabName: "Export",
113+
exportUrlRegExp: /\.*\/export-to-terra/,
114+
firstButtonName: "Request Link",
115+
firstLoadingMessage: "Your link will be ready shortly...",
116+
newTabMessage:
117+
"If you are a new user or returning user, click sign in to continue.",
118+
secondButtonName: "Open Terra",
119+
secondLandingMessage: "Your Terra Workspace Link is Ready",
120+
},
121+
backpageHeaders: [
122+
{
123+
name: "Dataset ID",
124+
},
125+
{
126+
correspondingColumn: anvilDatasetsPreselectedColumns[3],
127+
name: "Consent group",
128+
},
129+
{
130+
correspondingColumn: anvilDatasetsPreselectedColumns[4],
131+
name: "Organism type",
132+
},
133+
{
134+
correspondingColumn: anvilDatasetsPreselectedColumns[5],
135+
name: "Diagnosis",
136+
},
137+
{
138+
correspondingColumn: anvilDatasetsPreselectedColumns[6],
139+
name: "Data modality",
140+
},
141+
// Skipped the below two columns, since they aren't always readable
142+
{
143+
correspondingColumn: anvilDatasetsSelectableColumns[0],
144+
name: "Phenotypic sex",
145+
},
146+
{
147+
correspondingColumn: anvilDatasetsSelectableColumns[1],
148+
name: "Reported ethnicity",
149+
},
150+
],
72151
emptyFirstColumn: false,
73152
maxPages: 25,
74-
preselectedColumns: [
75-
{ name: "Dataset", sortable: true },
76-
{ name: "Access", sortable: false },
77-
{ name: "Identifier", sortable: true },
78-
{ name: "Consent Group", sortable: true },
79-
{ name: "Organism Type", sortable: true },
80-
{ name: "Diagnosis", sortable: true },
81-
{ name: "Data Modality", sortable: true },
82-
],
83-
selectableColumns: [
84-
{ name: "Phenotypic Sex", sortable: true },
85-
{ name: "Reported Ethnicity", sortable: true },
86-
],
153+
preselectedColumns: anvilDatasetsPreselectedColumns,
154+
selectableColumns: anvilDatasetsSelectableColumns,
87155
tabName: "Datasets",
88156
url: "/datasets",
89157
},

0 commit comments

Comments
 (0)