chore: remove verify-can-claim-cert logic (#44574)

* chore: remove verify-can-claim-cert logic

* remove extraneous

* remove console log before Nich wakes up

* add api route back with flash

* remove unnecessary logic in completion-epic

* change tests for new layout

* dynamically use api location

* rename file

* fix Cypress api location

* fix(test): anchor does not have disabled class

* fix(tests): change js test to claim from /settings

* chore: change status to 410 (gone)

* update testing again

* oliver is nitpicky

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

* make oliver happy

Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
This commit is contained in:
Shaun Hamilton
2022-01-18 16:52:49 +02:00
committed by GitHub
parent 9672c92a19
commit 9cb87d0257
12 changed files with 72 additions and 491 deletions

View File

@ -0,0 +1,86 @@
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 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');
});
});
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(`${Cypress.env('API_LOCATION')}/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);
});
cy.visit('/settings');
cy.get(
`[href="/certification/developmentuser/${projects.superBlock}"]`
).click();
cy.visit(`/learn/${projects.superBlock}/`);
});
});
it('should be possible to view certifications from the superBlock page', () => {
cy.location().should(loc => {
expect(loc.pathname).to.eq(`/learn/${projects.superBlock}/`);
});
cy.contains('Show Certification').click();
cy.location().should(loc => {
expect(loc.pathname).to.eq(
`/certification/developmentuser/${projects.superBlock}`
);
});
});
});
});