@@ -32,6 +32,13 @@ app.set('views', resolve(handlebarsPath, 'views'));
32
32
// stale data for however long it takes for the query to complete.
33
33
const millisecondsUntilStale = 5000 ;
34
34
35
+ // TODO: Provide through resolvers
36
+ const validAtBrowserCombinations = {
37
+ JAWS : new Set ( [ 'Firefox' , 'Chrome' ] ) ,
38
+ NVDA : new Set ( [ 'Firefox' , 'Chrome' ] ) ,
39
+ 'VoiceOver for macOS' : new Set ( [ 'Firefox' , 'Chrome' , 'Safari' ] )
40
+ } ;
41
+
35
42
const queryReports = async ( ) => {
36
43
const { data, errors } = await apolloServer . executeOperation ( {
37
44
query : gql `
@@ -60,6 +67,12 @@ const queryReports = async () => {
60
67
testPlan {
61
68
id
62
69
}
70
+ tests {
71
+ ats {
72
+ id
73
+ name
74
+ }
75
+ }
63
76
}
64
77
}
65
78
}
@@ -184,7 +197,10 @@ const getLatestReportsForPattern = ({ allTestPlanReports, pattern }) => {
184
197
} ;
185
198
} ;
186
199
187
- const getAllAtBrowserCombinations = reports => {
200
+ // This function gets all the AT + Browser Combinations which have been added to the Test Queue at
201
+ // some point; this means if the combination has never been added, a valid combination will be
202
+ // marked as 'Not Applicable' rather than 'Data Not Yet Available'.
203
+ /*const getAllAtBrowserCombinations = reports => {
188
204
const combinations = {};
189
205
190
206
reports.forEach(report => {
@@ -194,6 +210,39 @@ const getAllAtBrowserCombinations = reports => {
194
210
combinations[report.at.name].add(report.browser.name);
195
211
});
196
212
213
+ return combinations;
214
+ };*/
215
+
216
+ // TODO: Provide through resolvers
217
+ // Check if the applicable ATs reported for the tests found for a report link to an already known
218
+ // reference of which ATs match against which browsers
219
+ const getAllAtBrowserCombinations = reports => {
220
+ const combinations = { } ;
221
+ const loggedAtIds = [ ] ;
222
+
223
+ const report = reports [ 0 ] ;
224
+ report . testPlanVersion . tests . forEach ( test => {
225
+ const atIds = test . ats . map ( at => at . id ) ;
226
+
227
+ if ( ! loggedAtIds . includes ( 1 ) && atIds . includes ( '1' ) ) {
228
+ combinations [ Object . keys ( validAtBrowserCombinations ) [ 0 ] ] =
229
+ Object . values ( validAtBrowserCombinations ) [ 0 ] ;
230
+ loggedAtIds . push ( 1 ) ;
231
+ }
232
+
233
+ if ( ! loggedAtIds . includes ( 2 ) && atIds . includes ( '2' ) ) {
234
+ combinations [ Object . keys ( validAtBrowserCombinations ) [ 1 ] ] =
235
+ Object . values ( validAtBrowserCombinations ) [ 1 ] ;
236
+ loggedAtIds . push ( 2 ) ;
237
+ }
238
+
239
+ if ( ! loggedAtIds . includes ( 3 ) && atIds . includes ( '3' ) ) {
240
+ combinations [ Object . keys ( validAtBrowserCombinations ) [ 2 ] ] =
241
+ Object . values ( validAtBrowserCombinations ) [ 2 ] ;
242
+ loggedAtIds . push ( 3 ) ;
243
+ }
244
+ } ) ;
245
+
197
246
return combinations ;
198
247
} ;
199
248
0 commit comments