Skip to content

Commit 0ddaa01

Browse files
committed
fix: refactored locators and cleaned up typos in tests (#4078)
1 parent 2b51375 commit 0ddaa01

File tree

3 files changed

+10
-31
lines changed

3 files changed

+10
-31
lines changed

explorer/e2e/anvil-catalog/anvilcatalog-tabs-buttons.spec.ts

+3-9
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,17 @@ import { anvilcatalogTabs } from "./anvilcatalog-tabs";
55
test("Expect clicking the consortia tab to go to the correct url and to show all of the relevant columns when selected", async ({
66
page,
77
}) => {
8-
const tab = anvilcatalogTabs.consortia;
9-
await page.goto(anvilcatalogTabs.studies.url);
10-
await testTab(page, tab);
8+
await testTab(page, anvilcatalogTabs.studies, anvilcatalogTabs.consortia);
119
});
1210

1311
test("Expect clicking the studies tab to go to the correct url and to show all of the relevant columns when selected", async ({
1412
page,
1513
}) => {
16-
const tab = anvilcatalogTabs.studies;
17-
await page.goto(anvilcatalogTabs.consortia.url);
18-
await testTab(page, tab);
14+
await testTab(page, anvilcatalogTabs.workspaces, anvilcatalogTabs.studies);
1915
});
2016

2117
test("Expect clicking the workspaces tab to go to the correct url and to show all of the relevant columns when selected", async ({
2218
page,
2319
}) => {
24-
const tab = anvilcatalogTabs.workspaces;
25-
await page.goto(anvilcatalogTabs.workspaces.url);
26-
await testTab(page, tab);
20+
await testTab(page, anvilcatalogTabs.consortia, anvilcatalogTabs.workspaces);
2721
});

explorer/e2e/anvil/anvil-pagination-content.spec.ts

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { expect, test } from "@playwright/test";
2+
import { getFirstElementTextLocator } from "../testFunctions";
23
import { anvilTabs } from "./anvil-tabs";
34

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

19-
const firstElementTextLocator = page
20-
.getByRole("rowgroup")
21-
.nth(1)
22-
.getByRole("row")
23-
.nth(0)
24-
.getByRole("cell")
25-
.nth(0);
20+
const firstElementTextLocator = getFirstElementTextLocator(page, 0);
2621

2722
// Should start on first page
2823
await expect(page.getByText(pageCountRegex, { exact: true })).toHaveText(

explorer/e2e/anvil/anvil-tabs-buttons.spec.ts

+5-15
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,29 @@ import { anvilTabs } from "./anvil-tabs";
55
test("Expect clicking the activities tab to go to the correct url and to show all of the relevant columns when selected", async ({
66
page,
77
}) => {
8-
const tab = anvilTabs.activities;
9-
await page.goto(anvilTabs.datasets.url);
10-
await testTab(page, tab);
8+
await testTab(page, anvilTabs.datasets, anvilTabs.activities);
119
});
1210

1311
test("Expect clicking the datasets tab to go to the correct url and to show all of the relevant columns when selected", async ({
1412
page,
1513
}) => {
16-
const tab = anvilTabs.datasets;
17-
await page.goto(anvilTabs.activities.url);
18-
await testTab(page, tab);
14+
await testTab(page, anvilTabs.activities, anvilTabs.datasets);
1915
});
2016

2117
test("Expect clicking the files tab to go to the correct url and to show all of the relevant columns when selected", async ({
2218
page,
2319
}) => {
24-
const tab = anvilTabs.files;
25-
await page.goto(anvilTabs.datasets.url);
26-
await testTab(page, tab);
20+
await testTab(page, anvilTabs.datasets, anvilTabs.files);
2721
});
2822

2923
test("Expect clicking the donors tab to go to the correct url and to show all of the relevant columns when selected", async ({
3024
page,
3125
}) => {
32-
const tab = anvilTabs.donors;
33-
await page.goto(anvilTabs.datasets.url);
34-
await testTab(page, tab);
26+
await testTab(page, anvilTabs.datasets, anvilTabs.donors);
3527
});
3628

3729
test("Expect clicking the biosamples tab to go to the correct url and to show all of the relevant columns when selected", async ({
3830
page,
3931
}) => {
40-
const tab = anvilTabs.biosamples;
41-
await page.goto(anvilTabs.datasets.url);
42-
await testTab(page, tab);
32+
await testTab(page, anvilTabs.datasets, anvilTabs.biosamples);
4333
});

0 commit comments

Comments
 (0)