Skip to content

Commit 0a2d95a

Browse files
committed
test: switched to MACRO_CASE for test constants (#4078)
1 parent 48e0539 commit 0a2d95a

14 files changed

+142
-125
lines changed

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,32 @@ import {
33
testPreSelectedColumns,
44
testSelectableColumns,
55
} from "../testFunctions";
6-
import { anvilcatalogTabs } from "./anvilcatalog-tabs";
6+
import { ANVIL_CATALOG_TABS } from "./anvilcatalog-tabs";
77

88
test("Expect the checkboxes in the 'Edit Columns' menu to add those columns to the tab in the Consortia tab", async ({
99
page,
1010
}) => {
11-
const tab = anvilcatalogTabs.consortia;
11+
const tab = ANVIL_CATALOG_TABS.CONSORTIA;
1212
await testSelectableColumns(page, tab);
1313
});
1414

1515
test("Expect the checkboxes for preselected columns in the 'Edit Columns' menu to be checked and disabled on the consortia tab", async ({
1616
page,
1717
}) => {
18-
const tab = anvilcatalogTabs.consortia;
18+
const tab = ANVIL_CATALOG_TABS.CONSORTIA;
1919
await testPreSelectedColumns(page, tab);
2020
});
2121

2222
test("Expect the checkboxes for preselected columns in the 'Edit Columns' menu to be checked and disabled on the studies tab", async ({
2323
page,
2424
}) => {
25-
const tab = anvilcatalogTabs.studies;
25+
const tab = ANVIL_CATALOG_TABS.STUDIES;
2626
await testPreSelectedColumns(page, tab);
2727
});
2828

2929
test("Expect the checkboxes for preselected columns in the 'Edit Columns' menu to be checked and disabled on the workspaces tab", async ({
3030
page,
3131
}) => {
32-
const tab = anvilcatalogTabs.workspaces;
32+
const tab = ANVIL_CATALOG_TABS.WORKSPACES;
3333
await testPreSelectedColumns(page, tab);
3434
});
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
import { test } from "@playwright/test";
22
import { testSortCatalog } from "../testFunctions";
3-
import { anvilcatalogTabs } from "./anvilcatalog-tabs";
3+
import { ANVIL_CATALOG_TABS } from "./anvilcatalog-tabs";
44

55
test("On the Consortia tab, expect clicking the column header (the sort button) to keep the first element of the column visible", async ({
66
page,
77
}) => {
8-
await testSortCatalog(page, anvilcatalogTabs.consortia);
8+
await testSortCatalog(page, ANVIL_CATALOG_TABS.CONSORTIA);
99
});
1010

1111
test("On the Studies tab, expect clicking the column header (the sort button) to keep the first element of the column visible", async ({
1212
page,
1313
}) => {
14-
await testSortCatalog(page, anvilcatalogTabs.studies);
14+
await testSortCatalog(page, ANVIL_CATALOG_TABS.STUDIES);
1515
});
1616

1717
test("On the Workspaces tab, expect clicking the column header (the sort button) to keep the first element of the column visible", async ({
1818
page,
1919
}) => {
20-
await testSortCatalog(page, anvilcatalogTabs.workspaces);
20+
await testSortCatalog(page, ANVIL_CATALOG_TABS.WORKSPACES);
2121
});
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,29 @@
11
import { test } from "@playwright/test";
22
import { testTab } from "../testFunctions";
3-
import { anvilcatalogTabs } from "./anvilcatalog-tabs";
3+
import { ANVIL_CATALOG_TABS } from "./anvilcatalog-tabs";
44

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-
await testTab(page, anvilcatalogTabs.studies, anvilcatalogTabs.consortia);
8+
await testTab(page, ANVIL_CATALOG_TABS.STUDIES, ANVIL_CATALOG_TABS.CONSORTIA);
99
});
1010

1111
test("Expect clicking the studies tab to go to the correct url and to show all of the relevant columns when selected", async ({
1212
page,
1313
}) => {
14-
await testTab(page, anvilcatalogTabs.workspaces, anvilcatalogTabs.studies);
14+
await testTab(
15+
page,
16+
ANVIL_CATALOG_TABS.WORKSPACES,
17+
ANVIL_CATALOG_TABS.STUDIES
18+
);
1519
});
1620

1721
test("Expect clicking the workspaces tab to go to the correct url and to show all of the relevant columns when selected", async ({
1822
page,
1923
}) => {
20-
await testTab(page, anvilcatalogTabs.consortia, anvilcatalogTabs.workspaces);
24+
await testTab(
25+
page,
26+
ANVIL_CATALOG_TABS.CONSORTIA,
27+
ANVIL_CATALOG_TABS.WORKSPACES
28+
);
2129
});

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

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/* eslint-disable sonarjs/no-duplicate-string -- ignoring duplicate strings here */
22
import { AnvilCatalogTabCollection, TabDescription } from "../testInterfaces";
33

4-
export const anvilcatalogTabs: AnvilCatalogTabCollection = {
5-
consortia: {
4+
export const ANVIL_CATALOG_TABS: AnvilCatalogTabCollection = {
5+
CONSORTIA: {
66
emptyFirstColumn: false,
77
preselectedColumns: [
88
{ name: "Consortium", sortable: true },
@@ -21,7 +21,7 @@ export const anvilcatalogTabs: AnvilCatalogTabCollection = {
2121
tabName: "Consortia",
2222
url: "/data/consortia",
2323
},
24-
studies: {
24+
STUDIES: {
2525
emptyFirstColumn: false,
2626
preselectedColumns: [
2727
{ name: "Study", sortable: true },
@@ -39,7 +39,7 @@ export const anvilcatalogTabs: AnvilCatalogTabCollection = {
3939
tabName: "Studies",
4040
url: "/data/studies",
4141
},
42-
workspaces: {
42+
WORKSPACES: {
4343
emptyFirstColumn: false,
4444
preselectedColumns: [
4545
{ name: "Consortium", sortable: true },
@@ -59,10 +59,10 @@ export const anvilcatalogTabs: AnvilCatalogTabCollection = {
5959
},
6060
};
6161

62-
export const anvilCatalogTabList: TabDescription[] = [
63-
anvilcatalogTabs.consortia,
64-
anvilcatalogTabs.studies,
65-
anvilcatalogTabs.workspaces,
62+
export const ANVIL_CATALOG_TAB_LIST: TabDescription[] = [
63+
ANVIL_CATALOG_TABS.CONSORTIA,
64+
ANVIL_CATALOG_TABS.STUDIES,
65+
ANVIL_CATALOG_TABS.WORKSPACES,
6666
];
6767

6868
/* eslint-enable sonarjs/no-duplicate-string -- Checking duplicate strings again*/
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
11
import { test } from "@playwright/test";
22
import { testUrl } from "../testFunctions";
3-
import { anvilCatalogTabList, anvilcatalogTabs } from "./anvilcatalog-tabs";
3+
import {
4+
ANVIL_CATALOG_TABS,
5+
ANVIL_CATALOG_TAB_LIST,
6+
} from "./anvilcatalog-tabs";
47

58
test("Expect the consortia tab to appear as selected when the corresponding url is accessed", async ({
69
page,
710
}) => {
8-
const tab = anvilcatalogTabs.consortia;
9-
await testUrl(page, tab, anvilCatalogTabList);
11+
const tab = ANVIL_CATALOG_TABS.CONSORTIA;
12+
await testUrl(page, tab, ANVIL_CATALOG_TAB_LIST);
1013
});
1114

1215
test("Expect the studies tab to appear as selected when the corresponding url is accessedb", async ({
1316
page,
1417
}) => {
15-
const tab = anvilcatalogTabs.studies;
16-
await testUrl(page, tab, anvilCatalogTabList);
18+
const tab = ANVIL_CATALOG_TABS.STUDIES;
19+
await testUrl(page, tab, ANVIL_CATALOG_TAB_LIST);
1720
});
1821

1922
test("Expect the workspaces tab to appear as selected when the corresponding url is accessed", async ({
2023
page,
2124
}) => {
22-
const tab = anvilcatalogTabs.workspaces;
23-
await testUrl(page, tab, anvilCatalogTabList);
25+
const tab = ANVIL_CATALOG_TABS.WORKSPACES;
26+
await testUrl(page, tab, ANVIL_CATALOG_TAB_LIST);
2427
});

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,26 @@ import {
44
testBackpageDetails,
55
testExportBackpage,
66
} from "../testFunctions";
7-
import { anvilTabs } from "./anvil-tabs";
7+
import { ANVIL_TABS } from "./anvil-tabs";
88

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

1717
test.skip("Check access controls on the datasets backpages work for the first two tabs", async ({
1818
page,
1919
}) => {
2020
test.setTimeout(120000);
21-
await testBackpageAccess(page, anvilTabs.datasets);
21+
await testBackpageAccess(page, ANVIL_TABS.DATASETS);
2222
});
2323

2424
test("Check that information on the backpages matches information in the data tables", async ({
2525
page,
2626
}) => {
2727
test.setTimeout(120000);
28-
await testBackpageDetails(page, anvilTabs.datasets);
28+
await testBackpageDetails(page, ANVIL_TABS.DATASETS);
2929
});

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

+27-25
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import {
99
testFilterTags,
1010
} from "../testFunctions";
1111
import {
12-
anvilFilterNames,
13-
anvilTabs,
14-
anvilTabTestOrder,
12+
ANVIL_FILTER_NAMES,
13+
ANVIL_TABS,
14+
ANVIL_TAB_TEST_ORDER,
1515
BIOSAMPLE_TYPE_INDEX,
1616
CONSENT_GROUP_INDEX,
1717
DATASET_INDEX,
@@ -38,49 +38,51 @@ const FILTER_INDEX_LIST_SHORT = [
3838
test("Check that all filters exist on the Datasets tab and are clickable", async ({
3939
page,
4040
}) => {
41-
await testFilterPresence(page, anvilTabs.datasets, anvilFilterNames);
41+
await testFilterPresence(page, ANVIL_TABS.DATASETS, ANVIL_FILTER_NAMES);
4242
});
4343

4444
test("Check that all filters exist on the Donors tab and are clickable", async ({
4545
page,
4646
}) => {
47-
await testFilterPresence(page, anvilTabs.donors, anvilFilterNames);
47+
await testFilterPresence(page, ANVIL_TABS.DONORS, ANVIL_FILTER_NAMES);
4848
});
4949

5050
test("Check that all filters exist on the BioSamples tab and are clickable", async ({
5151
page,
5252
}) => {
53-
await testFilterPresence(page, anvilTabs.biosamples, anvilFilterNames);
53+
await testFilterPresence(page, ANVIL_TABS.BIOSAMPLES, ANVIL_FILTER_NAMES);
5454
});
5555

5656
test("Check that all filters exist on the Activities tab and are clickable", async ({
5757
page,
5858
}) => {
59-
await testFilterPresence(page, anvilTabs.activities, anvilFilterNames);
59+
await testFilterPresence(page, ANVIL_TABS.ACTIVITIES, ANVIL_FILTER_NAMES);
6060
});
6161

6262
test("Check that all filters exist on the Files tab and are clickable", async ({
6363
page,
6464
}) => {
65-
await testFilterPresence(page, anvilTabs.files, anvilFilterNames);
65+
await testFilterPresence(page, ANVIL_TABS.FILES, ANVIL_FILTER_NAMES);
6666
});
6767

6868
test("Check that the first filter on the Datasets tab creates at least one checkbox, and that checking up to the first five does not cause an error and does not cause there to be no entries in the table", async ({
6969
page,
7070
}) => {
7171
test.setTimeout(120000);
7272
// Goto the datasets tab
73-
await page.goto(anvilTabs.datasets.url);
73+
await page.goto(ANVIL_TABS.DATASETS.url);
7474
await expect(
75-
page.getByRole("tab").getByText(anvilTabs.datasets.tabName)
75+
page.getByRole("tab").getByText(ANVIL_TABS.DATASETS.tabName)
7676
).toBeVisible();
7777

7878
// Select a filter
7979
await page
8080
.getByRole("button")
8181
.getByText(
8282
filterRegex(
83-
anvilFilterNames[Math.floor(Math.random() * anvilFilterNames.length)]
83+
ANVIL_FILTER_NAMES[
84+
Math.floor(Math.random() * ANVIL_FILTER_NAMES.length)
85+
]
8486
)
8587
)
8688
.click();
@@ -104,8 +106,8 @@ test("Check that filter checkboxes are persistent across pages on an arbitrary f
104106
test.setTimeout(120000);
105107
const result = await testFilterPersistence(
106108
page,
107-
anvilFilterNames[FILE_FORMAT_INDEX],
108-
anvilTabTestOrder.map((x) => anvilTabs[x])
109+
ANVIL_FILTER_NAMES[FILE_FORMAT_INDEX],
110+
ANVIL_TAB_TEST_ORDER.map((x) => ANVIL_TABS[x])
109111
);
110112
if (!result) {
111113
test.fail();
@@ -118,9 +120,9 @@ test("Check that filter menu counts match actual counts on the Datasets tab", as
118120
test.setTimeout(120000);
119121
const result = await testFilterCounts(
120122
page,
121-
anvilTabs.datasets,
122-
FILTER_INDEX_LIST.map((x) => anvilFilterNames[x]),
123-
anvilTabs.datasets.maxPages ?? 0
123+
ANVIL_TABS.DATASETS,
124+
FILTER_INDEX_LIST.map((x) => ANVIL_FILTER_NAMES[x]),
125+
ANVIL_TABS.DATASETS.maxPages ?? 0
124126
);
125127
if (!result) {
126128
test.fail();
@@ -133,9 +135,9 @@ test("Check that filter menu counts match actual counts on the Activities tab",
133135
test.setTimeout(120000);
134136
await testFilterCounts(
135137
page,
136-
anvilTabs.activities,
137-
FILTER_INDEX_LIST.map((x) => anvilFilterNames[x]),
138-
anvilTabs.activities.maxPages ?? 0
138+
ANVIL_TABS.ACTIVITIES,
139+
FILTER_INDEX_LIST.map((x) => ANVIL_FILTER_NAMES[x]),
140+
ANVIL_TABS.ACTIVITIES.maxPages ?? 0
139141
);
140142
});
141143

@@ -145,8 +147,8 @@ test("Check that the filter tags match the selected filter for an arbitrary filt
145147
test.setTimeout(120000);
146148
await testFilterTags(
147149
page,
148-
anvilTabs.files,
149-
FILTER_INDEX_LIST_SHORT.map((x) => anvilFilterNames[x])
150+
ANVIL_TABS.FILES,
151+
FILTER_INDEX_LIST_SHORT.map((x) => ANVIL_FILTER_NAMES[x])
150152
);
151153
});
152154

@@ -156,8 +158,8 @@ test("Check that the filter tags match the selected filter for an arbitrary filt
156158
test.setTimeout(120000);
157159
await testFilterTags(
158160
page,
159-
anvilTabs.biosamples,
160-
FILTER_INDEX_LIST_SHORT.map((x) => anvilFilterNames[x])
161+
ANVIL_TABS.BIOSAMPLES,
162+
FILTER_INDEX_LIST_SHORT.map((x) => ANVIL_FILTER_NAMES[x])
161163
);
162164
});
163165

@@ -167,7 +169,7 @@ test("Check that the clear all button functions on the files tab", async ({
167169
test.setTimeout(120000);
168170
await testClearAll(
169171
page,
170-
anvilTabs.files,
171-
FILTER_INDEX_LIST_SHORT.map((x) => anvilFilterNames[x])
172+
ANVIL_TABS.FILES,
173+
FILTER_INDEX_LIST_SHORT.map((x) => ANVIL_FILTER_NAMES[x])
172174
);
173175
});

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

+9-5
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,16 @@ import {
44
testFirstPagePagination,
55
testPaginationContent,
66
} from "../testFunctions";
7-
import { anvilFilterNames, anvilTabs, FILE_FORMAT_INDEX } from "./anvil-tabs";
7+
import {
8+
ANVIL_FILTER_NAMES,
9+
ANVIL_TABS,
10+
FILE_FORMAT_INDEX,
11+
} from "./anvil-tabs";
812

913
test("Check first page has disabled back and enabled forward pagination buttons on Donors Page", async ({
1014
page,
1115
}) => {
12-
await testFirstPagePagination(page, anvilTabs.donors);
16+
await testFirstPagePagination(page, ANVIL_TABS.DONORS);
1317
});
1418

1519
test("Paginate through the entire Files tab to confirm that the page number stays consistent and that paginating forwards is disabled on the last page. Uses filters to reduce the amount of calls necessary", async ({
@@ -18,8 +22,8 @@ test("Paginate through the entire Files tab to confirm that the page number stay
1822
test.setTimeout(500000);
1923
const result = await filterAndTestLastPagePagination(
2024
page,
21-
anvilTabs.files,
22-
anvilFilterNames[FILE_FORMAT_INDEX]
25+
ANVIL_TABS.FILES,
26+
ANVIL_FILTER_NAMES[FILE_FORMAT_INDEX]
2327
);
2428
if (!result) {
2529
test.fail();
@@ -30,5 +34,5 @@ test("Check forward and backwards pagination causes the page content to change o
3034
page,
3135
}) => {
3236
test.setTimeout(90000);
33-
await testPaginationContent(page, anvilTabs.biosamples);
37+
await testPaginationContent(page, ANVIL_TABS.BIOSAMPLES);
3438
});

0 commit comments

Comments
 (0)