Skip to content

test: create tests for datasets backpages (#4080) #4089

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

Merged
merged 10 commits into from
Sep 10, 2024
4 changes: 2 additions & 2 deletions explorer/e2e/anvil-catalog/anvilcatalog-tabs-buttons.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ test("Expect clicking the studies tab to go to the correct url and to show all o
page,
}) => {
const tab = anvilcatalogTabs.studies;
await page.goto(anvilcatalogTabs.consortia.url);
await page.goto(anvilcatalogTabs.workspaces.url);
await testTab(page, tab);
});

test("Expect clicking the workspaces tab to go to the correct url and to show all of the relevant columns when selected", async ({
page,
}) => {
const tab = anvilcatalogTabs.workspaces;
await page.goto(anvilcatalogTabs.workspaces.url);
await page.goto(anvilcatalogTabs.consortia.url);
await testTab(page, tab);
});
29 changes: 29 additions & 0 deletions explorer/e2e/anvil/anvil-backpages.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { test } from "@playwright/test";
import {
testBackpageAccess,
testBackpageDetails,
testExportBackpage,
} from "../testFunctions";
import { anvilTabs } from "./anvil-tabs";

test.skip("Smoke test `Export to Terra` button on the first available dataset", async ({
context,
page,
}) => {
test.setTimeout(120000);
await testExportBackpage(context, page, anvilTabs.datasets);
});

test.skip("Check access controls on the datasets backpages work for the first two tabs", async ({
page,
}) => {
test.setTimeout(120000);
await testBackpageAccess(page, anvilTabs.datasets);
});

test("Check that information on the backpages matches information in the data tables", async ({
page,
}) => {
test.setTimeout(120000);
await testBackpageDetails(page, anvilTabs.datasets);
});
9 changes: 2 additions & 7 deletions explorer/e2e/anvil/anvil-pagination-content.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { expect, test } from "@playwright/test";
import { getFirstRowNthColumnCellLocator } from "../testFunctions";
import { anvilTabs } from "./anvil-tabs";

const pageCountRegex = /Page [0-9]+ of [0-9]+/;
Expand All @@ -16,13 +17,7 @@ test("Check forward and backwards pagination causes the page content to change o
page.getByRole("tab").getByText(tab.tabName, { exact: true })
).toHaveAttribute("aria-selected", "true", { timeout: 25000 });

const firstElementTextLocator = page
.getByRole("rowgroup")
.nth(1)
.getByRole("row")
.nth(0)
.getByRole("cell")
.nth(0);
const firstElementTextLocator = getFirstRowNthColumnCellLocator(page, 0);

// Should start on first page
await expect(page.getByText(pageCountRegex, { exact: true })).toHaveText(
Expand Down
2 changes: 1 addition & 1 deletion explorer/e2e/anvil/anvil-pagination.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ test("Check first page has disabled back and enabled forward pagination buttons
).toBeDisabled();
});

test.setTimeout(300000);
test("Check that forward pagination increments the current page and that page count stays static for the first five pages on the donors tab", async ({
page,
}) => {
test.setTimeout(500000);
// Should start on first page, and there should be multiple pages available
await expect(page.getByText(pageCountRegex, { exact: true })).toHaveText(
/Page 1 of [0-9]+/
Expand Down
5 changes: 5 additions & 0 deletions explorer/e2e/anvil/anvil-sort.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,34 @@ test.describe.configure({ mode: "parallel" });
test("Expect clicking each column header three times to keep the first text element visible on the Datasets tab", async ({
page,
}) => {
test.setTimeout(180000);
await testSortAzul(page, anvilTabs.datasets);
});

test("Expect clicking each column header three times to keep the first text element visible on the Donors tab", async ({
page,
}) => {
test.setTimeout(180000);
await testSortAzul(page, anvilTabs.donors);
});

test("Expect clicking each column header of each tab three times to keep the first text element visible on the BioSamples tab", async ({
page,
}) => {
test.setTimeout(180000);
await testSortAzul(page, anvilTabs.biosamples);
});

test("Expect clicking each column header three times to keep the first text element visible on the Activities tab", async ({
page,
}) => {
test.setTimeout(180000);
await testSortAzul(page, anvilTabs.activities);
});

test("Expect clicking each column header three times to keep the first text element visible on the Files tab", async ({
page,
}) => {
test.setTimeout(180000);
await testSortAzul(page, anvilTabs.files);
});
23 changes: 9 additions & 14 deletions explorer/e2e/anvil/anvil-tabs-buttons.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,37 @@ import { test } from "@playwright/test";
import { testTab } from "../testFunctions";
import { anvilTabs } from "./anvil-tabs";

test("Expect clicking the activities tab to go to the correct url and to show all of the relevant columns when selected", async ({
test("Expect clicking the datasets tab to go to the correct url and to show all of the relevant columns when selected", async ({
page,
}) => {
const tab = anvilTabs.activities;
await page.goto(anvilTabs.datasets.url);
await testTab(page, tab);
await page.goto(anvilTabs.activities.url);
await testTab(page, anvilTabs.datasets);
});

test("Expect clicking the datasets tab to go to the correct url and to show all of the relevant columns when selected", async ({
test("Expect clicking the activities tab to go to the correct url and to show all of the relevant columns when selected", async ({
page,
}) => {
const tab = anvilTabs.datasets;
await page.goto(anvilTabs.activities.url);
await testTab(page, tab);
await page.goto(anvilTabs.datasets.url);
await testTab(page, anvilTabs.activities);
});

test("Expect clicking the files tab to go to the correct url and to show all of the relevant columns when selected", async ({
page,
}) => {
const tab = anvilTabs.files;
await page.goto(anvilTabs.datasets.url);
await testTab(page, tab);
await testTab(page, anvilTabs.files);
});

test("Expect clicking the donors tab to go to the correct url and to show all of the relevant columns when selected", async ({
page,
}) => {
const tab = anvilTabs.donors;
await page.goto(anvilTabs.datasets.url);
await testTab(page, tab);
await testTab(page, anvilTabs.donors);
});

test("Expect clicking the biosamples tab to go to the correct url and to show all of the relevant columns when selected", async ({
page,
}) => {
const tab = anvilTabs.biosamples;
await page.goto(anvilTabs.datasets.url);
await testTab(page, tab);
await testTab(page, anvilTabs.biosamples);
});
164 changes: 118 additions & 46 deletions explorer/e2e/anvil/anvil-tabs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ import {
TabCollectionKeys,
TabDescription,
} from "../testInterfaces";
import {
ANVIL_COLUMN_NAMES,
ANVIL_DATASETS_BACKPAGE_HEADER_NAMES,
ANVIL_PLURALIZED_METADATA_LABELS,
} from "./constants";

export const anvilFilterNames: string[] = [
"Anatomical Site",
Expand All @@ -30,22 +35,44 @@ export const ORGANISM_TYPE_INDEX = 8;
export const PHENOTYPIC_SEX_INDEX = 9;
export const REPORTED_ETHNICITY_INDEX = 10;

const anvilDatasetsPreselectedColumns = [
{ name: ANVIL_COLUMN_NAMES.DATASET, sortable: true },
{ name: ANVIL_COLUMN_NAMES.ACCESS, sortable: false },
{ name: ANVIL_COLUMN_NAMES.IDENTIFIER, sortable: true },
{ name: ANVIL_COLUMN_NAMES.CONSENT_GROUP, sortable: true },
{ name: ANVIL_COLUMN_NAMES.ORGANISM_TYPE, sortable: true },
{ name: ANVIL_COLUMN_NAMES.DIAGNOSIS, sortable: true },
{ name: ANVIL_COLUMN_NAMES.DATA_MODALITY, sortable: true },
];
const anvilDatasetsSelectableColumns = [
{
name: ANVIL_COLUMN_NAMES.PHENOTYPIC_SEX,
pluralizedLabel: ANVIL_PLURALIZED_METADATA_LABELS.PHENOTYPIC_SEX,
sortable: true,
},
{
name: ANVIL_COLUMN_NAMES.REPORTED_ETHNICITY,
pluralizedLabel: ANVIL_PLURALIZED_METADATA_LABELS.PHENOTYPIC_SEX,
sortable: true,
},
];

export const anvilTabs: AnvilCMGTabCollection = {
activities: {
emptyFirstColumn: false,
maxPages: 25,
preselectedColumns: [
{ name: "Document Id", sortable: true },
{ name: "Activity Type", sortable: true },
{ name: "Data Modality", sortable: true },
{ name: "BioSample Type", sortable: true },
{ name: "Organism Type", sortable: true },
{ name: "Dataset", sortable: true },
{ name: ANVIL_COLUMN_NAMES.DOCUMENT_ID, sortable: true },
{ name: ANVIL_COLUMN_NAMES.ACTIVITY_TYPE, sortable: true },
{ name: ANVIL_COLUMN_NAMES.DATA_MODALITY, sortable: true },
{ name: ANVIL_COLUMN_NAMES.BIOSAMPLE_TYPE, sortable: true },
{ name: ANVIL_COLUMN_NAMES.ORGANISM_TYPE, sortable: true },
{ name: ANVIL_COLUMN_NAMES.DATASET, sortable: true },
],
selectableColumns: [
{ name: "Phenotypic Sex", sortable: true },
{ name: "Reported Ethnicity", sortable: true },
{ name: "Diagnosis", sortable: true },
{ name: ANVIL_COLUMN_NAMES.PHENOTYPIC_SEX, sortable: true },
{ name: ANVIL_COLUMN_NAMES.REPORTED_ETHNICITY, sortable: true },
{ name: ANVIL_COLUMN_NAMES.DIAGNOSIS, sortable: true },
],
tabName: "Activities",
url: "/activities",
Expand All @@ -54,49 +81,94 @@ export const anvilTabs: AnvilCMGTabCollection = {
emptyFirstColumn: false,
maxPages: 25,
preselectedColumns: [
{ name: "BioSample Id", sortable: true },
{ name: "Anatomical Site", sortable: true },
{ name: "BioSample Type", sortable: true },
{ name: "Organism Type", sortable: true },
{ name: "Diagnosis", sortable: true },
{ name: "Dataset", sortable: true },
{ name: ANVIL_COLUMN_NAMES.BIOSAMPLE_ID, sortable: true },
{ name: ANVIL_COLUMN_NAMES.ANATOMICAL_SITE, sortable: true },
{ name: ANVIL_COLUMN_NAMES.BIOSAMPLE_TYPE, sortable: true },
{ name: ANVIL_COLUMN_NAMES.ORGANISM_TYPE, sortable: true },
{ name: ANVIL_COLUMN_NAMES.DIAGNOSIS, sortable: true },
{ name: ANVIL_COLUMN_NAMES.DATASET, sortable: true },
],
selectableColumns: [
{ name: "Phenotypic Sex", sortable: true },
{ name: "Reported Ethnicity", sortable: true },
{
name: ANVIL_COLUMN_NAMES.PHENOTYPIC_SEX,
pluralizedLabel: ANVIL_PLURALIZED_METADATA_LABELS.PHENOTYPIC_SEX,
sortable: true,
},
{
name: ANVIL_COLUMN_NAMES.REPORTED_ETHNICITY,
pluralizedLabel: ANVIL_PLURALIZED_METADATA_LABELS.REPORTED_ETHNICITIES,
sortable: true,
},
],
tabName: "BioSamples",
url: "/biosamples",
},
datasets: {
backpageAccessTags: {
deniedLongName: "Access Required",
deniedShortName: "Required",
grantedLongName: "Access Granted",
grantedShortName: "Granted",
},
backpageExportButtons: {
accessNotGrantedMessage:
"To export this dataset, please sign in and, if necessary, request access.",
detailsName: "Dataset Details",
exportActionButtonText: "Open Terra",
exportRequestButtonText: "Request Link",
exportTabName: "Export",
exportUrlRegExp: /\.*\/export-to-terra/,
firstLoadingMessage: "Your link will be ready shortly...",
newTabMessage:
"If you are a new user or returning user, click sign in to continue.",
secondLandingMessage: "Your Terra Workspace Link is Ready",
},
backpageHeaders: [
{
name: ANVIL_DATASETS_BACKPAGE_HEADER_NAMES.DATASET_ID,
},
{
correspondingColumn: anvilDatasetsPreselectedColumns[3],
name: ANVIL_DATASETS_BACKPAGE_HEADER_NAMES.CONSENT_GROUP,
},
{
correspondingColumn: anvilDatasetsPreselectedColumns[4],
name: ANVIL_DATASETS_BACKPAGE_HEADER_NAMES.ORGANISM_TYPE,
},
{
correspondingColumn: anvilDatasetsPreselectedColumns[5],
name: ANVIL_DATASETS_BACKPAGE_HEADER_NAMES.DIAGNOSIS,
},
{
correspondingColumn: anvilDatasetsPreselectedColumns[6],
name: ANVIL_DATASETS_BACKPAGE_HEADER_NAMES.DATA_MODALITY,
},
{
correspondingColumn: anvilDatasetsSelectableColumns[0],
name: ANVIL_DATASETS_BACKPAGE_HEADER_NAMES.PHENOTYPIC_SEX,
},
{
correspondingColumn: anvilDatasetsSelectableColumns[1],
name: ANVIL_DATASETS_BACKPAGE_HEADER_NAMES.REPORTED_ETHNICITY,
},
],
emptyFirstColumn: false,
maxPages: 25,
preselectedColumns: [
{ name: "Dataset", sortable: true },
{ name: "Access", sortable: false },
{ name: "Identifier", sortable: true },
{ name: "Consent Group", sortable: true },
{ name: "Organism Type", sortable: true },
{ name: "Diagnosis", sortable: true },
{ name: "Data Modality", sortable: true },
],
selectableColumns: [
{ name: "Phenotypic Sex", sortable: true },
{ name: "Reported Ethnicity", sortable: true },
],
preselectedColumns: anvilDatasetsPreselectedColumns,
selectableColumns: anvilDatasetsSelectableColumns,
tabName: "Datasets",
url: "/datasets",
},
donors: {
emptyFirstColumn: false,
maxPages: 25,
preselectedColumns: [
{ name: "Donor Id", sortable: true },
{ name: "Organism Type", sortable: true },
{ name: "Phenotypic Sex", sortable: true },
{ name: "Reported Ethnicity", sortable: true },
{ name: "Diagnosis", sortable: true },
{ name: "Dataset", sortable: true },
{ name: ANVIL_COLUMN_NAMES.DONOR_ID, sortable: true },
{ name: ANVIL_COLUMN_NAMES.ORGANISM_TYPE, sortable: true },
{ name: ANVIL_COLUMN_NAMES.PHENOTYPIC_SEX, sortable: true },
{ name: ANVIL_COLUMN_NAMES.REPORTED_ETHNICITY, sortable: true },
{ name: ANVIL_COLUMN_NAMES.DIAGNOSIS, sortable: true },
{ name: ANVIL_COLUMN_NAMES.DATASET, sortable: true },
],
selectableColumns: [],
tabName: "Donors",
Expand All @@ -106,18 +178,18 @@ export const anvilTabs: AnvilCMGTabCollection = {
emptyFirstColumn: true,
maxPages: 25,
preselectedColumns: [
{ name: "Name", sortable: true },
{ name: "File Format", sortable: true },
{ name: "Size", sortable: true },
{ name: "DRS URI", sortable: false },
{ name: "Data Modality", sortable: true },
{ name: "Organism Type", sortable: true },
{ name: "Dataset", sortable: true },
{ name: ANVIL_COLUMN_NAMES.NAME, sortable: true },
{ name: ANVIL_COLUMN_NAMES.FILE_FORMAT, sortable: true },
{ name: ANVIL_COLUMN_NAMES.SIZE, sortable: true },
{ name: ANVIL_COLUMN_NAMES.DRS_URI, sortable: false },
{ name: ANVIL_COLUMN_NAMES.DATA_MODALITY, sortable: true },
{ name: ANVIL_COLUMN_NAMES.ORGANISM_TYPE, sortable: true },
{ name: ANVIL_COLUMN_NAMES.DATASET, sortable: true },
],
selectableColumns: [
{ name: "Phenotypic Sex", sortable: true },
{ name: "Reported Ethnicity", sortable: true },
{ name: "Diagnosis", sortable: true },
{ name: ANVIL_COLUMN_NAMES.PHENOTYPIC_SEX, sortable: true },
{ name: ANVIL_COLUMN_NAMES.REPORTED_ETHNICITY, sortable: true },
{ name: ANVIL_COLUMN_NAMES.DIAGNOSIS, sortable: true },
],
tabName: "Files",
url: "/files",
Expand Down
Loading
Loading