mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Improved integration tests
This commit is contained in:
parent
c45be5f39b
commit
02ed3db6fc
@ -13,12 +13,11 @@ Feature: Internationalization
|
||||
|
||||
Examples: Login Button
|
||||
| language | buttonLabel |
|
||||
| English | Login |
|
||||
| Deutsch | Einloggen |
|
||||
| Français | Connexion |
|
||||
| Nederlands | Inloggen |
|
||||
| Deutsch | Einloggen |
|
||||
| English | Login |
|
||||
|
||||
Scenario: Keep preferred language after refresh
|
||||
Given I previously switched the language to "Deutsch"
|
||||
Given I previously switched the language to "Français"
|
||||
And I refresh the page
|
||||
Then the whole user interface appears in "Deutsch"
|
||||
Then the whole user interface appears in "Français"
|
||||
|
||||
@ -17,8 +17,8 @@ const lastColumnIsSortedInDescendingOrder = () => {
|
||||
|
||||
When('I navigate to the administration dashboard', () => {
|
||||
cy.get('.avatar-menu').click()
|
||||
cy.get('.avatar-menu-popover a')
|
||||
.contains('Admin')
|
||||
cy.get('.avatar-menu-popover')
|
||||
.find('a[href="/admin"]')
|
||||
.click()
|
||||
})
|
||||
|
||||
|
||||
@ -7,8 +7,9 @@ let myLocation
|
||||
let myName
|
||||
|
||||
const matchNameInUserMenu = name => {
|
||||
cy.get('.avatar-menu').click()
|
||||
cy.get('.avatar-menu').click() // open
|
||||
cy.get('.avatar-menu-popover').contains(name)
|
||||
cy.get('.avatar-menu').click() // close again
|
||||
}
|
||||
|
||||
const setUserName = name => {
|
||||
@ -66,3 +67,8 @@ Then('they can see the location in the info box below my avatar', () => {
|
||||
Then('my new username is still there', () => {
|
||||
matchNameInUserMenu(myName)
|
||||
})
|
||||
|
||||
Then(
|
||||
'I can see my new name {string} when I click on my profile picture in the top right',
|
||||
name => matchNameInUserMenu(name)
|
||||
)
|
||||
|
||||
@ -48,8 +48,7 @@ When('I refresh the page', () => {
|
||||
When('I log out through the menu in the top right corner', () => {
|
||||
cy.get('.avatar-menu').click()
|
||||
cy.get('.avatar-menu-popover')
|
||||
.find('a')
|
||||
.contains('Logout')
|
||||
.find('a[href="/logout"]')
|
||||
.click()
|
||||
})
|
||||
|
||||
@ -64,7 +63,6 @@ Then('I can see my name {string} in the dropdown menu', () => {
|
||||
|
||||
Then('I see the login screen again', () => {
|
||||
cy.location('pathname').should('contain', '/login')
|
||||
cy.contains('If you already have a human-connection account, login here.')
|
||||
})
|
||||
|
||||
Then('I am still logged in', () => {
|
||||
|
||||
@ -17,21 +17,25 @@
|
||||
import { getLangByName } from './helpers'
|
||||
|
||||
const switchLang = name => {
|
||||
cy.get('.login-locale-switch a').click()
|
||||
cy.get('.locale-menu').click()
|
||||
cy.contains('.locale-menu-popover a', name).click()
|
||||
}
|
||||
|
||||
Cypress.Commands.add('switchLanguage', (name, force) => {
|
||||
const code = getLangByName(name).code
|
||||
if (force || !cy.get(`html[lang=${code}]`)) {
|
||||
if (force) {
|
||||
switchLang(name)
|
||||
} else {
|
||||
cy.get('html').then($html => {
|
||||
if ($html && $html.attr('lang') !== code) {
|
||||
switchLang(name)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
Cypress.Commands.add('visitMyProfile', () => {
|
||||
if (!cy.get('.avatar-menu-popover')) {
|
||||
cy.get('.avatar-menu').click()
|
||||
}
|
||||
cy.get('.avatar-menu').click()
|
||||
cy.get('.avatar-menu-popover')
|
||||
.find('a[href^="/profile/"]')
|
||||
.click()
|
||||
@ -39,7 +43,6 @@ Cypress.Commands.add('visitMyProfile', () => {
|
||||
|
||||
Cypress.Commands.add('login', (email, password) => {
|
||||
cy.visit(`/login`)
|
||||
cy.switchLanguage('English')
|
||||
cy.get('input[name=email]')
|
||||
.trigger('focus')
|
||||
.type(email)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user