Skip to content

Commit

Permalink
feat(passcodes): release sign in with passcodes to 100% and remove fl…
Browse files Browse the repository at this point in the history
…ag/test
  • Loading branch information
coldlink committed Jan 16, 2025
1 parent 7f8d704 commit eef0e8d
Show file tree
Hide file tree
Showing 20 changed files with 76 additions and 99 deletions.
2 changes: 1 addition & 1 deletion cypress/integration/ete/delete.4.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ describe('Delete my account flow in Okta', () => {
cy.visit(
`/signin?returnUrl=${encodeURIComponent(
`https://${Cypress.env('BASE_URI')}/welcome/review`,
)}`,
)}&usePasswordSignIn=true`,
);
cy.get('input[name=email]').type(email);
cy.get('input[name=password]').type(password);
Expand Down
8 changes: 4 additions & 4 deletions cypress/integration/ete/jobs_terms.4.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('Jobs terms and conditions flow in Okta', () => {
})
?.then(({ emailAddress, finalPassword }) => {
const visitUrl =
'/signin?clientId=jobs&returnUrl=https%3A%2F%2Fjobs.theguardian.com%2F';
'/signin?clientId=jobs&returnUrl=https%3A%2F%2Fjobs.theguardian.com%2F&usePasswordSignIn=true';
cy.visit(visitUrl);
cy.get('input[name=email]').type(emailAddress);
cy.get('input[name=password]').type(finalPassword);
Expand Down Expand Up @@ -61,7 +61,7 @@ describe('Jobs terms and conditions flow in Okta', () => {
)}/welcome/review`;
const visitUrl = `/signin?returnUrl=${encodeURIComponent(
postSignInReturnUrl,
)}`;
)}&usePasswordSignIn=true`;
cy.visit(visitUrl);
cy.get('input[name=email]').type(emailAddress);
cy.get('input[name=password]').type(finalPassword);
Expand Down Expand Up @@ -127,7 +127,7 @@ describe('Jobs terms and conditions flow in Okta', () => {
)}/welcome/review`;
const visitUrl = `/signin?returnUrl=${encodeURIComponent(
postSignInReturnUrl,
)}`;
)}&usePasswordSignIn=true`;
cy.visit(visitUrl);
cy.get('input[name=email]').type(emailAddress);
cy.get('input[name=password]').type(finalPassword);
Expand Down Expand Up @@ -179,7 +179,7 @@ describe('Jobs terms and conditions flow in Okta', () => {
)}/welcome/review`;
const visitUrl = `/signin?returnUrl=${encodeURIComponent(
postSignInReturnUrl,
)}`;
)}&usePasswordSignIn=true`;
cy.visit(visitUrl);
cy.get('input[name=email]').type(emailAddress);
cy.get('input[name=password]').type(finalPassword);
Expand Down
4 changes: 2 additions & 2 deletions cypress/integration/ete/new_account_review.3.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ describe('New account review page', () => {
cy.url().should('contain', decodeURIComponent(encodedReturnUrl));

// Return to Gateway so we can access the user cookie
cy.visit('/signin');
cy.visit('/signin?usePasswordSignIn=true');
cy.getTestOktaUser(unregisteredEmail).then((user) => {
cy.getTestUserDetails(user.profile.legacyIdentityId).then(
(response) => {
Expand Down Expand Up @@ -156,7 +156,7 @@ describe('New account review page', () => {
cy.url().should('contain', decodeURIComponent(encodedReturnUrl));

// Return to Gateway so we can access the user cookie
cy.visit('/signin');
cy.visit('/signin?usePasswordSignIn=true');

// Check that the user does not have their registration location set
cy.getTestOktaUser(unregisteredEmail).then((user) => {
Expand Down
8 changes: 4 additions & 4 deletions cypress/integration/ete/reauthenticate.4.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe('Reauthenticate flow, Okta enabled', () => {
cy.visit(
`/signin?returnUrl=${encodeURIComponent(
`https://${Cypress.env('BASE_URI')}/welcome/review`,
)}`,
)}&usePasswordSignIn=true`,
);
cy.get('input[name=email]').type(emailAddress);
cy.get('input[name=password]').type(finalPassword);
Expand All @@ -18,7 +18,7 @@ describe('Reauthenticate flow, Okta enabled', () => {
cy.visit(
`/reauthenticate?returnUrl=${encodeURIComponent(
`https://${Cypress.env('BASE_URI')}/welcome/review`,
)}`,
)}&usePasswordSignIn=true`,
);
cy.get('input[name=email]').type(emailAddress);
cy.get('input[name=password]').type(finalPassword);
Expand Down Expand Up @@ -47,7 +47,7 @@ describe('Reauthenticate flow, Okta enabled', () => {
cy.visit(
`/signin?returnUrl=${encodeURIComponent(
`https://${Cypress.env('BASE_URI')}/welcome/review`,
)}`,
)}&usePasswordSignIn=true`,
);
cy.get('input[name=email]').type(emailAddressA);
cy.get('input[name=password]').type(finalPasswordA);
Expand All @@ -66,7 +66,7 @@ describe('Reauthenticate flow, Okta enabled', () => {
cy.visit(
`/reauthenticate?returnUrl=${encodeURIComponent(
`https://${Cypress.env('BASE_URI')}/welcome/review`,
)}`,
)}&usePasswordSignIn=true`,
);
cy.get('input[name=email]').type(emailAddressB);
cy.get('input[name=password]').type(finalPasswordB);
Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/ete/registration_2.6.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ describe('Registration flow - Split 2/2', () => {
cy.visit(
`/signin?returnUrl=${encodeURIComponent(
`https://${Cypress.env('BASE_URI')}/welcome/review`,
)}`,
)}&usePasswordSignIn=true`,
);
cy.get('input[name=email]').type(emailAddress);
cy.get('input[name=password]').type(finalPassword);
Expand Down
16 changes: 8 additions & 8 deletions cypress/integration/ete/registration_newsletter.5.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('Saturday Edition Geolocation', () => {
cy.visit(
`/signin?returnUrl=${encodeURIComponent(
`https://${Cypress.env('BASE_URI')}/welcome/google`,
)}`,
)}&usePasswordSignIn=true`,
);
cy.get('input[name=email]').type(emailAddress);
cy.get('input[name=password]').type(finalPassword);
Expand Down Expand Up @@ -55,7 +55,7 @@ describe('Saturday Edition Geolocation', () => {
cy.visit(
`/signin?returnUrl=${encodeURIComponent(
`https://${Cypress.env('BASE_URI')}/welcome/google`,
)}`,
)}&usePasswordSignIn=true`,
);
cy.get('input[name=email]').type(emailAddress);
cy.get('input[name=password]').type(finalPassword);
Expand Down Expand Up @@ -87,7 +87,7 @@ describe('Saturday Edition Geolocation', () => {
cy.visit(
`/signin?returnUrl=${encodeURIComponent(
`https://${Cypress.env('BASE_URI')}/welcome/google`,
)}`,
)}&usePasswordSignIn=true`,
);
cy.get('input[name=email]').type(emailAddress);
cy.get('input[name=password]').type(finalPassword);
Expand Down Expand Up @@ -118,7 +118,7 @@ describe('Saturday Edition Geolocation', () => {
cy.visit(
`/signin?returnUrl=${encodeURIComponent(
`https://${Cypress.env('BASE_URI')}/welcome/google`,
)}`,
)}&usePasswordSignIn=true`,
);
cy.get('input[name=email]').type(emailAddress);
cy.get('input[name=password]').type(finalPassword);
Expand Down Expand Up @@ -148,7 +148,7 @@ describe('Saturday Edition Geolocation', () => {
cy.visit(
`/signin?returnUrl=${encodeURIComponent(
`https://${Cypress.env('BASE_URI')}/welcome/google`,
)}`,
)}&usePasswordSignIn=true`,
);
cy.get('input[name=email]').type(emailAddress);
cy.get('input[name=password]').type(finalPassword);
Expand Down Expand Up @@ -176,7 +176,7 @@ describe('Feast newsletter for Feast app', () => {
cy.visit(
`/signin?returnUrl=${encodeURIComponent(
`https://${Cypress.env('BASE_URI')}/welcome/google?appClientId=${app.id}`,
)}`,
)}&usePasswordSignIn=true`,
);
cy.get('input[name=email]').type(emailAddress);
cy.get('input[name=password]').type(finalPassword);
Expand Down Expand Up @@ -204,7 +204,7 @@ describe('Feast newsletter for Feast app', () => {
cy.visit(
`/signin?returnUrl=${encodeURIComponent(
`https://${Cypress.env('BASE_URI')}/welcome/google?appClientId=${app.id}`,
)}`,
)}&usePasswordSignIn=true`,
);
cy.get('input[name=email]').type(emailAddress);
cy.get('input[name=password]').type(finalPassword);
Expand Down Expand Up @@ -234,7 +234,7 @@ describe('Jobs newsletter for Jobs Site', () => {
cy.visit(
`/signin?returnUrl=${encodeURIComponent(
`https://${Cypress.env('BASE_URI')}/welcome/google?clientId=${clientId}`,
)}`,
)}&usePasswordSignIn=true`,
);
cy.get('input[name=email]').type(emailAddress);
cy.get('input[name=password]').type(finalPassword);
Expand Down
44 changes: 24 additions & 20 deletions cypress/integration/ete/sign_in.1.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ describe('Sign in flow, Okta enabled', () => {
cy.url().should('eq', guardianJobsPrivacyPolicyUrl);
});
it('navigates to reset password', () => {
cy.visit('/signin');
cy.visit('/signin?usePasswordSignIn=true');
cy.contains('Reset password').click();
cy.contains('Reset password');
});
Expand Down Expand Up @@ -120,7 +120,7 @@ describe('Sign in flow, Okta enabled', () => {
cy.url().should('contain', 'clientId=jobs');
});
it('applies form validation to email and password input fields', () => {
cy.visit('/signin');
cy.visit('/signin?usePasswordSignIn=true');

cy.get('form').within(() => {
cy.get('input:invalid').should('have.length', 2);
Expand Down Expand Up @@ -292,7 +292,7 @@ describe('Sign in flow, Okta enabled', () => {
cy.visit(
`/signin?returnUrl=${encodeURIComponent(
`https://${Cypress.env('BASE_URI')}/welcome/review`,
)}`,
)}&usePasswordSignIn=true`,
);
cy.get('input[name=email]').type(emailAddress);
cy.get('input[name=password]').type(finalPassword);
Expand All @@ -317,7 +317,7 @@ describe('Sign in flow, Okta enabled', () => {
});
});

context('Okta IDX API Sign In', () => {
context('Okta IDX API Sign In with Password', () => {
it('ACTIVE user - email + password authenticators - successfully sign in', () => {
// Intercept the external redirect page.
// We just want to check that the redirect happens, not that the page loads.
Expand All @@ -329,7 +329,7 @@ describe('Sign in flow, Okta enabled', () => {
isUserEmailValidated: true,
})
?.then(({ emailAddress, finalPassword }) => {
cy.visit('/signin');
cy.visit('/signin?usePasswordSignIn=true');
cy.get('input[name=email]').type(emailAddress);
cy.get('input[name=password]').type(finalPassword);
cy.get('[data-cy="main-form-submit-button"]').click();
Expand All @@ -348,7 +348,9 @@ describe('Sign in flow, Okta enabled', () => {
isUserEmailValidated: true,
})
?.then(({ emailAddress, finalPassword }) => {
cy.visit(`/signin?returnUrl=${encodeURIComponent(returnUrl)}`);
cy.visit(
`/signin?returnUrl=${encodeURIComponent(returnUrl)}&usePasswordSignIn=true`,
);
cy.get('input[name=email]').type(emailAddress);
cy.get('input[name=password]').type(finalPassword);
cy.get('[data-cy="main-form-submit-button"]').click();
Expand Down Expand Up @@ -376,9 +378,11 @@ describe('Sign in flow, Okta enabled', () => {
isUserEmailValidated: true,
})
?.then(({ emailAddress, finalPassword }) => {
cy.visit(`/signin?returnUrl=${encodeURIComponent(returnUrl)}`);
cy.visit(
`/signin?returnUrl=${encodedReturnUrl}&appClientId=${appClientId}&fromURI=${fromURI}`,
`/signin?returnUrl=${encodeURIComponent(returnUrl)}&usePasswordSignIn=true`,
);
cy.visit(
`/signin?returnUrl=${encodedReturnUrl}&appClientId=${appClientId}&fromURI=${fromURI}&usePasswordSignIn=true`,
);
cy.get('input[name=email]').type(emailAddress);
cy.get('input[name=password]').type(finalPassword);
Expand Down Expand Up @@ -444,7 +448,7 @@ describe('Sign in flow, Okta enabled', () => {
cy.contains(emailAddress.toLowerCase());

// setup complete, now sign in
cy.visit('/signin');
cy.visit('/signin?usePasswordSignIn=true');
cy.contains('Sign in with a different email').click();
cy.get('input[name=email]').clear().type(emailAddress);
cy.get('input[name=password]').type(password);
Expand Down Expand Up @@ -494,7 +498,7 @@ describe('Sign in flow, Okta enabled', () => {
isUserEmailValidated: true,
})
?.then(({ emailAddress, finalPassword }) => {
cy.visit('/signin');
cy.visit('/signin?usePasswordSignIn=true');
cy.get('input[name=email]').type(emailAddress);
cy.get('input[name=password]').type(`${finalPassword}!`);
cy.get('[data-cy="main-form-submit-button"]').click();
Expand All @@ -503,7 +507,7 @@ describe('Sign in flow, Okta enabled', () => {
});

it('NON-EXISTENT user - shows authentication error in all scenarios', () => {
cy.visit('/signin');
cy.visit('/signin?usePasswordSignIn=true');
cy.get('input[name=email]').type('[email protected]');
cy.get('input[name=password]').type('password');
cy.get('[data-cy="main-form-submit-button"]').click();
Expand All @@ -519,7 +523,7 @@ describe('Sign in flow, Okta enabled', () => {
cy
.createTestUser({ isGuestUser: true })
?.then(({ emailAddress, finalPassword }) => {
cy.visit('/signin');
cy.visit('/signin?usePasswordSignIn=true');
cy.get('input[name=email]').type(emailAddress);
cy.get('input[name=password]').type(`${finalPassword}`);
cy.get('[data-cy="main-form-submit-button"]').click();
Expand Down Expand Up @@ -562,7 +566,7 @@ describe('Sign in flow, Okta enabled', () => {
cy.visit(
`/signin?returnUrl=${encodeURIComponent(
`https://${Cypress.env('BASE_URI')}/welcome/review`,
)}`,
)}&usePasswordSignIn=true`,
);
cy.get('input[name=email]').type(emailAddress);
cy.get('input[name=password]').type(finalPassword);
Expand Down Expand Up @@ -597,7 +601,7 @@ describe('Sign in flow, Okta enabled', () => {
isUserEmailValidated: true,
})
?.then(({ emailAddress, finalPassword }) => {
cy.visit('/signin');
cy.visit('/signin?usePasswordSignIn=true');

cy.interceptRecaptcha();

Expand Down Expand Up @@ -656,7 +660,7 @@ describe('Sign in flow, Okta enabled', () => {
cy.visit(
`/signin?returnUrl=${encodeURIComponent(
`https://${Cypress.env('BASE_URI')}/welcome/review`,
)}`,
)}&usePasswordSignIn=true`,
);
cy.get('input[name=email]').type(emailAddress);
cy.get('input[name=password]').type(finalPassword);
Expand Down Expand Up @@ -702,7 +706,7 @@ describe('Sign in flow, Okta enabled', () => {
cy.visit(
`/signin?returnUrl=${encodeURIComponent(
`https://${Cypress.env('BASE_URI')}/welcome/review`,
)}`,
)}&usePasswordSignIn=true`,
);
cy.get('input[name=email]').type(emailAddress);
cy.get('input[name=password]').type(finalPassword);
Expand Down Expand Up @@ -748,7 +752,7 @@ describe('Sign in flow, Okta enabled', () => {
cy.visit(
`/signin?returnUrl=${encodeURIComponent(
`https://${Cypress.env('BASE_URI')}/welcome/review`,
)}`,
)}&usePasswordSignIn=true`,
);
cy.get('input[name=email]').type(emailAddress);
cy.get('input[name=password]').type(finalPassword);
Expand Down Expand Up @@ -780,7 +784,7 @@ describe('Sign in flow, Okta enabled', () => {
cy.visit(
`/signin?returnUrl=${encodeURIComponent(
`https://${Cypress.env('BASE_URI')}/welcome/review`,
)}`,
)}&usePasswordSignIn=true`,
);
cy.get('input[name=email]').type(emailAddress);
cy.get('input[name=password]').type(finalPassword);
Expand Down Expand Up @@ -851,7 +855,7 @@ describe('Sign in flow, Okta enabled', () => {
cy.visit(
`/signin?returnUrl=${encodeURIComponent(
`https://${Cypress.env('BASE_URI')}/welcome/review`,
)}`,
)}&usePasswordSignIn=true`,
);
cy.get('input[name=email]').type(emailAddress);
cy.get('input[name=password]').type(finalPassword);
Expand Down Expand Up @@ -912,7 +916,7 @@ describe('Sign in flow, Okta enabled', () => {
)}/welcome/review`;
const visitUrl = `/signin?returnUrl=${encodeURIComponent(
postSignInReturnUrl,
)}`;
)}&usePasswordSignIn=true`;
cy.visit(visitUrl);
cy.get('input[name=email]').type(emailAddress);
cy.get('input[name=password]').type(finalPassword);
Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/ete/sign_out.5.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('Sign out flow', () => {
)}/welcome/review`;
const visitUrl = `/signin?returnUrl=${encodeURIComponent(
postSignInReturnUrl,
)}`;
)}&usePasswordSignIn=true`;
cy.visit(visitUrl);
cy.get('input[name=email]').type(emailAddress);
cy.get('input[name=password]').type(finalPassword);
Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/mocked/rateLimit.1.cy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
describe('POST requests return a user-facing error message when encountering a rate limit from Okta', () => {
specify('Submit /signin', () => {
cy.visit('/signin');
cy.visit('/signin?usePasswordSignIn=true');
cy.get('input[name="email"]').type('[email protected]');
cy.get('input[name="password"]').type('password');

Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/mocked/signInController.2.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ context('When I submit the form on /signin - useOktaClassic', () => {

context('When I submit the form on /signin - idx api', () => {
beforeEach(() => {
cy.visit(`/signin`);
cy.visit(`/signin?usePasswordSignIn=true`);
cy.get('input[name="email"]').type('[email protected]');
cy.get('input[name="password"]').type('password');
});
Expand Down
Loading

0 comments on commit eef0e8d

Please sign in to comment.