Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sidm 3296 waf password configure test #259

Merged
merged 10 commits into from
Nov 11, 2019
2 changes: 1 addition & 1 deletion src/test/js/login_user_functional_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ Scenario('@functional @login As a citizen user I can login with email in upperca

I.resetRequestInterception();

}).retry(TestData.SCENARIO_RETRY_LIMIT);
}).retry(TestData.SCENARIO_RETRY_LIMIT);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure what changed here 🤷‍♂

35 changes: 34 additions & 1 deletion src/test/js/reset_password_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ let plusCitizenEmail;
let userFirstNames = [];
let roleNames = [];
let serviceNames = [];
let specialCharacterPassword;

const serviceName = randomData.getRandomServiceName();
const loginPage = `${TestData.WEB_PUBLIC_URL}/login?redirect_uri=${TestData.SERVICE_REDIRECT_URI}&client_id=${serviceName}&state=`;
Expand All @@ -21,6 +22,7 @@ BeforeSuite(async (I) => {
citizenEmail = 'citizen.' + randomData.getRandomEmailAddress();
otherCitizenEmail = 'other.' + randomData.getRandomEmailAddress();
plusCitizenEmail = 'plus.' + "extra+" + randomData.getRandomEmailAddress();
specialCharacterPassword = 'New&&&$$$%%%<>234';

const token = await I.getAuthToken();
let response;
Expand Down Expand Up @@ -144,4 +146,35 @@ Scenario('@functional @resetpass Validation displayed when I try to reset my pas
I.waitForText('There was a problem with the password you entered', 20, 'h2');
I.see("This password is used often and is not secure. Create a more secure password");

}).retry(TestData.SCENARIO_RETRY_LIMIT);
}).retry(TestData.SCENARIO_RETRY_LIMIT);

Scenario('@functional @resetpass As a citizen user I can reset my password with repeated special characters', async (I) => {
I.amOnPage(loginPage);
I.waitForText('Sign in or create an account', 20, 'h1');
I.click('Forgotten password?');
I.waitForText('Reset your password', 20, 'h1');
I.wait(10);
I.fillField('#email', citizenEmail);
I.click('Submit');
I.waitForText('Check your email', 20, 'h1');
const resetPasswordUrl = await I.extractUrl(citizenEmail);
I.amOnPage(resetPasswordUrl);
I.waitForText('Create a new password', 20, 'h1');
I.seeTitleEquals('Reset Password - HMCTS Access');
I.fillField('#password1', specialCharacterPassword);
I.fillField('#password2', specialCharacterPassword);
I.click('Continue');
I.wait(10);
I.waitForText('Your password has been changed', 20, 'h1');
I.see('You can now sign in with your new password.')
I.amOnPage(loginPage);
I.waitForText('Sign in or create an account', 20, 'h1');
I.fillField('#username', citizenEmail);
I.fillField('#password', specialCharacterPassword);
I.interceptRequestsAfterSignin();
I.click('Sign in');
I.waitForText(TestData.SERVICE_REDIRECT_URI);
I.see('code=');
I.dontSee('error=');
I.resetRequestInterception();
});
41 changes: 41 additions & 0 deletions src/test/js/self_registration_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ let randomUserFirstName;
let randomUserLastName;
let userFirstNames = [];
let serviceNames = [];
let specialCharacterPassword;

const selfRegUrl = `${TestData.WEB_PUBLIC_URL}/users/selfRegister?redirect_uri=${TestData.SERVICE_REDIRECT_URI}&client_id=${serviceName}`;

Expand All @@ -20,6 +21,7 @@ BeforeSuite(async (I) => {
serviceNames.push(serviceName);
await I.createUserWithRoles(citizenEmail, randomUserFirstName, ["citizen"]);
userFirstNames.push(randomUserFirstName);
specialCharacterPassword = 'New%%%&&&234';
});

AfterSuite(async (I) => {
Expand Down Expand Up @@ -123,6 +125,7 @@ Scenario('@functional @selfregister I can self register', async (I) => {
I.fillField('#password', TestData.PASSWORD);
I.interceptRequestsAfterSignin();
I.click('Sign in');
I.wait(10);
I.waitForText(TestData.SERVICE_REDIRECT_URI);
I.see('code=');
I.dontSee('error=');
Expand Down Expand Up @@ -174,4 +177,42 @@ Scenario('@functional @selfregister @prePopulatedScreen I can self register with
I.see('code=');
I.dontSee('error=');
I.resetRequestInterception();
});

Scenario('@functional @selfregister I can self register with repeated special characters in password', async (I) => {

const email = 'test_citizen.' + randomData.getRandomEmailAddress();
const loginPage = `${TestData.WEB_PUBLIC_URL}/login?redirect_uri=${TestData.SERVICE_REDIRECT_URI}&client_id=${serviceName}&state=selfreg`;

I.amOnPage(selfRegUrl);
I.waitInUrl('users/selfRegister', 180);
I.waitForText('Create an account or sign in', 20, 'h1');
I.see('Create an account');
I.fillField('firstName', randomUserFirstName);
I.fillField('lastName', randomUserLastName);
I.fillField('email', email);
I.click("Continue");
I.waitForText('Check your email', 20, 'h1');
const userActivationUrl = await I.extractUrl(email);
I.amOnPage(userActivationUrl);
I.waitForText('Create a password', 20, 'h1');
I.seeTitleEquals('User Activation - HMCTS Access');
I.fillField('#password1', specialCharacterPassword);
I.fillField('#password2', specialCharacterPassword);
I.click('Continue');
I.waitForText('Account created', 20, 'h1');
I.wait(10);
I.see('You can now sign in to your account.');
I.amOnPage(loginPage);
I.seeInCurrentUrl("state=selfreg");
I.waitForText('Sign in or create an account', 20, 'h1');
I.fillField('#username', email);
I.fillField('#password', specialCharacterPassword);
I.interceptRequestsAfterSignin();
I.click('Sign in');
I.wait(10);
I.waitForText(TestData.SERVICE_REDIRECT_URI);
I.see('code=');
I.dontSee('error=');
I.resetRequestInterception();
});