All cucumbers have passed

This commit is contained in:
Robert Schäfer 2018-12-12 21:35:37 +01:00
parent 96a30ca03e
commit c8f23f9e6e
2 changed files with 16 additions and 6 deletions

View File

@ -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 |

View File

@ -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)
})
})