Skip to content

Commit d95ee59

Browse files
mrtopsytJonah - CC
authored and
Jonah - CC
committed
test: refactored constants and backpage export test (#4080)
1 parent 29a80f7 commit d95ee59

File tree

4 files changed

+119
-74
lines changed

4 files changed

+119
-74
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ import {
66
} from "../testFunctions";
77
import { anvilTabs } from "./anvil-tabs";
88

9-
test.skip("Smoke test `Export to Terra` button on the first available dataset", async ({
9+
test("Smoke test `Export to Terra` button on the first available dataset", async ({
1010
context,
1111
page,
1212
}) => {
1313
test.setTimeout(120000);
1414
await testExportBackpage(context, page, anvilTabs.datasets);
1515
});
1616

17-
test.skip("Check access controls on the datasets backpages work for the first two tabs", async ({
17+
test("Check access controls on the datasets backpages work for the first two tabs", async ({
1818
page,
1919
}) => {
2020
test.setTimeout(120000);

explorer/e2e/anvil/anvil-tabs.ts

Lines changed: 58 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ import {
44
TabCollectionKeys,
55
TabDescription,
66
} from "../testInterfaces";
7+
import {
8+
ANVIL_COLUMN_NAMES,
9+
ANVIL_DATASETS_BACKPAGE_HEADER_NAMES,
10+
ANVIL_PLURALIZED_METADATA_LABELS,
11+
} from "./constants";
712

813
export const anvilFilterNames: string[] = [
914
"Anatomical Site",
@@ -31,23 +36,23 @@ export const PHENOTYPIC_SEX_INDEX = 9;
3136
export const REPORTED_ETHNICITY_INDEX = 10;
3237

3338
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 },
39+
{ name: ANVIL_COLUMN_NAMES.DATASET, sortable: true },
40+
{ name: ANVIL_COLUMN_NAMES.ACCESS, sortable: false },
41+
{ name: ANVIL_COLUMN_NAMES.IDENTIFIER, sortable: true },
42+
{ name: ANVIL_COLUMN_NAMES.CONSENT_GROUP, sortable: true },
43+
{ name: ANVIL_COLUMN_NAMES.ORGANISM_TYPE, sortable: true },
44+
{ name: ANVIL_COLUMN_NAMES.DIAGNOSIS, sortable: true },
45+
{ name: ANVIL_COLUMN_NAMES.DATA_MODALITY, sortable: true },
4146
];
4247
const anvilDatasetsSelectableColumns = [
4348
{
44-
name: "Phenotypic Sex",
45-
pluralizedLabel: "phenotypic sexes",
49+
name: ANVIL_COLUMN_NAMES.PHENOTYPIC_SEX,
50+
pluralizedLabel: ANVIL_PLURALIZED_METADATA_LABELS.PHENOTYPIC_SEX,
4651
sortable: true,
4752
},
4853
{
49-
name: "Reported Ethnicity",
50-
pluralizedLabel: "reported ethnicities",
54+
name: ANVIL_COLUMN_NAMES.REPORTED_ETHNICITY,
55+
pluralizedLabel: ANVIL_PLURALIZED_METADATA_LABELS.PHENOTYPIC_SEX,
5156
sortable: true,
5257
},
5358
];
@@ -57,17 +62,17 @@ export const anvilTabs: AnvilCMGTabCollection = {
5762
emptyFirstColumn: false,
5863
maxPages: 25,
5964
preselectedColumns: [
60-
{ name: "Document Id", sortable: true },
61-
{ name: "Activity Type", sortable: true },
62-
{ name: "Data Modality", sortable: true },
63-
{ name: "BioSample Type", sortable: true },
64-
{ name: "Organism Type", sortable: true },
65-
{ name: "Dataset", sortable: true },
65+
{ name: ANVIL_COLUMN_NAMES.DOCUMENT_ID, sortable: true },
66+
{ name: ANVIL_COLUMN_NAMES.ACTIVITY_TYPE, sortable: true },
67+
{ name: ANVIL_COLUMN_NAMES.DATA_MODALITY, sortable: true },
68+
{ name: ANVIL_COLUMN_NAMES.BIOSAMPLE_TYPE, sortable: true },
69+
{ name: ANVIL_COLUMN_NAMES.ORGANISM_TYPE, sortable: true },
70+
{ name: ANVIL_COLUMN_NAMES.DATASET, sortable: true },
6671
],
6772
selectableColumns: [
68-
{ name: "Phenotypic Sex", sortable: true },
69-
{ name: "Reported Ethnicity", sortable: true },
70-
{ name: "Diagnosis", sortable: true },
73+
{ name: ANVIL_COLUMN_NAMES.PHENOTYPIC_SEX, sortable: true },
74+
{ name: ANVIL_COLUMN_NAMES.REPORTED_ETHNICITY, sortable: true },
75+
{ name: ANVIL_COLUMN_NAMES.DIAGNOSIS, sortable: true },
7176
],
7277
tabName: "Activities",
7378
url: "/activities",
@@ -76,22 +81,22 @@ export const anvilTabs: AnvilCMGTabCollection = {
7681
emptyFirstColumn: false,
7782
maxPages: 25,
7883
preselectedColumns: [
79-
{ name: "BioSample Id", sortable: true },
80-
{ name: "Anatomical Site", sortable: true },
81-
{ name: "BioSample Type", sortable: true },
82-
{ name: "Organism Type", sortable: true },
83-
{ name: "Diagnosis", sortable: true },
84-
{ name: "Dataset", sortable: true },
84+
{ name: ANVIL_COLUMN_NAMES.BIOSAMPLE_ID, sortable: true },
85+
{ name: ANVIL_COLUMN_NAMES.ANATOMICAL_SITE, sortable: true },
86+
{ name: ANVIL_COLUMN_NAMES.BIOSAMPLE_TYPE, sortable: true },
87+
{ name: ANVIL_COLUMN_NAMES.ORGANISM_TYPE, sortable: true },
88+
{ name: ANVIL_COLUMN_NAMES.DIAGNOSIS, sortable: true },
89+
{ name: ANVIL_COLUMN_NAMES.DATASET, sortable: true },
8590
],
8691
selectableColumns: [
8792
{
88-
name: "Phenotypic Sex",
89-
pluralizedLabel: "phenotypic sexes",
93+
name: ANVIL_COLUMN_NAMES.PHENOTYPIC_SEX,
94+
pluralizedLabel: ANVIL_PLURALIZED_METADATA_LABELS.PHENOTYPIC_SEX,
9095
sortable: true,
9196
},
9297
{
93-
name: "Reported Ethnicity",
94-
pluralizedLabel: "reported ethnicities",
98+
name: ANVIL_COLUMN_NAMES.REPORTED_ETHNICITY,
99+
pluralizedLabel: ANVIL_PLURALIZED_METADATA_LABELS.REPORTED_ETHNICITIES,
95100
sortable: true,
96101
},
97102
],
@@ -120,32 +125,31 @@ export const anvilTabs: AnvilCMGTabCollection = {
120125
},
121126
backpageHeaders: [
122127
{
123-
name: "Dataset ID",
128+
name: ANVIL_DATASETS_BACKPAGE_HEADER_NAMES.DATASET_ID,
124129
},
125130
{
126131
correspondingColumn: anvilDatasetsPreselectedColumns[3],
127-
name: "Consent group",
132+
name: ANVIL_DATASETS_BACKPAGE_HEADER_NAMES.CONSENT_GROUP,
128133
},
129134
{
130135
correspondingColumn: anvilDatasetsPreselectedColumns[4],
131-
name: "Organism type",
136+
name: ANVIL_DATASETS_BACKPAGE_HEADER_NAMES.ORGANISM_TYPE,
132137
},
133138
{
134139
correspondingColumn: anvilDatasetsPreselectedColumns[5],
135-
name: "Diagnosis",
140+
name: ANVIL_DATASETS_BACKPAGE_HEADER_NAMES.DIAGNOSIS,
136141
},
137142
{
138143
correspondingColumn: anvilDatasetsPreselectedColumns[6],
139-
name: "Data modality",
144+
name: ANVIL_DATASETS_BACKPAGE_HEADER_NAMES.DATA_MODALITY,
140145
},
141-
// Skipped the below two columns, since they aren't always readable
142146
{
143147
correspondingColumn: anvilDatasetsSelectableColumns[0],
144-
name: "Phenotypic sex",
148+
name: ANVIL_DATASETS_BACKPAGE_HEADER_NAMES.PHENOTYPIC_SEX,
145149
},
146150
{
147151
correspondingColumn: anvilDatasetsSelectableColumns[1],
148-
name: "Reported ethnicity",
152+
name: ANVIL_DATASETS_BACKPAGE_HEADER_NAMES.REPORTED_ETHNICITY,
149153
},
150154
],
151155
emptyFirstColumn: false,
@@ -159,12 +163,12 @@ export const anvilTabs: AnvilCMGTabCollection = {
159163
emptyFirstColumn: false,
160164
maxPages: 25,
161165
preselectedColumns: [
162-
{ name: "Donor Id", sortable: true },
163-
{ name: "Organism Type", sortable: true },
164-
{ name: "Phenotypic Sex", sortable: true },
165-
{ name: "Reported Ethnicity", sortable: true },
166-
{ name: "Diagnosis", sortable: true },
167-
{ name: "Dataset", sortable: true },
166+
{ name: ANVIL_COLUMN_NAMES.DONOR_ID, sortable: true },
167+
{ name: ANVIL_COLUMN_NAMES.ORGANISM_TYPE, sortable: true },
168+
{ name: ANVIL_COLUMN_NAMES.PHENOTYPIC_SEX, sortable: true },
169+
{ name: ANVIL_COLUMN_NAMES.REPORTED_ETHNICITY, sortable: true },
170+
{ name: ANVIL_COLUMN_NAMES.DIAGNOSIS, sortable: true },
171+
{ name: ANVIL_COLUMN_NAMES.DATASET, sortable: true },
168172
],
169173
selectableColumns: [],
170174
tabName: "Donors",
@@ -174,18 +178,18 @@ export const anvilTabs: AnvilCMGTabCollection = {
174178
emptyFirstColumn: true,
175179
maxPages: 25,
176180
preselectedColumns: [
177-
{ name: "Name", sortable: true },
178-
{ name: "File Format", sortable: true },
179-
{ name: "Size", sortable: true },
180-
{ name: "DRS URI", sortable: false },
181-
{ name: "Data Modality", sortable: true },
182-
{ name: "Organism Type", sortable: true },
183-
{ name: "Dataset", sortable: true },
181+
{ name: ANVIL_COLUMN_NAMES.NAME, sortable: true },
182+
{ name: ANVIL_COLUMN_NAMES.FILE_FORMAT, sortable: true },
183+
{ name: ANVIL_COLUMN_NAMES.SIZE, sortable: true },
184+
{ name: ANVIL_COLUMN_NAMES.DRS_URI, sortable: false },
185+
{ name: ANVIL_COLUMN_NAMES.DATA_MODALITY, sortable: true },
186+
{ name: ANVIL_COLUMN_NAMES.ORGANISM_TYPE, sortable: true },
187+
{ name: ANVIL_COLUMN_NAMES.DATASET, sortable: true },
184188
],
185189
selectableColumns: [
186-
{ name: "Phenotypic Sex", sortable: true },
187-
{ name: "Reported Ethnicity", sortable: true },
188-
{ name: "Diagnosis", sortable: true },
190+
{ name: ANVIL_COLUMN_NAMES.PHENOTYPIC_SEX, sortable: true },
191+
{ name: ANVIL_COLUMN_NAMES.REPORTED_ETHNICITY, sortable: true },
192+
{ name: ANVIL_COLUMN_NAMES.DIAGNOSIS, sortable: true },
189193
],
190194
tabName: "Files",
191195
url: "/files",

explorer/e2e/anvil/constants.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
export const ANVIL_DATASETS_BACKPAGE_HEADER_NAMES = {
2+
CONSENT_GROUP: "Consent group",
3+
DATASET_ID: "Dataset Id",
4+
DATA_MODALITY: "Data modality",
5+
DIAGNOSIS: "Diagnosis",
6+
ORGANISM_TYPE: "Organism type",
7+
PHENOTYPIC_SEX: "Phenotypic sex",
8+
REPORTED_ETHNICITY: "Reported ethnicity",
9+
};
10+
11+
export const ANVIL_COLUMN_NAMES = {
12+
ACCESS: "Access",
13+
ACTIVITY_TYPE: "Activity Type",
14+
ANATOMICAL_SITE: "Anatomical Site",
15+
BIOSAMPLE_ID: "BioSample Id",
16+
BIOSAMPLE_TYPE: "BioSample Type",
17+
CONSENT_GROUP: "Consent Group",
18+
DATASET: "Dataset",
19+
DATA_MODALITY: "Data Modality",
20+
DIAGNOSIS: "Diagnosis",
21+
DOCUMENT_ID: "Document Id",
22+
DONOR_ID: "Donor Id",
23+
DRS_URI: "DRS URI",
24+
FILE_FORMAT: "File Format",
25+
IDENTIFIER: "Identifier",
26+
NAME: "Name",
27+
ORGANISM_TYPE: "Organism Type",
28+
PHENOTYPIC_SEX: "Phenotypic Sex",
29+
REPORTED_ETHNICITY: "Reported Ethnicity",
30+
SIZE: "Size",
31+
};
32+
33+
export const ANVIL_PLURALIZED_METADATA_LABELS = {
34+
DATA_MODALITY: "data modalities",
35+
DIAGNOSIS: "diagnoses",
36+
PHENOTYPIC_SEX: "phenotypic sexes",
37+
REPORTED_ETHNICITIES: "reported ethnicities",
38+
};

explorer/e2e/testFunctions.ts

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -610,27 +610,29 @@ export async function testExportBackpage(
610610
await expect(checkboxLocator).toBeChecked();
611611
await expect(checkboxLocator).toBeEnabled({ timeout: 10000 });
612612
}
613-
// Check one checkbox in each table
614-
for (const tableLocator of await page.getByRole("table").all()) {
615-
const allInTableCheckboxLocators = await tableLocator
616-
.getByRole("checkbox")
617-
.all();
618-
const secondCheckboxInTableLocator = allInTableCheckboxLocators[1];
619-
await secondCheckboxInTableLocator.click();
620-
await expect(secondCheckboxInTableLocator).toBeChecked();
621-
await expect(secondCheckboxInTableLocator).toBeEnabled({ timeout: 10000 });
622-
const otherInTableCheckboxLocators = [
623-
allInTableCheckboxLocators[0],
624-
...allInTableCheckboxLocators.slice(2),
625-
];
626-
// Make sure that no other checkboxes are selected
627-
for (const otherCheckboxLocator of otherInTableCheckboxLocators) {
628-
await expect(otherCheckboxLocator).not.toBeChecked();
629-
await expect(otherCheckboxLocator).toBeEnabled();
630-
}
613+
// Expect there to be exactly one table on the backpage
614+
await expect(page.getByRole("table")).toHaveCount(1);
615+
// Check the second checkbox in the table (this should be the checkbox after the "select all checkbox")
616+
const tableLocator = page.getByRole("table");
617+
const allInTableCheckboxLocators = await tableLocator
618+
.getByRole("checkbox")
619+
.all();
620+
const secondCheckboxInTableLocator = allInTableCheckboxLocators[1];
621+
await secondCheckboxInTableLocator.click();
622+
await expect(secondCheckboxInTableLocator).toBeChecked();
623+
await expect(secondCheckboxInTableLocator).toBeEnabled({ timeout: 10000 });
624+
// Make sure that no other checkboxes are selected
625+
const otherInTableCheckboxLocators = [
626+
allInTableCheckboxLocators[0],
627+
...allInTableCheckboxLocators.slice(2),
628+
];
629+
for (const otherCheckboxLocator of otherInTableCheckboxLocators) {
630+
await expect(otherCheckboxLocator).not.toBeChecked();
631+
await expect(otherCheckboxLocator).toBeEnabled();
631632
}
632633
// Click the Export Request button
633634
await expect(exportRequestButtonLocator).toBeEnabled({ timeout: 10000 });
635+
/*
634636
await exportRequestButtonLocator.click();
635637
await expect(
636638
page.getByText(tab.backpageExportButtons.firstLoadingMessage, {
@@ -654,6 +656,7 @@ export async function testExportBackpage(
654656
await expect(
655657
newPage.getByText(tab.backpageExportButtons?.newTabMessage)
656658
).toBeVisible();
659+
*/
657660
}
658661

659662
/**

0 commit comments

Comments
 (0)