diff --git a/templates/class-overview.html b/templates/class-overview.html index 45bf1281bf5..950424ce555 100644 --- a/templates/class-overview.html +++ b/templates/class-overview.html @@ -4,9 +4,9 @@
{% if achievement %} {% endif %}
diff --git a/templates/explore.html b/templates/explore.html index 4bf28058c0e..f2e873b2676 100644 --- a/templates/explore.html +++ b/templates/explore.html @@ -4,9 +4,9 @@
{% if achievement %} {% endif %} @@ -39,7 +39,7 @@

{{_('hedy_choice_title')}}

{% for program in favourite_programs %} - {{ public_programs.program_box(program, true) }} + {{ public_programs.program_box(program, true, is_admin) }} {% endfor %}
@@ -50,7 +50,7 @@

{{_('hedy_choice_title {{_('no_programs')}} {% else %} {% for program in programs %} - {{ public_programs.program_box(program, false) }} + {{ public_programs.program_box(program, false, is_admin) }} {% endfor %} {% endif %}

diff --git a/templates/macros/public-programs.html b/templates/macros/public-programs.html index fbbfa2b3d99..3b7d06dccb1 100644 --- a/templates/macros/public-programs.html +++ b/templates/macros/public-programs.html @@ -1,5 +1,5 @@ -{% macro program_box(program, is_favorite) %} -
+{% macro program_box(program, is_favorite, is_admin) %} +
{ + beforeEach(() => { + loginForAdmin(); + goToExploreProgramsPage(); + }); + + it('When selecting a program as Hedys choice, it should be shown', ()=>{ + // Get the id of the first program in the db + cy.get('#explore_page_programs') + .children() + .first() + .invoke('attr', 'data-cy') + .as('program_id'); + + cy.get('@program_id').then(program_id => { + // mark the program as Hedys choice + cy.get(`#${program_id}`).click(); + cy.get('#modal-yes-button').click(); + // reload the page to see the changes + cy.reload(); + cy.get(`#explore_favourite_programs > [data-cy=${program_id}]`).should('be.visible'); + }); + }); +}); \ No newline at end of file diff --git a/tests/cypress/e2e/tools/navigation/nav.js b/tests/cypress/e2e/tools/navigation/nav.js index e8d7bf7a046..90a57d27364 100644 --- a/tests/cypress/e2e/tools/navigation/nav.js +++ b/tests/cypress/e2e/tools/navigation/nav.js @@ -105,4 +105,9 @@ export function goToEditAdventure() .click(); } +export function goToExploreProgramsPage() +{ + return goToPage(Cypress.env('explore_programs_page')); +} + export default {goToPage}