1
1
import { expect , test } from "@playwright/test" ;
2
2
import {
3
3
filterRegex ,
4
- getFirstElementTextLocator ,
4
+ getFirstRowNthColumnCellLocator ,
5
5
testClearAll ,
6
- testFilterBubbles ,
7
6
testFilterCounts ,
8
7
testFilterPersistence ,
9
8
testFilterPresence ,
9
+ testFilterTags ,
10
10
} from "../testFunctions" ;
11
11
import {
12
- anvilFilters ,
12
+ anvilFilterNames ,
13
13
anvilTabs ,
14
14
anvilTabTestOrder ,
15
15
BIOSAMPLE_TYPE_INDEX ,
@@ -38,31 +38,31 @@ const FILTER_INDEX_LIST_SHORT = [
38
38
test ( "Check that all filters exist on the Datasets tab and are clickable" , async ( {
39
39
page,
40
40
} ) => {
41
- await testFilterPresence ( page , anvilTabs . datasets , anvilFilters ) ;
41
+ await testFilterPresence ( page , anvilTabs . datasets , anvilFilterNames ) ;
42
42
} ) ;
43
43
44
44
test ( "Check that all filters exist on the Donors tab and are clickable" , async ( {
45
45
page,
46
46
} ) => {
47
- await testFilterPresence ( page , anvilTabs . donors , anvilFilters ) ;
47
+ await testFilterPresence ( page , anvilTabs . donors , anvilFilterNames ) ;
48
48
} ) ;
49
49
50
50
test ( "Check that all filters exist on the BioSamples tab and are clickable" , async ( {
51
51
page,
52
52
} ) => {
53
- await testFilterPresence ( page , anvilTabs . biosamples , anvilFilters ) ;
53
+ await testFilterPresence ( page , anvilTabs . biosamples , anvilFilterNames ) ;
54
54
} ) ;
55
55
56
56
test ( "Check that all filters exist on the Activities tab and are clickable" , async ( {
57
57
page,
58
58
} ) => {
59
- await testFilterPresence ( page , anvilTabs . activities , anvilFilters ) ;
59
+ await testFilterPresence ( page , anvilTabs . activities , anvilFilterNames ) ;
60
60
} ) ;
61
61
62
62
test ( "Check that all filters exist on the Files tab and are clickable" , async ( {
63
63
page,
64
64
} ) => {
65
- await testFilterPresence ( page , anvilTabs . files , anvilFilters ) ;
65
+ await testFilterPresence ( page , anvilTabs . files , anvilFilterNames ) ;
66
66
} ) ;
67
67
68
68
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 ( {
@@ -79,7 +79,9 @@ test("Check that the first filter on the Datasets tab creates at least one check
79
79
await page
80
80
. getByRole ( "button" )
81
81
. getByText (
82
- filterRegex ( anvilFilters [ Math . floor ( Math . random ( ) * anvilFilters . length ) ] )
82
+ filterRegex (
83
+ anvilFilterNames [ Math . floor ( Math . random ( ) * anvilFilterNames . length ) ]
84
+ )
83
85
)
84
86
. click ( ) ;
85
87
// Expect all checkboxes to be unchecked initially and to work properly
@@ -93,18 +95,21 @@ test("Check that the first filter on the Datasets tab creates at least one check
93
95
await expect ( checkbox ) . toBeChecked ( ) ;
94
96
}
95
97
await page . locator ( "body" ) . click ( ) ;
96
- await expect ( getFirstElementTextLocator ( page , 0 ) ) . toBeVisible ( ) ;
98
+ await expect ( getFirstRowNthColumnCellLocator ( page , 0 ) ) . toBeVisible ( ) ;
97
99
} ) ;
98
100
99
101
test ( "Check that filter checkboxes are persistent across pages on an arbitrary filter" , async ( {
100
102
page,
101
103
} ) => {
102
104
test . setTimeout ( 120000 ) ;
103
- await testFilterPersistence (
105
+ const result = await testFilterPersistence (
104
106
page ,
105
- anvilFilters [ FILE_FORMAT_INDEX ] ,
107
+ anvilFilterNames [ FILE_FORMAT_INDEX ] ,
106
108
anvilTabTestOrder . map ( ( x ) => anvilTabs [ x ] )
107
109
) ;
110
+ if ( ! result ) {
111
+ test . fail ( ) ;
112
+ }
108
113
} ) ;
109
114
110
115
test ( "Check that filter menu counts match actual counts on the Datasets tab" , async ( {
@@ -114,7 +119,7 @@ test("Check that filter menu counts match actual counts on the Datasets tab", as
114
119
const result = await testFilterCounts (
115
120
page ,
116
121
anvilTabs . datasets ,
117
- FILTER_INDEX_LIST . map ( ( x ) => anvilFilters [ x ] ) ,
122
+ FILTER_INDEX_LIST . map ( ( x ) => anvilFilterNames [ x ] ) ,
118
123
anvilTabs . datasets . maxPages ?? 0
119
124
) ;
120
125
if ( ! result ) {
@@ -129,30 +134,30 @@ test("Check that filter menu counts match actual counts on the Activities tab",
129
134
await testFilterCounts (
130
135
page ,
131
136
anvilTabs . activities ,
132
- FILTER_INDEX_LIST . map ( ( x ) => anvilFilters [ x ] ) ,
137
+ FILTER_INDEX_LIST . map ( ( x ) => anvilFilterNames [ x ] ) ,
133
138
anvilTabs . activities . maxPages ?? 0
134
139
) ;
135
140
} ) ;
136
141
137
- test ( "Check that the blue filter bubbles match the selected filter for an arbitrary filter on the Files tab" , async ( {
142
+ test ( "Check that the filter tags match the selected filter for an arbitrary filter on the Files tab" , async ( {
138
143
page,
139
144
} ) => {
140
145
test . setTimeout ( 120000 ) ;
141
- await testFilterBubbles (
146
+ await testFilterTags (
142
147
page ,
143
148
anvilTabs . files ,
144
- FILTER_INDEX_LIST_SHORT . map ( ( x ) => anvilFilters [ x ] )
149
+ FILTER_INDEX_LIST_SHORT . map ( ( x ) => anvilFilterNames [ x ] )
145
150
) ;
146
151
} ) ;
147
152
148
- test ( "Check that the blue filter bubbles match the selected filter for an arbitrary filter on the BioSamples tab" , async ( {
153
+ test ( "Check that the filter tags match the selected filter for an arbitrary filter on the BioSamples tab" , async ( {
149
154
page,
150
155
} ) => {
151
156
test . setTimeout ( 120000 ) ;
152
- await testFilterBubbles (
157
+ await testFilterTags (
153
158
page ,
154
159
anvilTabs . biosamples ,
155
- FILTER_INDEX_LIST_SHORT . map ( ( x ) => anvilFilters [ x ] )
160
+ FILTER_INDEX_LIST_SHORT . map ( ( x ) => anvilFilterNames [ x ] )
156
161
) ;
157
162
} ) ;
158
163
@@ -163,6 +168,6 @@ test("Check that the clear all button functions on the files tab", async ({
163
168
await testClearAll (
164
169
page ,
165
170
anvilTabs . files ,
166
- FILTER_INDEX_LIST_SHORT . map ( ( x ) => anvilFilters [ x ] )
171
+ FILTER_INDEX_LIST_SHORT . map ( ( x ) => anvilFilterNames [ x ] )
167
172
) ;
168
173
} ) ;
0 commit comments