Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporarily revise the valid combinations of ATs and Browsers for embed.js #650

Merged
merged 2 commits into from
Jun 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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