Skip to content

Commit

Permalink
test(mon-pix): fix global layout tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeyffrey committed Dec 5, 2024
1 parent 23d1801 commit 11554ad
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Fonctionnalité: Titre des pages
Et je vais sur Pix
Et je suis connecté à Pix en tant que "Daenerys Targaryen"
Lorsque je clique sur "Compétences"
Alors je vois le titre de la page "Compétences | Pix"
Alors je vois le titre de la page "Compétences Pix | Pix"

Scénario: j'accède à la page compétence
Étant donné que tous les comptes sont créés
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ Then(`je suis redirigé vers le profil de {string}`, (firstName) => {
cy.get(".logged-user-name").should((userName) => {
expect(userName.text()).to.contains(firstName);
});
cy.get(".rounded-panel-title").should((title) => {
expect(title.text()).to.contains("Vous avez 16 compétences à tester.");
cy.get(".global-page-header__title").should((title) => {
expect(title.text()).to.contains("Compétences Pix");
});
});

Expand Down
8 changes: 5 additions & 3 deletions mon-pix/tests/acceptance/competence-profile-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ module('Acceptance | Profile | Start competence', function (hooks) {
server.create('competence-evaluation', { user, competenceId, assessment });

// when
await visit('/competences');
const screen = await visit('/competences');
await setBreakpoint('tablet');
await click(
`.rounded-panel-body__areas:nth-of-type(${firstScorecard.area.code}) .rounded-panel-body__competence-card:nth-of-type(${competenceNumber}) .competence-card__button`,

const cardName = new RegExp(
`Reprendre la compétence Area_${firstScorecard.area.code}_Competence_${competenceNumber}`,
);
await click(screen.getByRole('link', { name: cardName }));

// then
assert.ok(currentURL().includes('/assessments/'));
Expand Down
5 changes: 3 additions & 2 deletions mon-pix/tests/acceptance/user-certifications-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { visit } from '@1024pix/ember-testing-library';
import { currentURL, findAll } from '@ember/test-helpers';
import { setupMirage } from 'ember-cli-mirage/test-support';
import { t } from 'ember-intl/test-support';
import { setupApplicationTest } from 'ember-qunit';
import { module, test } from 'qunit';

Expand Down Expand Up @@ -49,10 +50,10 @@ module('Acceptance | User certifications page', function (hooks) {
test('should render a title for the page', async function (assert) {
// when
await authenticate(userWithNoCertificates);
await visit('/mes-certifications');
const screen = await visit('/mes-certifications');

// then
assert.dom('.user-certifications-page__title').exists();
assert.dom(screen.getByRole('heading', { name: t('pages.certifications-list.title') })).exists();
});

test('should render the panel which contains informations about certifications of the connected user', async function (assert) {
Expand Down
4 changes: 2 additions & 2 deletions mon-pix/tests/acceptance/user-dashboard-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,14 @@ module('Acceptance | User dashboard page', function (hooks) {
await authenticate(user);
const screen = await visit('/accueil');

assert.dom(screen.getByRole('heading', { name: 'Bonjour Henri, découvrez votre tableau de bord.' })).exists();
assert.dom(screen.getByRole('heading', { name: 'Bonjour, découvrez votre tableau de bord.' })).exists();

// when
await click(screen.getByRole('button', { name: 'Fermer la bannière' }));

// then
assert
.dom(screen.queryByRole('heading', { name: 'Bonjour Henri, découvrez votre tableau de bord.' }))
.dom(screen.queryByRole('heading', { name: 'Bonjour, découvrez votre tableau de bord.' }))
.doesNotExist();
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ module('Integration | Component | Dashboard | Content', function (hooks) {
const screen = await render(hbs`<Dashboard::Content @model={{this.model}} />`);

// then
assert.dom(screen.getByRole('heading', { name: 'Bonjour Banana, découvrez votre tableau de bord.' })).exists();
assert.dom(screen.getByRole('heading', { name: 'Bonjour, découvrez votre tableau de bord.' })).exists();
});

test('should not display NewInformation on dashboard if user has close it before', async function (assert) {
Expand Down Expand Up @@ -484,7 +484,7 @@ module('Integration | Component | Dashboard | Content', function (hooks) {
const screen = await render(hbs`<Dashboard::Content @model={{this.model}} />`);

// then
assert.dom(screen.getByRole('heading', { name: 'Bonjour Banana, découvrez votre tableau de bord.' })).exists();
assert.dom(screen.getByRole('heading', { name: 'Bonjour, découvrez votre tableau de bord.' })).exists();
assert.dom(screen.queryByRole('link', { name: t('pages.dashboard.presentation.link.text') })).doesNotExist();
});
});
Expand Down

0 comments on commit 11554ad

Please sign in to comment.