Skip to content

Commit 9a58d6c

Browse files
committed
feat(email): storybook like email package
1 parent 406f060 commit 9a58d6c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+6473
-395
lines changed

.github/workflows/end-to-end.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ jobs:
109109
- 5432:5432
110110
steps:
111111
- uses: actions/checkout@v4
112+
113+
- run: docker compose up --build --detach maildev
114+
112115
- uses: actions/setup-node@v4
113116
with:
114117
cache: "npm"

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/node_modules
1+
node_modules
22
*.swp
33
*.swo
44
*.orig
@@ -22,3 +22,5 @@ cypress/videos
2222

2323
/dist/*
2424
!/dist/.keep
25+
26+
*storybook.log

cypress.config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,10 @@ export default defineConfig({
2323
return config;
2424
},
2525
},
26+
env: {
27+
MAILDEV_PROTOCOL: "http",
28+
MAILDEV_HOST: "localhost",
29+
MAILDEV_SMTP_PORT: "1025",
30+
MAILDEV_API_PORT: "1080",
31+
},
2632
});

cypress/e2e/delete_totp/index.cy.ts

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,15 @@ describe("delete TOTP connexion", () => {
2323

2424
cy.contains("L’application d’authentification a bien été supprimée.");
2525

26-
cy.mailslurp()
27-
// use inbox id and a timeout of 30 seconds
28-
.then((mailslurp) =>
29-
mailslurp.waitForLatestEmail(
30-
"eab4ab97-875d-4ec7-bdcc-04323948ee63",
31-
60000,
32-
true,
33-
),
34-
)
35-
// check subject of deletion email
36-
.then((email) => {
37-
expect(email.subject).to.include(
38-
"Suppression d'une application d'authentification à double facteur",
39-
);
40-
});
26+
cy.maildevGetLastMessage().then((email) => {
27+
expect(email.subject).to.equal(
28+
"Suppression d'une application d'authentification à double facteur",
29+
);
30+
cy.maildevVisitMessageById(email.id);
31+
cy.contains(
32+
"L'application a été supprimée comme étape de connexion à deux facteurs.",
33+
);
34+
});
4135
});
4236

4337
it("should not be ask to sign with TOTP", function () {
@@ -57,21 +51,15 @@ describe("delete TOTP connexion", () => {
5751

5852
cy.contains("Désactiver la validation en deux étapes").click();
5953

60-
cy.mailslurp()
61-
// use inbox id and a timeout of 30 seconds
62-
.then((mailslurp) =>
63-
mailslurp.waitForLatestEmail(
64-
"c9fabb94-9274-4ece-a3d0-54b1987c8588",
65-
60000,
66-
true,
67-
),
68-
)
69-
// check subject of deletion email
70-
.then((email) => {
71-
expect(email.subject).to.include(
72-
"Désactivation de la validation en deux étapes",
73-
);
74-
});
54+
cy.maildevGetLastMessage().then((email) => {
55+
expect(email.subject).to.equal(
56+
"Désactivation de la validation en deux étapes",
57+
);
58+
cy.maildevVisitMessageById(email.id);
59+
cy.contains(
60+
"Votre compte MonComptePro n'est plus protégé par la validation en deux",
61+
);
62+
});
7563
});
7664

7765
it("should not be ask to sign with TOTP", function () {
Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
import { generateToken } from "@sunknudsen/totp";
22

33
describe("update TOTP application", () => {
4-
before(() => {
5-
cy.mailslurp().then((mailslurp) =>
6-
mailslurp.inboxController.deleteAllInboxEmails({
7-
inboxId: "d2469f84-9547-4190-b989-014876fd54ae",
8-
}),
9-
);
10-
});
114
it("should update TOTP application, and replace old app with new", function () {
125
cy.visit("/connection-and-account");
136

@@ -32,20 +25,16 @@ describe("update TOTP application", () => {
3225
});
3326

3427
cy.contains("L’application d’authentification a été modifiée.");
35-
cy.mailslurp()
36-
// use inbox id and a timeout of 30 seconds
37-
.then((mailslurp) =>
38-
mailslurp.waitForLatestEmail(
39-
"d2469f84-9547-4190-b989-014876fd54ae",
40-
60000,
41-
true,
42-
),
43-
)
44-
// check subject of deletion email
45-
.then((email) => {
46-
expect(email.subject).to.include(
47-
"Changement d'application d’authentification",
48-
);
49-
});
28+
29+
cy.maildevGetLastMessage().then((email) => {
30+
expect(email.subject).to.equal(
31+
"Changement d'application d’authentification",
32+
);
33+
cy.maildevVisitMessageById(email.id);
34+
cy.contains(
35+
"Le changement d'application d'authentification a bien été prise en compte.",
36+
);
37+
cy.maildevDeleteMessageById(email.id);
38+
});
5039
});
5140
});

cypress/support/e2e.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
// ***********************************************************
1515

1616
import "cypress-axe";
17+
import "cypress-maildev";
1718
import "cypress-mailslurp";
18-
1919
import "./commands";

docker-compose.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,9 @@ services:
6767
STYLESHEET_URL:
6868
network_mode: "host"
6969

70+
maildev:
71+
image: soulteary/maildev
72+
network_mode: "host"
73+
7074
volumes:
7175
db-data:

0 commit comments

Comments
 (0)