Skip to content

Commit

Permalink
Temporarily revise the valid combinations of ATs and Browsers for `em…
Browse files Browse the repository at this point in the history
…bed.js` (#650)

* Temporarily revise the valid combinations of ATs and Browsers
  • Loading branch information
howard-e authored Jun 6, 2023
1 parent cc91496 commit d062676
Showing 1 changed file with 50 additions and 1 deletion.
51 changes: 50 additions & 1 deletion server/apps/embed.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ app.set('views', resolve(handlebarsPath, 'views'));
// stale data for however long it takes for the query to complete.
const millisecondsUntilStale = 5000;

// TODO: Provide through resolvers
const validAtBrowserCombinations = {
JAWS: new Set(['Firefox', 'Chrome']),
NVDA: new Set(['Firefox', 'Chrome']),
'VoiceOver for macOS': new Set(['Firefox', 'Chrome', 'Safari'])
};

const queryReports = async () => {
const { data, errors } = await apolloServer.executeOperation({
query: gql`
Expand Down Expand Up @@ -60,6 +67,12 @@ const queryReports = async () => {
testPlan {
id
}
tests {
ats {
id
name
}
}
}
}
}
Expand Down Expand Up @@ -184,7 +197,10 @@ const getLatestReportsForPattern = ({ allTestPlanReports, pattern }) => {
};
};

const getAllAtBrowserCombinations = reports => {
// This function gets all the AT + Browser Combinations which have been added to the Test Queue at
// some point; this means if the combination has never been added, a valid combination will be
// marked as 'Not Applicable' rather than 'Data Not Yet Available'.
/*const getAllAtBrowserCombinations = reports => {
const combinations = {};
reports.forEach(report => {
Expand All @@ -194,6 +210,39 @@ const getAllAtBrowserCombinations = reports => {
combinations[report.at.name].add(report.browser.name);
});
return combinations;
};*/

// TODO: Provide through resolvers
// Check if the applicable ATs reported for the tests found for a report link to an already known
// reference of which ATs match against which browsers
const getAllAtBrowserCombinations = reports => {
const combinations = {};
const loggedAtIds = [];

const report = reports[0];
report.testPlanVersion.tests.forEach(test => {
const atIds = test.ats.map(at => at.id);

if (!loggedAtIds.includes(1) && atIds.includes('1')) {
combinations[Object.keys(validAtBrowserCombinations)[0]] =
Object.values(validAtBrowserCombinations)[0];
loggedAtIds.push(1);
}

if (!loggedAtIds.includes(2) && atIds.includes('2')) {
combinations[Object.keys(validAtBrowserCombinations)[1]] =
Object.values(validAtBrowserCombinations)[1];
loggedAtIds.push(2);
}

if (!loggedAtIds.includes(3) && atIds.includes('3')) {
combinations[Object.keys(validAtBrowserCombinations)[2]] =
Object.values(validAtBrowserCombinations)[2];
loggedAtIds.push(3);
}
});

return combinations;
};

Expand Down

0 comments on commit d062676

Please sign in to comment.