mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Improved internationalization tests
This commit is contained in:
parent
4a0d03e011
commit
4fe90668a6
@ -6,15 +6,17 @@ Feature: Internationalization
|
||||
Background:
|
||||
Given I am on the "login" page
|
||||
|
||||
Scenario: Change the language
|
||||
When I select "Deutsch" in the language menu
|
||||
Then the whole user interface appears in "Deutsch"
|
||||
Scenario Outline: I select "<language>" in the language menu and see "<buttonLabel>"
|
||||
When I select "<language>" in the language menu
|
||||
Then the whole user interface appears in "<language>"
|
||||
Then I see a button with the label "<buttonLabel>"
|
||||
|
||||
When I select "Français" in the language menu
|
||||
Then the whole user interface appears in "Français"
|
||||
|
||||
When I select "English" in the language menu
|
||||
Then the whole user interface appears in "English"
|
||||
Examples: Login Button
|
||||
| language | buttonLabel |
|
||||
| English | Login |
|
||||
| Deutsch | Einloggen |
|
||||
| Français | Connexion |
|
||||
| Nederlands | Inloggen |
|
||||
|
||||
Scenario: Keep preferred language after refresh
|
||||
When I select "Deutsch" in the language menu
|
||||
|
||||
@ -8,14 +8,6 @@ const baseUrl = 'http://localhost:3000'
|
||||
const username = 'Peter Lustig'
|
||||
|
||||
const locales = require('../../../locales')
|
||||
// TODO: use the native locale files
|
||||
const localeStrings = {
|
||||
login: {
|
||||
English: 'Login',
|
||||
Deutsch: 'Einloggen',
|
||||
Français: 'Connexion'
|
||||
}
|
||||
}
|
||||
|
||||
const getLangByName = function(name) {
|
||||
return find(locales, { name })
|
||||
@ -26,7 +18,6 @@ const openPage = function(page) {
|
||||
page = ''
|
||||
}
|
||||
cy.visit(`${baseUrl}/${page}`)
|
||||
cy.get('html[data-n-head]')
|
||||
}
|
||||
|
||||
const login = (email, password) => {
|
||||
@ -115,10 +106,11 @@ When('I select {string} in the language menu', name => {
|
||||
Then('the whole user interface appears in {string}', name => {
|
||||
const lang = getLangByName(name)
|
||||
cy.get(`html[lang=${lang.code}]`)
|
||||
cy.contains('button', localeStrings.login[name])
|
||||
cy.get(`html[lang=${getLangByName(name).code}]`).as('lang')
|
||||
cy.getCookie('locale').should('have.property', 'value', lang.code)
|
||||
})
|
||||
Then('I see a button with the label {string}', label => {
|
||||
cy.contains('button', label)
|
||||
})
|
||||
|
||||
When('I navigate to the administration dashboard', () => {
|
||||
cy.get('.avatar-menu').click()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user