Files
freeCodeCamp/cypress/e2e/mobile-learn/test-challenges.js
2023-09-07 23:06:01 +05:30

35 lines
1.2 KiB
JavaScript

import currData from '../../../shared/config/curriculum.json';
import { orderedSuperBlockInfo } from '../../../tools/scripts/build/build-external-curricula-data';
const nonEditorSB = [
'scientific-computing-with-python',
'data-analysis-with-python',
'machine-learning-with-python'
];
const publicSB = orderedSuperBlockInfo
.filter(sb => sb.public === true && !nonEditorSB.includes(sb.dashedName))
.map(sb => sb.dashedName);
describe('Test challenges in mobile', () => {
for (let superBlock of publicSB) {
for (let currBlock of Object.values(currData[superBlock]['blocks'])) {
describe(`SuperBlock: ${superBlock} - Block: ${currBlock['meta']['name']}`, () => {
for (let currChallenge of currBlock['challenges']) {
it(`Challenge: ${currChallenge['title']}(${currChallenge['id']})`, () => {
cy.visit(
`/${superBlock}/${currChallenge['block']}/${currChallenge['id']}`,
{
onBeforeLoad(win) {
cy.spy(win.console, 'log').as('consoleLog');
}
}
);
cy.get('@consoleLog').should('be.calledWith', 'completed');
});
}
});
}
}
});