diff --git a/cypress/integration/TagsAndCategories.feature b/cypress/integration/TagsAndCategories.feature index 7655893e5..f9509e858 100644 --- a/cypress/integration/TagsAndCategories.feature +++ b/cypress/integration/TagsAndCategories.feature @@ -16,10 +16,9 @@ Feature: Tags and Categories Background: Given we have a selection of tags and categories as well as posts And my user account has the role "administrator" - - @focus - Scenario: See an overview of categories Given I am logged in + + Scenario: See an overview of categories When I navigate to the administration dashboard And I click on "Categories" Then I can see a list of categories ordered by post count: @@ -31,7 +30,7 @@ Feature: Tags and Categories Scenario: See an overview of tags When I navigate to the administration dashboard And I click on "Tags" - Then I can see a list of categories ordered by post count: + Then I can see a list of tags ordered by user and post count: | # | Name | Nutzer | Beiträge | | 1 | Naturschutz | 2 | 2 | | 2 | Freiheit | 2 | 2 | diff --git a/cypress/integration/common/steps.js b/cypress/integration/common/steps.js index 5474475ab..f6bb9f2b0 100644 --- a/cypress/integration/common/steps.js +++ b/cypress/integration/common/steps.js @@ -85,8 +85,8 @@ When('I navigate to the administration dashboard', () => { cy.get('a').contains('Systemverwaltung').click() }) -When(`I click on {string}`, (link) => { - cy.contains(link).click() +When(`I click on {string}`, (linkOrButton) => { + cy.contains(linkOrButton).click() }) Then('I can see a list of categories ordered by post count:', (table) => { @@ -99,3 +99,14 @@ Then('I can see a list of categories ordered by post count:', (table) => { return cy.wrap(values).should('deep.eq', ordered_descending) }) }) + +Then('I can see a list of tags ordered by user and post count:', (table) => { + // TODO: match the table in the feature with the html table + cy.get('thead').find('tr th').should('have.length', 4) + const last_column = cy.get('tbody').find('tr td:last-child').then((last_column) => { + cy.wrap(last_column) + const values = last_column.map((i, td) => parseInt(td.textContent)).toArray() + const ordered_descending = values.slice(0).sort((a,b) => b - a) + return cy.wrap(values).should('deep.eq', ordered_descending) + }) +})