Skip to content

Commit d062676

Browse files
authored
Temporarily revise the valid combinations of ATs and Browsers for embed.js (#650)
* Temporarily revise the valid combinations of ATs and Browsers
1 parent cc91496 commit d062676

File tree

1 file changed

+50
-1
lines changed

1 file changed

+50
-1
lines changed

server/apps/embed.js

+50-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ app.set('views', resolve(handlebarsPath, 'views'));
3232
// stale data for however long it takes for the query to complete.
3333
const millisecondsUntilStale = 5000;
3434

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+
3542
const queryReports = async () => {
3643
const { data, errors } = await apolloServer.executeOperation({
3744
query: gql`
@@ -60,6 +67,12 @@ const queryReports = async () => {
6067
testPlan {
6168
id
6269
}
70+
tests {
71+
ats {
72+
id
73+
name
74+
}
75+
}
6376
}
6477
}
6578
}
@@ -184,7 +197,10 @@ const getLatestReportsForPattern = ({ allTestPlanReports, pattern }) => {
184197
};
185198
};
186199

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 => {
188204
const combinations = {};
189205
190206
reports.forEach(report => {
@@ -194,6 +210,39 @@ const getAllAtBrowserCombinations = reports => {
194210
combinations[report.at.name].add(report.browser.name);
195211
});
196212
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+
197246
return combinations;
198247
};
199248

0 commit comments

Comments
 (0)