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

[FEATURE] Test d'activation du FT du nouveau design des page d'auth dans les tests (PIX-15014) #10460

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Fonctionnalité: Campagne d'évaluation
Lorsque je vais sur la campagne "WALL" avec l'identifiant "khaleesi"
Alors je vois la page de "presentation" de la campagne
Lorsque je clique sur "Je commence"
Et je clique sur "connectez-vous à votre compte"
Et je clique sur "Se connecter"
Et je me connecte avec le compte "[email protected]"
Alors je vois la page de "didacticiel" de la campagne

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Fonctionnalité: Campagne de collecte de profils
Lorsque je vais sur la campagne "LION" avec l'identifiant "khaleesi"
Alors je vois la page de "presentation" de la campagne
Lorsque je clique sur "C'est parti !"
Et je clique sur "connectez-vous à votre compte"
Et je clique sur "Se connecter"
Et je me connecte avec le compte "[email protected]"
Alors je vois la page d'"envoi-profil" de la campagne
Lorsque je clique sur "J'envoie mon profil"
Expand Down
2 changes: 1 addition & 1 deletion mon-pix/app/controllers/authentication/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default class LoginController extends Controller {
@service featureToggles;

get isNewAuthenticationDesignEnabled() {
return this.featureToggles.featureToggles.isNewAuthenticationDesignEnabled;
return true;
}

get isInternationalDomain() {
Expand Down
2 changes: 1 addition & 1 deletion mon-pix/app/controllers/inscription/inscription.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default class InscriptionController extends Controller {
@service featureToggles;

get isNewAuthenticationDesignEnabled() {
return this.featureToggles.featureToggles.isNewAuthenticationDesignEnabled;
return true;
}

get isInternationalDomain() {
Expand Down
2 changes: 1 addition & 1 deletion mon-pix/app/controllers/password-reset-demand.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ export default class LoginController extends Controller {
@service featureToggles;

get isNewAuthenticationDesignEnabled() {
return this.featureToggles.featureToggles.isNewAuthenticationDesignEnabled;
return true;
}
}
2 changes: 1 addition & 1 deletion mon-pix/app/controllers/reset-password.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ export default class ResetPasswordController extends Controller {
@service featureToggles;

get isNewAuthenticationDesignEnabled() {
return this.featureToggles.featureToggles.isNewAuthenticationDesignEnabled;
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,65 +19,6 @@ module('Acceptance | Authentication redirections', function (hooks) {
user = server.create('user', 'withEmail');
});

module('when "New authentication design" feature toggle is disabled', function (hooks) {
hooks.beforeEach(function () {
server.create('feature-toggle', {
id: 0,
isNewAuthenticationDesignEnabled: false,
});
});

module('Success cases', function () {
module('Accessing to the default page page while disconnected', function () {
test('should redirect to the connexion page', async function (assert) {
// when
await visit('/');

// then
assert.strictEqual(currentURL(), '/connexion');
});
});

module('Log-in phase', function () {
test('should redirect to /accueil after connexion', async function (assert) {
// when
await authenticateByEmail(user);

// then
assert.strictEqual(currentURL(), '/accueil');
});
});
});

module('Error case', function () {
test('should stay in /connexion, when authentication failed', async function (assert) {
// given
const screen = await visit('/connexion');
await fillIn(screen.getByRole('textbox', { name: 'Adresse e-mail ou identifiant' }), '[email protected]');
await fillIn(screen.getByLabelText('Mot de passe'), 'Pix20!!');

// when
await click(screen.getByRole('button', { name: t('pages.sign-in.actions.submit') }));

// then
assert.strictEqual(currentURL(), '/connexion');
});

module('when user should change password', function () {
test('should redirect to /update-expired-password', async function (assert) {
// given
user = server.create('user', 'withUsername', 'shouldChangePassword');

// when
await authenticateByUsername(user);

// then
assert.strictEqual(currentURL(), '/mise-a-jour-mot-de-passe-expire');
});
});
});
});

module('when "New authentication design" feature toggle is enabled', function (hooks) {
hooks.beforeEach(function () {
server.create('feature-toggle', {
Expand Down
67 changes: 0 additions & 67 deletions mon-pix/tests/acceptance/authentication/login-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,73 +20,6 @@ module('Acceptance | Login', function (hooks) {
sinon.stub(domainService, 'getExtension');
});

module('when "New authentication design" feature toggle is disabled', function (hooks) {
hooks.beforeEach(function () {
server.create('feature-toggle', { id: 0, isNewAuthenticationDesignEnabled: false });
});

module('When on International domain (.org)', function (hooks) {
hooks.beforeEach(function () {
domainService.getExtension.returns('org');
});

module('when accessing the inscription page with "Français" as default language', function () {
test('displays the signin page with "Français" as selected language', async function (assert) {
// when

const screen = await visit('/connexion');

// then
assert.strictEqual(currentURL(), '/connexion');
assert.dom(screen.getByRole('heading', { name: t('pages.sign-in.first-title'), level: 1 })).exists();
assert.dom(screen.getByRole('button', { name: 'Sélectionnez une langue' })).exists();
});

module('when the user select "English" as his language', function () {
test('displays the login page with "English" as selected language', async function (assert) {
// when
const screen = await visit('/connexion');
await click(screen.getByRole('button', { name: 'Sélectionnez une langue' }));
await screen.findByRole('listbox');
await click(screen.getByRole('option', { name: 'English' }));

// then
assert.strictEqual(currentURL(), '/connexion');
assert.dom(screen.getByRole('heading', { name: t('pages.sign-in.first-title'), level: 1 })).exists();
assert.dom(screen.getByRole('button', { name: 'Select a language' })).exists();
});
});
});

module('when accessing the login page with "English" as selected language', function () {
test('displays the login page with "English"', async function (assert) {
// when
const screen = await visit('/connexion?lang=en');

// then
assert.strictEqual(currentURL(), '/connexion?lang=en');
assert.dom(screen.getByRole('heading', { name: t('pages.sign-in.first-title'), level: 1 })).exists();
assert.dom(screen.getByRole('button', { name: 'Select a language' })).exists();
});

module('when the user select "Français" as his language', function () {
test('displays the login page with "Français" as selected language', async function (assert) {
// given & when
const screen = await visit('/connexion?lang=en');
await click(screen.getByRole('button', { name: 'Select a language' }));
await screen.findByRole('listbox');
await click(screen.getByRole('option', { name: 'Français' }));

// then
assert.strictEqual(currentURL(), '/connexion');
assert.dom(screen.getByRole('heading', { name: t('pages.sign-in.first-title'), level: 1 })).exists();
assert.dom(screen.getByRole('button', { name: 'Sélectionnez une langue' })).exists();
});
});
});
});
});

module('when "New authentication design" feature toggle is enabled', function (hooks) {
hooks.beforeEach(function () {
server.create('feature-toggle', { id: 0, isNewAuthenticationDesignEnabled: true });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,62 +13,6 @@ module('Acceptance | Password reset demand form', function (hooks) {
setupMirage(hooks);
setupIntl(hooks);

module('when "New authentication design" feature toggle is disabled', function (hooks) {
hooks.beforeEach(function () {
server.create('feature-toggle', {
id: 0,
isNewAuthenticationDesignEnabled: false,
});
});

test('can visit /mot-passe-oublie', async function (assert) {
// when
await visit('/mot-de-passe-oublie');

// then
assert.strictEqual(currentURL(), '/mot-de-passe-oublie');
});

test('stays on "mot de passe oublié" page, and shows success message when email sent correspond to an existing user', async function (assert) {
// given
this.server.create('user', {
id: 1,
firstName: 'Brandone',
lastName: 'Martins',
email: '[email protected]',
password: '1024pix!',
});
await visit('/mot-de-passe-oublie');
await fillIn('#email', '[email protected]');

// when
await clickByLabel(t('pages.password-reset-demand.actions.reset'));

assert.strictEqual(currentURL(), '/mot-de-passe-oublie');
assert.dom('.password-reset-demand-form__body').exists();
});

test('stays in mot-passe-oublie page when sent email do not correspond to any existing user', async function (assert) {
// given
this.server.create('user', {
id: 1,
firstName: 'Brandone',
lastName: 'Martins',
email: '[email protected]',
password: '1024pix!',
});
const screen = await visit('/mot-de-passe-oublie');
await fillIn('#email', '[email protected]');

// when
await clickByLabel(t('pages.password-reset-demand.actions.reset'));

// then
assert.strictEqual(currentURL(), '/mot-de-passe-oublie');
assert.dom(screen.getByText(t('pages.password-reset-demand.error.message'))).exists();
});
});

module('when "New authentication design" feature toggle is enabled', function (hooks) {
hooks.beforeEach(function () {
server.create('feature-toggle', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,87 +14,6 @@ module('Acceptance | Reset Password Form', function (hooks) {
setupMirage(hooks);
setupIntl(hooks);

module('when "New authentication design" feature toggle is disabled', function (hooks) {
hooks.beforeEach(function () {
server.create('feature-toggle', {
id: 0,
isNewAuthenticationDesignEnabled: false,
});
});

test('can visit /changer-mot-de-passe when temporaryKey exists', async function (assert) {
// given
server.create('user', {
id: 1000,
firstName: 'Brandone',
lastName: 'Martins',
email: '[email protected]',
password: '1024pix!',
});

server.create('password-reset-demand', {
temporaryKey: 'temporaryKey',
email: '[email protected]',
});

// when
await visit('/changer-mot-de-passe/temporaryKey');

// then
assert.strictEqual(currentURL(), '/changer-mot-de-passe/temporaryKey');
});

test('stays on /changer-mot-de-passe when password is successfully reset', async function (assert) {
// given
server.create('user', {
id: 1000,
firstName: 'Brandone',
lastName: 'Martins',
email: '[email protected]',
password: '1024pix!',
});

server.create('password-reset-demand', {
temporaryKey: 'brandone-reset-key',
email: '[email protected]',
});

const screen = await visit('/changer-mot-de-passe/brandone-reset-key');
const passwordInput = screen.getByLabelText('Mot de passe');
await fillIn(passwordInput, 'newPass12345!');

// when
await clickByLabel(t('pages.reset-password.actions.submit'));

// then
assert.strictEqual(currentURL(), '/changer-mot-de-passe/brandone-reset-key');
});

test('allows connected user to visit reset-password page', async function (assert) {
// given
const user = server.create('user', {
id: 1000,
firstName: 'Brandone',
lastName: 'Martins',
email: '[email protected]',
password: '1024pix!',
});

server.create('password-reset-demand', {
temporaryKey: 'brandone-reset-key',
email: '[email protected]',
});

await authenticate(user);

// when
await visit('/changer-mot-de-passe/brandone-reset-key');

// then
assert.strictEqual(currentURL(), '/changer-mot-de-passe/brandone-reset-key');
});
});

module('when "New authentication design" feature toggle is enabled', function (hooks) {
hooks.beforeEach(function () {
server.create('feature-toggle', {
Expand Down
Loading
Loading