From cd1c16b3a99243df27aa26d81d19e26486ac3de2 Mon Sep 17 00:00:00 2001 From: Sem Bauke <46919888+Sembauke@users.noreply.github.com> Date: Fri, 16 Jul 2021 15:44:52 +0200 Subject: [PATCH] feat(Cypress): add test for breadcrumbs (#42878) Co-authored-by: Oliver Eyton-Williams --- .../learn/redirects/breadcrumbs.js | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 cypress/integration/learn/redirects/breadcrumbs.js diff --git a/cypress/integration/learn/redirects/breadcrumbs.js b/cypress/integration/learn/redirects/breadcrumbs.js new file mode 100644 index 0000000000..ebd58dc50d --- /dev/null +++ b/cypress/integration/learn/redirects/breadcrumbs.js @@ -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'); + }); +});