-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sidm 4015 welsh functional tests (#352)
* Add functional tests: duplicate registration in different languages * Welsh tests. * Welsh tests. * Welsh tests. * Welsh tests.
- Loading branch information
Radoslaw Orlowski
authored
Apr 21, 2020
1 parent
147db73
commit 15bb408
Showing
5 changed files
with
239 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const TestData = require('./../config/test_data'); | ||
|
||
const localeParam = 'ui_locales'; | ||
const localeCookie = 'idam_ui_locales'; | ||
|
||
module.exports = { | ||
localeParam: localeParam, | ||
localeCookie: localeCookie, | ||
|
||
pageUrl: TestData.WEB_PUBLIC_URL, | ||
|
||
accessDeniedWelsh: 'Mynediad wedi\'i wrthod', | ||
pageUrlWithParamWelsh: `${TestData.WEB_PUBLIC_URL}?${localeParam}=cy`, | ||
pageUrlWithParamEnglish: `${TestData.WEB_PUBLIC_URL}?${localeParam}=en`, | ||
|
||
urlForceEn: `&${localeParam}=en`, | ||
urlForceCy: `&${localeParam}=cy`, | ||
urlInvalidLang: `&${localeParam}=invalid`, | ||
|
||
createAnAccountOrSignIn: 'Creu cyfrif neu fewngofnodi', | ||
createAnAccount: 'Creu cyfrif', | ||
continueBtn: 'Parhau', | ||
checkYourEmail: 'Gwiriwch eich negeseuon e-bost', | ||
youAlreadyHaveAccountSubject: 'Mae gennych gyfrif yn barod / You already have an account', | ||
createAPassword: 'Creu cyfrinair', | ||
userActivationTitle: 'Actifadu Cyfrif Defnyddiwr - Mynediad GLlTEM', | ||
accountCreated: 'Mae eich cyfrif wedi cael ei greu', | ||
youCanNowSignIn: 'Gallwch nawr fewngofnodi i’ch cyfrif.', | ||
signIn: 'Mewngofnodi', | ||
signInOrCreateAccount: 'Mewngofnodwch neu crëwch gyfrif', | ||
forgottenPassword: 'Wedi anghofio eich cyfrinair?', | ||
resetYourPassword: 'ailosod eich cyfrinair', | ||
submitBtn: 'Cyflwyno', | ||
createANewPassword: 'Creu cyfrinair newydd', | ||
passwordChanged: 'Mae eich cyfrinair wedi cael ei newid', | ||
verificationRequired: 'Mae angen dilysu eich cyfrif' | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
const TestData = require('./config/test_data'); | ||
const randomData = require('./shared/random_data'); | ||
const assert = require('assert'); | ||
const Welsh = require('./shared/welsh_constants'); | ||
|
||
Feature('Welsh Language'); | ||
|
||
const serviceName = randomData.getRandomServiceName(); | ||
const citizenEmail = 'citizen.' + randomData.getRandomEmailAddress(); | ||
|
||
let userFirstNames = []; | ||
let serviceNames = []; | ||
let randomUserFirstName; | ||
let randomUserLastName; | ||
let specialCharacterPassword; | ||
|
||
|
||
BeforeSuite(async (I) => { | ||
randomUserFirstName = randomData.getRandomUserName(); | ||
randomUserLastName = randomData.getRandomUserName(); | ||
await I.createServiceData(serviceName); | ||
serviceNames.push(serviceName); | ||
await I.createUserWithRoles(citizenEmail, randomUserFirstName, ["citizen"]); | ||
userFirstNames.push(randomUserFirstName); | ||
specialCharacterPassword = 'New%%%&&&234'; | ||
}); | ||
|
||
AfterSuite(async (I) => { | ||
return await I.deleteAllTestData(randomData.TEST_BASE_PREFIX); | ||
}); | ||
|
||
Scenario('@functional @welshLanguage There is a language switch that is working', async (I) => { | ||
|
||
const welshLinkValue = 'Cymraeg'; | ||
const englishLinkValue = 'English'; | ||
|
||
I.amOnPage(Welsh.pageUrlWithParamEnglish); | ||
|
||
I.waitForText('Access Denied', 20, 'h1'); | ||
I.waitForText(welshLinkValue); | ||
|
||
I.click(welshLinkValue); | ||
I.waitForText(Welsh.accessDeniedWelsh, 20, 'h1'); | ||
I.waitForText(englishLinkValue); | ||
|
||
I.click(englishLinkValue); | ||
I.waitForText(welshLinkValue, 20); | ||
}); | ||
|
||
Scenario('@functional @welshLanguage I can set the language with a cookie', async (I) => { | ||
|
||
I.amOnPage(Welsh.pageUrl); | ||
I.setCookie({name: Welsh.localeCookie, value: 'cy'}); | ||
I.amOnPage(Welsh.pageUrl); | ||
I.waitForText(Welsh.accessDeniedWelsh, 20, 'h1'); | ||
}); | ||
|
||
Scenario('@functional @welshLanguage I can set the language with a header', async (I) => { | ||
|
||
I.amOnPage(Welsh.pageUrl); | ||
I.clearCookie(Welsh.localeCookie); | ||
I.haveRequestHeaders({'Accept-Language': 'cy'}); | ||
I.amOnPage(Welsh.pageUrl); | ||
I.waitForText(Welsh.accessDeniedWelsh, 20, 'h1'); | ||
}); | ||
|
||
Scenario('@functional @welshLanguage I can set the language with a parameter', async (I) => { | ||
|
||
I.amOnPage(Welsh.pageUrl); | ||
I.clearCookie(Welsh.localeCookie); | ||
I.amOnPage(Welsh.pageUrlWithParamWelsh); | ||
I.waitForText(Welsh.accessDeniedWelsh, 20, 'h1'); | ||
}); | ||
|
||
Scenario('@functional @welshLanguage I can set the language to English with an invalid parameter', async (I) => { | ||
|
||
I.amOnPage(Welsh.pageUrl); | ||
I.clearCookie(Welsh.localeCookie); | ||
I.amOnPage(Welsh.pageUrl + '?' + Welsh.urlInvalidLang); | ||
I.waitForText('Access Denied', 20, 'h1'); | ||
}); | ||
|
||
Scenario('@functional @welshLanguage I can reset my password in Welsh', async (I) => { | ||
|
||
const loginPage = `${TestData.WEB_PUBLIC_URL}/login?redirect_uri=${TestData.SERVICE_REDIRECT_URI}&client_id=${serviceName}${Welsh.urlForceCy}`; | ||
|
||
I.amOnPage(loginPage); | ||
I.waitForText(Welsh.signInOrCreateAccount, 20, 'h1'); | ||
I.see(Welsh.forgottenPassword); | ||
I.click(Welsh.forgottenPassword); | ||
I.waitInUrl('reset/forgotpassword'); | ||
I.waitForText(Welsh.resetYourPassword, 20, 'h1'); | ||
I.fillField('#email', citizenEmail); | ||
I.click(Welsh.submitBtn); | ||
I.waitForText(Welsh.checkYourEmail, 20, 'h1'); | ||
I.wait(5); | ||
const userPwdResetUrl = await I.extractUrl(citizenEmail); | ||
I.amOnPage(userPwdResetUrl); | ||
I.waitForText(Welsh.createANewPassword, 20, 'h1'); | ||
I.fillField('#password1', specialCharacterPassword); | ||
I.fillField('#password2', specialCharacterPassword); | ||
I.click(Welsh.continueBtn); | ||
I.waitInUrl('doResetPassword'); | ||
I.waitForText(Welsh.passwordChanged, 20, 'h1'); | ||
}); |