diff --git a/cypress/integration/guided-tour.spec.js b/cypress/integration/guided-tour.spec.js index 67b583f1..062ac484 100644 --- a/cypress/integration/guided-tour.spec.js +++ b/cypress/integration/guided-tour.spec.js @@ -1,123 +1,119 @@ /** * Copyright (C) 2021 The Software Heritage developers * See the AUTHORS file at the top-level directory of this distribution * License: GNU Affero General Public License version 3, or any later version * See top-level LICENSE file for more information */ describe('Guided Tour Tests', function() { // utility function to traverse all guided tour steps in a page const clickNextStepButtons = (stopAtTitle = null) => { cy.get('.introjs-nextbutton').then($button => { const buttonText = $button.text(); const headerText = $button.parent().siblings('.introjs-tooltip-header').text(); if (buttonText === 'Next' && headerText.slice(0, -1) !== stopAtTitle) { cy.get('.introjs-nextbutton') .click({force: true}) .then(() => { cy.get('.introjs-tooltip').should('be.visible'); clickNextStepButtons(stopAtTitle); }); } }); }; it('should start UI guided tour when clicking on help button', function() { - cy.ambassadorLogin(); cy.visit('/'); cy.get('.swh-help-link') .click(); cy.get('.introjs-tooltip') .should('exist'); }); it('should change guided tour page after current page steps', function() { - cy.ambassadorLogin(); cy.visit('/'); cy.get('.swh-help-link') .click(); cy.url().then(url => { clickNextStepButtons(); cy.get('.introjs-nextbutton') .should('have.text', 'Next page') .click(); cy.url().should('not.eq', url); }); }); it('should automatically open SWHIDs tab on second page of the guided tour', function() { const guidedTourPageIndex = 1; - cy.ambassadorLogin(); cy.visit('/').window().then(win => { const guidedTour = win.swh.guided_tour.getGuidedTour(); // jump to third guided tour page cy.visit(guidedTour[guidedTourPageIndex].url); cy.window().then(win => { // SWHIDs tab should be closed when tour begins cy.get('.ui-slideouttab-open').should('not.exist'); // init guided tour on the page win.swh.guided_tour.initGuidedTour(guidedTourPageIndex); clickNextStepButtons(); // SWHIDs tab should be opened when tour begins cy.get('.ui-slideouttab-open').should('exist'); }); }); }); it('should stay at step while line numbers not clicked on content view tour', function() { const guidedTourPageIndex = 2; - cy.ambassadorLogin(); // jump to third guided tour page cy.visit('/').window().then(win => { const guidedTour = win.swh.guided_tour.getGuidedTour(); cy.visit(guidedTour[guidedTourPageIndex].url); cy.window().then(win => { // init guided tour on the page win.swh.guided_tour.initGuidedTour(guidedTourPageIndex); clickNextStepButtons('Highlight a source code line'); cy.get('.introjs-tooltip-header').then($header => { const headerText = $header.text(); // user did not click yet on line numbers and should stay // blocked on first step of the tour cy.get('.introjs-nextbutton') .click(); cy.get('.introjs-tooltip-header') .should('have.text', headerText); // click on line numbers cy.get('.hljs-ln-numbers[data-line-number="11"]') .click(); // check move to next step is allowed cy.get('.introjs-nextbutton') .click(); cy.get('.introjs-tooltip-header') .should('not.have.text', headerText); }); cy.get('.introjs-tooltip-header').then($header => { const headerText = $header.text(); // user did not click yet on line numbers and should stay // blocked on first step of the tour cy.get('.introjs-nextbutton') .click(); cy.get('.introjs-tooltip-header') .should('have.text', headerText); // click on line numbers cy.get('.hljs-ln-numbers[data-line-number="17"]') .click({shiftKey: true}); // check move to next step is allowed cy.get('.introjs-nextbutton') .click(); cy.get('.introjs-tooltip-header') .should('not.have.text', headerText); }); }); }); }); }); diff --git a/swh/web/templates/layout.html b/swh/web/templates/layout.html index 61cf7f33..c5c5a965 100644 --- a/swh/web/templates/layout.html +++ b/swh/web/templates/layout.html @@ -1,291 +1,287 @@ {% comment %} Copyright (C) 2015-2021 The Software Heritage developers See the AUTHORS file at the top-level directory of this distribution License: GNU Affero General Public License version 3, or any later version See top-level LICENSE file for more information {% endcomment %} {% load js_reverse %} {% load static %} {% load render_bundle from webpack_loader %} {% load swh_templatetags %} {% block title %}{% endblock %} {% render_bundle 'vendors' %} {% render_bundle 'webapp' %} {% render_bundle 'guided_tour' %} {{ request.user.is_authenticated|json_script:"swh_user_logged_in" }} {% block header %}{% endblock %} {% if not swh_web_dev and not swh_web_staging %} {% endif %}
{% comment %} {% endcomment %}
{% if swh_web_staging %}
Staging
v{{ swh_web_version }}
{% elif swh_web_dev %}
Development
v{{ swh_web_version|split:"+"|first }}
{% endif %} {% block content %}{% endblock %}
{% include "includes/global-modals.html" %}
back to top