Files
freeCodeCamp/cypress/integration/learn/responsive-web-design/claim-cert-from-learn.js
Shaun Hamilton d75e43a1e7 chore: use constants for superblocks (#43886)
* chore: use constants for superblocks

* add prettier ts dec to challenge-helper-scripts

* config/ to ts. broken

* typescripterise tools/ and config/

* create global tsconfig, remove alternate configs

* delete temp ts->js, add to gitignore

* fix gitignore

* re-import SuperBlocks in super-block-intro.tsx

* remove renamed files added again

* fix config

* remove accidental files

* remove snap

* delete built files

* adjust eslintrc for enums

* add node types to root

* ignore build files in lint and prettier

* fix tools/ in tsconfig

* ignore annoying ts warnings

* prettierise Map/index.tsx

* fix enum to match lint rule

* rejig Map to render RWD superblock

* 'pretty minor' - implicitly tsc within root

Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>

* fix client/package.json for Gitpod

* broken: migrate @types to root

* fix: use typeRoots to prevent duplication

* fix show.tsx, try typeroots in root

* silly fix for duplicate node_modules types

* remove typeRoots from root

* fix: tsconfig or not tsconfig, that is the...

* fix: ...question: Whether 'tis nobler in the mind

to suffer the slings and arrows of outrageous configs...

* fix: Or to take Arms against a Sea of lint errors
And by opposing end them

Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
2021-11-19 19:49:40 +05:30

102 lines
3.6 KiB
JavaScript

import { SuperBlocks } from '../../../../config/certification-settings';
const projects = {
superBlock: SuperBlocks.RespWebDesign,
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', () => {
it('should have a card with href "claim-cert-block"', () => {
cy.get('a[href="#claim-cert-block"]').scrollIntoView();
cy.get('a[href="#claim-cert-block"]').should('be.visible');
});
it('should have an anchor element with the text "Claim Certification", and class "disabled"', () => {
cy.get('a.disabled').should('be.visible');
cy.get('a.disabled').should('have.text', 'Claim Certification');
});
it('should have an unordered list with class "map-challenges-ul" containing 5 items', () => {
cy.get('[data-cy=claim-cert-steps]').should('be.visible');
cy.get('[data-cy=claim-cert-steps]').children().should('have.length', 5);
});
});
describe('After submitting all 5 projects', () => {
before(() => {
cy.exec('npm run seed');
cy.login();
cy.toggleAll();
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();
cy.intercept('http://localhost:3000/project-completed').as(
'challengeCompleted'
);
cy.contains('Submit and go to next challenge').click();
cy.wait('@challengeCompleted')
.its('response.statusCode')
.should('eq', 200);
cy.location().should(loc => {
expect(loc.pathname).to.not.eq(url);
});
});
});
it('should be possible to claim and view certifications from the superBlock page', () => {
cy.location().should(loc => {
expect(loc.pathname).to.eq(`/learn/${projects.superBlock}/`);
});
cy.get('.donation-modal').should('be.visible');
cy.contains('Ask me later').click();
cy.get('.donation-modal').should('not.exist');
// directed to claim-cert-block section
cy.url().should('include', '#claim-cert-block');
// make sure that the window has not snapped to the top (a weird bug that
// we never figured out and so could randomly reappear)
cy.window().its('scrollY').should('not.equal', 0);
cy.contains('Claim Your Certification');
cy.contains('Claim Certification').should('not.be.disabled').click();
cy.contains('Show Certification').click();
cy.location().should(loc => {
expect(loc.pathname).to.eq(
'/certification/developmentuser/responsive-web-design'
);
});
});
});
});