Skip to content

Commit

Permalink
[TECH] Suppression du FT pour les écrans d'instruction certif v3 (PIX…
Browse files Browse the repository at this point in the history
  • Loading branch information
mcampourcy authored Oct 8, 2024
1 parent 8fad487 commit 82e5ad8
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 219 deletions.
7 changes: 0 additions & 7 deletions api/sample.env
Original file line number Diff line number Diff line change
Expand Up @@ -757,13 +757,6 @@ TEST_REDIS_URL=redis://localhost:6379
# default: false
# FT_ENABLE_PIX_PLUS_LOWER_LEVEL=false

# Displays the V3 certification pre-test information screens
#
# presence: optional
# type: boolean
# default: false
# FT_ENABLE_V3_INFO_SCREENS=false

# Enable the verification of the scope in certification tokens
#
# presence: optional
Expand Down
2 changes: 0 additions & 2 deletions api/src/shared/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ const configuration = (function () {
scoAccountRecoveryKeyLifetimeMinutes: process.env.SCO_ACCOUNT_RECOVERY_KEY_LIFETIME_MINUTES,
},
featureToggles: {
areV3InfoScreensEnabled: toBoolean(process.env.FT_ENABLE_V3_INFO_SCREENS),
isV3EligibilityCheckEnabled: toBoolean(process.env.FT_ENABLE_V3_ELIGIBILITY_CHECK),
deprecatePoleEmploiPushNotification: toBoolean(process.env.DEPRECATE_PE_PUSH_NOTIFICATION),
isAlwaysOkValidateNextChallengeEndpointEnabled: toBoolean(
Expand Down Expand Up @@ -396,7 +395,6 @@ const configuration = (function () {
config.features.pixCertifScoBlockedAccessDateLycee = null;
config.features.pixCertifScoBlockedAccessDateCollege = null;

config.featureToggles.areV3InfoScreensEnabled = false;
config.featureToggles.isV3EligibilityCheckEnabled = false;
config.featureToggles.isAlwaysOkValidateNextChallengeEndpointEnabled = false;
config.featureToggles.isPix1dEnabled = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ const schema = Joi.object({
FT_ENABLE_NEED_TO_ADJUST_CERTIFICATION_ACCESSIBILITY: Joi.string().optional().valid('true', 'false'),
FT_ENABLE_PIX_PLUS_LOWER_LEVEL: Joi.string().optional().valid('true', 'false'),
FT_ENABLE_TEXT_TO_SPEECH_BUTTON: Joi.string().optional().valid('true', 'false'),
FT_ENABLE_V3_INFO_SCREENS: Joi.string().optional().valid('true', 'false'),
KNEX_ASYNC_STACKTRACE_ENABLED: Joi.string().optional().valid('true', 'false'),
LCMS_API_KEY: Joi.string().required(),
LCMS_API_URL: Joi.string().uri().required(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ describe('Acceptance | Shared | Application | Controller | feature-toggle', func
id: '0',
type: 'feature-toggles',
attributes: {
'are-v3-info-screens-enabled': false,
'deprecate-pole-emploi-push-notification': false,
'is-v3-eligibility-check-enabled': false,
'is-always-ok-validate-next-challenge-endpoint-enabled': false,
Expand Down
1 change: 0 additions & 1 deletion mon-pix/app/models/feature-toggle.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Model, { attr } from '@ember-data/model';

export default class FeatureToggle extends Model {
@attr areV3InfoScreensEnabled;
@attr('boolean') isNewAuthenticationDesignEnabled;
@attr('boolean') isTextToSpeechButtonEnabled;
@attr('boolean') showNewResultPage;
Expand Down
7 changes: 1 addition & 6 deletions mon-pix/app/routes/authenticated/certifications/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { service } from '@ember/service';
export default class StartRoute extends Route {
@service store;
@service router;
@service featureToggles;

async model(params) {
const [certificationCandidate, certificationCandidateSubscription] = await Promise.all([
Expand All @@ -14,11 +13,7 @@ export default class StartRoute extends Route {

const hasSeenCertificationInstructions = certificationCandidate?.hasSeenCertificationInstructions;

if (
!hasSeenCertificationInstructions &&
certificationCandidateSubscription.isSessionVersion3 &&
this.featureToggles.featureToggles.areV3InfoScreensEnabled
) {
if (!hasSeenCertificationInstructions && certificationCandidateSubscription.isSessionVersion3) {
this.router.replaceWith('authenticated.certifications.information', params.certification_candidate_id);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,43 @@ module('Acceptance | Certifications | Information', function (hooks) {
});

module('when certification candidate participates in a V3 session', function () {
module('when toggle areV3InfoScreensEnabled is enabled', function () {
test('should display the certification instructions page', async function (assert) {
test('should display the certification instructions page', async function (assert) {
// given
server.create('certification-candidate-subscription', {
id: 2,
sessionId: 123,
eligibleSubscription: null,
nonEligibleSubscription: null,
sessionVersion: 3,
});

await authenticateByEmail(user);

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

// when
await fillCertificationJoiner({
sessionId: '123',
firstName: 'toto',
lastName: 'titi',
dayOfBirth: '01',
monthOfBirth: '01',
yearOfBirth: '2000',
t,
});

// then
assert.strictEqual(currentURL(), '/certifications/candidat/2/informations');
assert.dom(screen.getByRole('heading', { name: 'Explication de la certification', level: 1 })).exists();
assert
.dom(screen.getByRole('heading', { name: 'Bienvenue à la certification Pix Page 1 sur 5', level: 2 }))
.exists();
assert.dom(screen.getByRole('button', { name: "Continuer vers l'écran suivant" })).exists();
});

module('when user validates instructions', function () {
test('should validate checkbox and redirect to the certification start page', async function (assert) {
// given
server.create('feature-toggle', {
id: 0,
areV3InfoScreensEnabled: true,
});
server.create('certification-candidate-subscription', {
id: 2,
sessionId: 123,
Expand All @@ -50,106 +80,25 @@ module('Acceptance | Certifications | Information', function (hooks) {
yearOfBirth: '2000',
t,
});
for (let i = 0; i < 4; i++) {
await click(screen.getByRole('button', { name: "Continuer vers l'écran suivant" }));
}

// then
assert.strictEqual(currentURL(), '/certifications/candidat/2/informations');
assert.dom(screen.getByRole('heading', { name: 'Explication de la certification', level: 1 })).exists();
assert
.dom(screen.getByRole('heading', { name: 'Bienvenue à la certification Pix Page 1 sur 5', level: 2 }))
.exists();
assert.dom(screen.getByRole('button', { name: "Continuer vers l'écran suivant" })).exists();
});

module('when user validates instructions', function () {
test('should validate checkbox and redirect to the certification start page', async function (assert) {
// given
server.create('feature-toggle', {
id: 0,
areV3InfoScreensEnabled: true,
});
server.create('certification-candidate-subscription', {
id: 2,
sessionId: 123,
eligibleSubscription: null,
nonEligibleSubscription: null,
sessionVersion: 3,
});

await authenticateByEmail(user);

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

// when
await fillCertificationJoiner({
sessionId: '123',
firstName: 'toto',
lastName: 'titi',
dayOfBirth: '01',
monthOfBirth: '01',
yearOfBirth: '2000',
t,
});
for (let i = 0; i < 4; i++) {
await click(screen.getByRole('button', { name: "Continuer vers l'écran suivant" }));
}

await click(
screen.getByRole('checkbox', {
name: 'En cochant cette case, je reconnais avoir pris connaissance de ces règles et je m’engage à les respecter.',
}),
);
await click(screen.getByRole('button', { name: "Continuer vers la page d'entrée en certification" }));

// then
assert.strictEqual(currentURL(), '/certifications/candidat/2');
});
});
await click(
screen.getByRole('checkbox', {
name: 'En cochant cette case, je reconnais avoir pris connaissance de ces règles et je m’engage à les respecter.',
}),
);
await click(screen.getByRole('button', { name: "Continuer vers la page d'entrée en certification" }));

module('when user has already validated instructions', function () {
test('should redirect to the certification start page', async function (assert) {
// given
server.create('feature-toggle', {
id: 0,
areV3InfoScreensEnabled: true,
});
server.create('certification-candidate-subscription', {
id: 2,
sessionId: 123,
eligibleSubscription: null,
nonEligibleSubscription: null,
sessionVersion: 3,
});

const candidateLastName = 'hasSeenCertificationInstructions';

await authenticateByEmail(user);

await visit('/certifications');

// when
await fillCertificationJoiner({
sessionId: '123',
firstName: 'toto',
lastName: candidateLastName,
dayOfBirth: '01',
monthOfBirth: '01',
yearOfBirth: '2000',
t,
});

// then
assert.strictEqual(currentURL(), '/certifications/candidat/2');
});
// then
assert.strictEqual(currentURL(), '/certifications/candidat/2');
});
});

module('when toggle areV3InfoScreensEnabled is not enabled', function () {
test('should not display the v3 certification information page', async function (assert) {
module('when user has already validated instructions', function () {
test('should redirect to the certification start page', async function (assert) {
// given
server.create('feature-toggle', {
id: 0,
areV3InfoScreensEnabled: false,
});
server.create('certification-candidate-subscription', {
id: 2,
sessionId: 123,
Expand All @@ -158,14 +107,17 @@ module('Acceptance | Certifications | Information', function (hooks) {
sessionVersion: 3,
});

const candidateLastName = 'hasSeenCertificationInstructions';

await authenticateByEmail(user);
const screen = await visit('/certifications');

await visit('/certifications');

// when
await fillCertificationJoiner({
sessionId: '123',
firstName: 'toto',
lastName: 'titi',
lastName: candidateLastName,
dayOfBirth: '01',
monthOfBirth: '01',
yearOfBirth: '2000',
Expand All @@ -174,8 +126,6 @@ module('Acceptance | Certifications | Information', function (hooks) {

// then
assert.strictEqual(currentURL(), '/certifications/candidat/2');
assert.dom(screen.getByRole('heading', { name: 'Vous allez commencer votre test de certification' })).exists();
assert.dom(screen.queryByRole('heading', { name: 'Explication de la certification' })).doesNotExist();
});
});
});
Expand Down
Loading

0 comments on commit 82e5ad8

Please sign in to comment.