feat(Cypress): add test for breadcrumbs (#42878)

Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
This commit is contained in:
Sem Bauke
2021-07-16 15:44:52 +02:00
committed by GitHub
parent 8707bd8192
commit cd1c16b3a9

View File

@ -0,0 +1,32 @@
/* global cy */
const challengeUrl =
'/learn/responsive-web-design/basic-html-and-html5/say-hello-to-html-elements';
const superBlockUrl = '/learn/responsive-web-design';
const courseUrl = '/learn/responsive-web-design/#basic-html-and-html5';
describe('The breadcumbs should work corectly', () => {
it('It should have a superblock and a course', () => {
cy.visit(challengeUrl);
cy.get('.ellipsis').contains('Responsive Web Design').and('be.visible');
cy.get('.breadcrumb-left')
.should('have.attr', 'href')
.and('include', superBlockUrl);
cy.get('.breadcrumb-right')
.contains('Basic HTML and HTML5')
.and('be.visible');
cy.get('.breadcrumb-right')
.should('have.attr', 'href')
.and('include', courseUrl);
});
it('Should redirect to the right url', () => {
cy.visit(challengeUrl);
cy.get('.breadcrumb-left').click();
cy.url().should('include', '/responsive-web-design');
cy.visit(challengeUrl);
cy.get('.breadcrumb-right').click();
cy.url().should('include', '/responsive-web-design/#basic-html-and-html5');
});
});