Improved intarnationalization test

This commit is contained in:
Grzegorz Leoniec 2018-12-21 15:31:07 +01:00
parent 4fe90668a6
commit 1e1864277d
No known key found for this signature in database
GPG Key ID: 3AA43686D4EB1377
2 changed files with 11 additions and 5 deletions

View File

@ -19,8 +19,6 @@ Feature: Internationalization
| Nederlands | Inloggen |
Scenario: Keep preferred language after refresh
When I select "Deutsch" in the language menu
Then the whole user interface appears in "Deutsch"
Given I previously switched the language to "Deutsch"
And I refresh the page
Then the whole user interface appears in "Deutsch"

View File

@ -20,6 +20,11 @@ const openPage = function(page) {
cy.visit(`${baseUrl}/${page}`)
}
const switchLanguage = function(name) {
cy.get('.login-locale-switch a').click()
cy.contains('.locale-menu-popover a', name).click()
}
const login = (email, password) => {
cy.visit(`${baseUrl}/login`)
cy.get('input[name=email]')
@ -55,6 +60,7 @@ Given('my user account has the role {string}', (role) => {
// TODO: use db factories instead of seed data
})
When('I log out', logout)
When('I visit the {string} page', page => {
@ -100,8 +106,10 @@ Then('I am still logged in', () => {
})
When('I select {string} in the language menu', name => {
cy.get('.login-locale-switch a').click()
cy.contains('.locale-menu-popover a', name).click()
switchLanguage(name)
})
Given('I previously switched the language to {string}', name => {
switchLanguage(name)
})
Then('the whole user interface appears in {string}', name => {
const lang = getLangByName(name)