2021-11-19 14:19:40 +00:00
|
|
|
import { SuperBlocks } from '../../../../config/certification-settings';
|
|
|
|
|
2021-07-15 15:51:27 +01:00
|
|
|
const projects = {
|
2021-11-19 14:19:40 +00:00
|
|
|
superBlock: SuperBlocks.RespWebDesign,
|
2021-07-15 15:51:27 +01:00
|
|
|
block: 'responsive-web-design-projects',
|
|
|
|
challenges: [
|
|
|
|
{
|
|
|
|
slug: 'build-a-tribute-page',
|
|
|
|
solution: 'https://codepen.io/moT01/pen/ZpJpKp'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
slug: 'build-a-survey-form',
|
|
|
|
solution: 'https://codepen.io/moT01/pen/LrrjGz?editors=1010'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
slug: 'build-a-product-landing-page',
|
|
|
|
solution: 'https://codepen.io/moT01/full/qKyKYL/'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
slug: 'build-a-technical-documentation-page',
|
|
|
|
solution: 'https://codepen.io/moT01/full/JBvzNL/'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
slug: 'build-a-personal-portfolio-webpage',
|
|
|
|
solution: 'https://codepen.io/moT01/pen/vgOaoJ'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
};
|
|
|
|
|
|
|
|
describe('Responsive Web Design Superblock', () => {
|
|
|
|
before(() => {
|
|
|
|
cy.exec('npm run seed');
|
|
|
|
cy.login();
|
|
|
|
cy.visit('/learn/responsive-web-design');
|
|
|
|
});
|
|
|
|
describe('Before submitting projects', () => {
|
2022-01-18 16:52:49 +02:00
|
|
|
it('should navigate to "/settings#certification-settings" when clicking the "Go to settings to claim your certification" anchor', () => {
|
|
|
|
cy.contains('Go to settings to claim your certification').click();
|
|
|
|
cy.url().should('include', '/settings#certification-settings');
|
2021-07-15 15:51:27 +01:00
|
|
|
});
|
|
|
|
});
|
|
|
|
describe('After submitting all 5 projects', () => {
|
|
|
|
before(() => {
|
2021-10-01 06:30:14 +02:00
|
|
|
cy.exec('npm run seed');
|
2021-08-24 20:26:48 +02:00
|
|
|
cy.login();
|
2021-07-15 15:51:27 +01:00
|
|
|
cy.toggleAll();
|
2022-01-25 21:23:01 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should be possible to view certifications from the settings page', () => {
|
|
|
|
submitFrontEndSolutions();
|
|
|
|
cy.visit(`/learn/${projects.superBlock}/`);
|
|
|
|
cy.contains('Go to settings to claim your certification').click();
|
|
|
|
cy.location().should(loc => {
|
|
|
|
expect(loc.pathname).to.eq(`/settings`);
|
|
|
|
});
|
|
|
|
cy.get('[data-cy=btn-for-responsive-web-design]').click();
|
|
|
|
cy.contains('Show Certification').click();
|
|
|
|
cy.location().should(loc => {
|
|
|
|
expect(loc.pathname).to.eq(
|
|
|
|
`/certification/developmentuser/${projects.superBlock}`
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
function submitFrontEndSolutions() {
|
2021-07-15 15:51:27 +01:00
|
|
|
const { superBlock, block, challenges } = projects;
|
|
|
|
challenges.forEach(({ slug, solution }) => {
|
|
|
|
const url = `/learn/${superBlock}/${block}/${slug}`;
|
|
|
|
cy.visit(url);
|
|
|
|
cy.get('#dynamic-front-end-form')
|
|
|
|
.get('#solution')
|
|
|
|
.type(solution, { force: true, delay: 0 });
|
|
|
|
cy.contains("I've completed this challenge")
|
|
|
|
.should('not.be.disabled')
|
|
|
|
.click();
|
2022-01-18 16:52:49 +02:00
|
|
|
cy.intercept(`${Cypress.env('API_LOCATION')}/project-completed`).as(
|
2021-07-23 23:27:12 +02:00
|
|
|
'challengeCompleted'
|
|
|
|
);
|
2021-07-15 15:51:27 +01:00
|
|
|
cy.contains('Submit and go to next challenge').click();
|
2021-07-23 23:27:12 +02:00
|
|
|
cy.wait('@challengeCompleted')
|
|
|
|
.its('response.statusCode')
|
|
|
|
.should('eq', 200);
|
2021-07-15 15:51:27 +01:00
|
|
|
cy.location().should(loc => {
|
|
|
|
expect(loc.pathname).to.not.eq(url);
|
|
|
|
});
|
|
|
|
});
|
2022-01-25 21:23:01 +01:00
|
|
|
}
|
2021-07-15 15:51:27 +01:00
|
|
|
});
|
|
|
|
});
|