-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TECH] Correction de l'affichage des heures des invitations (PIX-10414).
- Loading branch information
Showing
10 changed files
with
68 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,9 +4,11 @@ import { setupApplicationTest } from 'ember-qunit'; | |
import { setupMirage } from 'ember-cli-mirage/test-support'; | ||
import { visit } from '@1024pix/ember-testing-library'; | ||
import { authenticateAdminMemberWithRole } from 'pix-admin/tests/helpers/test-init'; | ||
import setupIntl from '../../../helpers/setup-intl'; | ||
|
||
module('Acceptance | Organizations | Invitations management', function (hooks) { | ||
setupApplicationTest(hooks); | ||
setupIntl(hooks); | ||
setupMirage(hooks); | ||
|
||
test('should allow to invite a member when user has access', async function (assert) { | ||
|
@@ -65,7 +67,10 @@ module('Acceptance | Organizations | Invitations management', function (hooks) { | |
module('and an error occurs', function () { | ||
test('it should display an error notification and the invitation should remain in the list', async function (assert) { | ||
// given | ||
const dayjsService = this.owner.lookup('service:dayjs'); | ||
await authenticateAdminMemberWithRole({ isSuperAdmin: true })(server); | ||
const updatedAt = new Date('2023-12-05T09:00:00Z'); | ||
|
||
const organization = this.server.create('organization', { | ||
id: 5, | ||
name: 'Kabuki', | ||
|
@@ -74,6 +79,7 @@ module('Acceptance | Organizations | Invitations management', function (hooks) { | |
id: 10, | ||
email: '[email protected]', | ||
lang: 'fr', | ||
updatedAt, | ||
organization, | ||
}); | ||
this.server.delete( | ||
|
@@ -87,8 +93,12 @@ module('Acceptance | Organizations | Invitations management', function (hooks) { | |
await click(screen.getByRole('button', { name: 'Annuler l’invitation de [email protected]' })); | ||
|
||
// then | ||
const formattedDate = dayjsService.self(updatedAt).format('DD/MM/YYYY [-] HH:mm'); | ||
|
||
assert.dom(screen.getByText('Une erreur s’est produite, veuillez réessayer.')).exists(); | ||
assert.dom(screen.getByRole('row', { name: 'Invitation en attente de [email protected]' })).exists(); | ||
assert.dom(screen.getByRole('cell', { name: '[email protected]' })).exists(); | ||
assert.dom(screen.getByRole('cell', { name: formattedDate })).exists(); | ||
}); | ||
}); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,13 +26,17 @@ module('Integration | Component | Certification Centers | Invitations', function | |
test('should show invitations list', async function (assert) { | ||
// given | ||
const store = this.owner.lookup('service:store'); | ||
const dayjsService = this.owner.lookup('service:dayjs'); | ||
|
||
const invitationUpdatedAt1 = new Date('2020-02-02T09:00:00Z'); | ||
const invitationUpdatedAt2 = new Date('2022-02-02T15:12:00Z'); | ||
const certificationCenterInvitation1 = store.createRecord('certification-center-invitation', { | ||
email: '[email protected]', | ||
updatedAt: new Date('2020-02-02'), | ||
updatedAt: invitationUpdatedAt1, | ||
}); | ||
const certificationCenterInvitation2 = store.createRecord('certification-center-invitation', { | ||
email: '[email protected]', | ||
updatedAt: new Date('2022-02-02'), | ||
updatedAt: invitationUpdatedAt2, | ||
}); | ||
this.certificationCenterInvitations = [certificationCenterInvitation1, certificationCenterInvitation2]; | ||
this.cancelCertificationCenterInvitation = sinon.stub(); | ||
|
@@ -46,11 +50,16 @@ module('Integration | Component | Certification Centers | Invitations', function | |
); | ||
|
||
// then | ||
const formattedInvitationUpdatedAt1 = dayjsService.self(invitationUpdatedAt1).format('DD/MM/YYYY [-] HH:mm'); | ||
const formattedInvitationUpdatedAt2 = dayjsService.self(invitationUpdatedAt2).format('DD/MM/YYYY [-] HH:mm'); | ||
|
||
assert.dom(screen.getByRole('heading', { name: 'Invitations' })).exists(); | ||
assert.dom(screen.getByRole('columnheader', { name: 'Adresse e-mail' })).exists(); | ||
assert.dom(screen.getByRole('columnheader', { name: 'Date de dernier envoi' })).exists(); | ||
assert.dom(screen.getByRole('cell', { name: '[email protected]' })).exists(); | ||
assert.dom(screen.getByRole('cell', { name: formattedInvitationUpdatedAt1 })).exists(); | ||
assert.dom(screen.getByRole('cell', { name: '[email protected]' })).exists(); | ||
assert.dom(screen.getByRole('cell', { name: formattedInvitationUpdatedAt2 })).exists(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
import { module, test } from 'qunit'; | ||
import { currentURL } from '@ember/test-helpers'; | ||
import { setupApplicationTest } from 'ember-qunit'; | ||
import { clickByName, visit } from '@1024pix/ember-testing-library'; | ||
|
||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage'; | ||
import { | ||
authenticateSession, | ||
createCertificationPointOfContactWithTermsOfServiceAccepted, | ||
} from '../../../helpers/test-init'; | ||
import setupIntl from '../../../helpers/setup-intl'; | ||
import { clickByName, visit } from '@1024pix/ember-testing-library'; | ||
|
||
module('Acceptance | Team | Invitations', function (hooks) { | ||
setupApplicationTest(hooks); | ||
|
@@ -112,10 +111,13 @@ module('Acceptance | Team | Invitations', function (hooks) { | |
module('when user clicks on resend invitation button', function () { | ||
test('resends the invitation and displays a success notification', async function (assert) { | ||
// given | ||
const dayjsService = this.owner.lookup('service:dayjs'); | ||
const previousUpdatedAt = new Date('2023-12-05T09:00:00Z'); | ||
|
||
this.server.create('certification-center-invitation', { | ||
certificationCenterId: 1, | ||
email: '[email protected]', | ||
updatedAt: new Date('2023-12-05T11:30:00Z'), | ||
updatedAt: previousUpdatedAt, | ||
}); | ||
|
||
const screen = await visit('/equipe/invitations'); | ||
|
@@ -124,6 +126,10 @@ module('Acceptance | Team | Invitations', function (hooks) { | |
await clickByName(this.intl.t('pages.team-invitations.actions.resend-invitation')); | ||
|
||
// then | ||
const formattedDate = dayjsService.self(new Date('2023-12-05T11:35:00Z')).format('DD/MM/YYYY [-] HH:mm'); | ||
|
||
assert.dom(screen.getByRole('cell', { name: '[email protected]' })).exists(); | ||
assert.dom(screen.getByRole('cell', { name: formattedDate })).exists(); | ||
assert.dom(screen.getByText("L'invitation a bien été renvoyée.")).exists(); | ||
}); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,16 +36,19 @@ module('Integration | Component | Team::InvitationsList', function (hooks) { | |
|
||
test('it should display email and creation date of invitation', async function (assert) { | ||
// given | ||
const pendingInvitationDate = '2019-10-08T10:50:00Z'; | ||
const dayjsService = this.owner.lookup('service:dayjs'); | ||
const pendingInvitationDate = '2023-12-05T09:00:00Z'; | ||
|
||
this.set('invitations', [{ email: '[email protected]', isPending: true, updatedAt: pendingInvitationDate }]); | ||
|
||
// when | ||
await render(hbs`<Team::InvitationsList @invitations={{this.invitations}} />`); | ||
const component = await render(hbs`<Team::InvitationsList @invitations={{this.invitations}} />`); | ||
|
||
// then | ||
assert.contains('[email protected]'); | ||
assert.contains(this.dayjs.self(pendingInvitationDate).format('DD/MM/YYYY - HH:mm')); | ||
const formattedPendingInvitationDate = dayjsService.self(pendingInvitationDate).format('DD/MM/YYYY [-] HH:mm'); | ||
|
||
assert.dom(component.getByRole('cell', { name: '[email protected]' })).exists(); | ||
assert.dom(component.getByRole('cell', { name: formattedPendingInvitationDate })).exists(); | ||
}); | ||
|
||
test('it should show success notification when cancelling an invitation succeeds', async function (assert) { | ||
|