Commit 6d975bc
Upgrade/Rollback E2E Tests (#8017)
This pull request introduces a new end-to-end (E2E) test setup for the
`ExpressSample` in the MSAL browser samples, along with several
improvements to the sample app's authentication flow, version switching,
and UI. The most significant changes are the addition of E2E test
infrastructure, enhancements to how authentication and profile data are
handled and displayed, and improvements to the version switching logic
and UI.
**E2E Test Infrastructure and Configuration:**
* Added E2E test configuration and helpers for `ExpressSample`,
including a new `.env.e2e` file, a `jest.config.cjs` configuration, and
a `test-helpers.ts` utility for Puppeteer-based tests. This enables
automated browser testing of authentication scenarios.
[[1]](diffhunk://#diff-d257013e504cdeb26f2bfad2e809b36492f6fdbfc45ffcbf4bc55b2da4887c74R1-R5)
[[2]](diffhunk://#diff-b70997a8822f049844c4b3afbe1ab62688a13f909a880256d0c8364fff169c3eR1-R8)
[[3]](diffhunk://#diff-a45554c7aba0df12b0d4ff639ce1fe74f9e12a2904ecb1d0d2edbe002bc4eefeR1-R112)
* Updated the pipeline configuration to include `ExpressSample` in E2E
test runs.
* Added necessary devDependencies and scripts for E2E testing in
`package.json`.
**Authentication and Profile Data Handling:**
* Modified the authentication flow to return the full MSAL
authentication response, not just the access token, and updated the MS
Graph call logic to pass and display this data.
[[1]](diffhunk://#diff-aedaa17dbc1e25e5997a95b1bea0c9c3b5a9caa6fbbc943c700972966e16b530L115-R115)
[[2]](diffhunk://#diff-57185e771678ea1756556bb0a2d9f5cba1e5441609c75dc66cebf0106e92ce3bL11-R15)
[[3]](diffhunk://#diff-57185e771678ea1756556bb0a2d9f5cba1e5441609c75dc66cebf0106e92ce3bL31-R30)
[[4]](diffhunk://#diff-57185e771678ea1756556bb0a2d9f5cba1e5441609c75dc66cebf0106e92ce3bL49-R50)
[[5]](diffhunk://#diff-57185e771678ea1756556bb0a2d9f5cba1e5441609c75dc66cebf0106e92ce3bR94-R117)
* Added UI logic to display both profile data and raw authentication
data, with sensitive fields (like the access token) redacted for
display.
**Version Switching and UI Improvements:**
* Refactored version switching logic to use consistent keys (e.g.,
`latest-v3` instead of `3.x`) and improved the UI for version selection,
including unique IDs for dropdown items and better feedback when
switching versions.
[[1]](diffhunk://#diff-7bf33d829c4c8178361e7badec48a371762d82042e849f0d2c94a2bb41001c8cL60-R57)
[[2]](diffhunk://#diff-7bf33d829c4c8178361e7badec48a371762d82042e849f0d2c94a2bb41001c8cL70-R74)
[[3]](diffhunk://#diff-7bf33d829c4c8178361e7badec48a371762d82042e849f0d2c94a2bb41001c8cL107-R104)
[[4]](diffhunk://#diff-7bf33d829c4c8178361e7badec48a371762d82042e849f0d2c94a2bb41001c8cL129-R147)
[[5]](diffhunk://#diff-2d7f351e21c92ea9ff545acdd7d5094e73a972fe350dea4df139f4e760a77d2eR92)
[[6]](diffhunk://#diff-2d7f351e21c92ea9ff545acdd7d5094e73a972fe350dea4df139f4e760a77d2eR111)
* Ensured UI elements (such as sign-in and version switcher buttons) are
only displayed after event handlers are registered, preventing flicker
or premature interaction.
[[1]](diffhunk://#diff-83705d1d56435a3dea7f60a3b8bfeb237387c901e34b0a7990233797b9ad2fbaR47-R48)
[[2]](diffhunk://#diff-2d7f351e21c92ea9ff545acdd7d5094e73a972fe350dea4df139f4e760a77d2eR64-R66)
**UI and Styling Enhancements:**
* Updated CSS classes and selectors to use `.json-content` for
displaying JSON data, improving clarity and maintainability.
[[1]](diffhunk://#diff-0587667bae35b440adac264532b10d1e1c50fd1ad1cf003c42cbceb8365bac54L251-R252)
[[2]](diffhunk://#diff-0587667bae35b440adac264532b10d1e1c50fd1ad1cf003c42cbceb8365bac54L260-R261)
* Minor CSS and code style cleanups for readability and consistency.
[[1]](diffhunk://#diff-0587667bae35b440adac264532b10d1e1c50fd1ad1cf003c42cbceb8365bac54L175-R176)
[[2]](diffhunk://#diff-0587667bae35b440adac264532b10d1e1c50fd1ad1cf003c42cbceb8365bac54L523-R530)
**Other Improvements:**
* Removed unnecessary dependencies (like `morgan`) from the server and
cleaned up middleware usage.
[[1]](diffhunk://#diff-7bf33d829c4c8178361e7badec48a371762d82042e849f0d2c94a2bb41001c8cL8)
[[2]](diffhunk://#diff-7bf33d829c4c8178361e7badec48a371762d82042e849f0d2c94a2bb41001c8cL39-L40)
* Improved screenshot utility to always capture full-page screenshots
during E2E tests.
These changes collectively improve the testability, usability, and
maintainability of the `ExpressSample` app and its E2E testing setup.
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>1 parent 8316ee5 commit 6d975bc
File tree
19 files changed
+2461
-331
lines changed- .pipelines
- samples
- e2eTestUtils/src
- msal-browser-samples/ExpressSample
- public
- css
- js
- test
- views
- layouts
- partials
19 files changed
+2461
-331
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
80 | 81 | | |
81 | 82 | | |
82 | 83 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| 14 | + | |
13 | 15 | | |
14 | | - | |
15 | | - | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
20 | 31 | | |
21 | 32 | | |
22 | 33 | | |
| |||
Lines changed: 22 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
| 102 | + | |
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
175 | | - | |
| 175 | + | |
| 176 | + | |
176 | 177 | | |
177 | 178 | | |
178 | 179 | | |
| |||
248 | 249 | | |
249 | 250 | | |
250 | 251 | | |
251 | | - | |
| 252 | + | |
252 | 253 | | |
253 | 254 | | |
254 | 255 | | |
| |||
257 | 258 | | |
258 | 259 | | |
259 | 260 | | |
260 | | - | |
| 261 | + | |
261 | 262 | | |
262 | 263 | | |
263 | 264 | | |
| |||
322 | 323 | | |
323 | 324 | | |
324 | 325 | | |
325 | | - | |
| 326 | + | |
326 | 327 | | |
327 | 328 | | |
328 | 329 | | |
| |||
411 | 412 | | |
412 | 413 | | |
413 | 414 | | |
414 | | - | |
| 415 | + | |
415 | 416 | | |
416 | 417 | | |
417 | 418 | | |
| |||
520 | 521 | | |
521 | 522 | | |
522 | 523 | | |
523 | | - | |
524 | | - | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
525 | 531 | | |
526 | 532 | | |
527 | 533 | | |
| |||
797 | 803 | | |
798 | 804 | | |
799 | 805 | | |
800 | | - | |
| 806 | + | |
801 | 807 | | |
802 | 808 | | |
803 | 809 | | |
804 | | - | |
| 810 | + | |
805 | 811 | | |
806 | 812 | | |
807 | 813 | | |
808 | 814 | | |
809 | | - | |
| 815 | + | |
810 | 816 | | |
811 | 817 | | |
812 | 818 | | |
813 | | - | |
| 819 | + | |
814 | 820 | | |
815 | 821 | | |
816 | 822 | | |
| |||
822 | 828 | | |
823 | 829 | | |
824 | 830 | | |
825 | | - | |
| 831 | + | |
826 | 832 | | |
827 | 833 | | |
828 | 834 | | |
829 | 835 | | |
830 | | - | |
| 836 | + | |
831 | 837 | | |
832 | 838 | | |
833 | 839 | | |
834 | | - | |
| 840 | + | |
835 | 841 | | |
836 | 842 | | |
837 | 843 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
47 | 49 | | |
48 | 50 | | |
49 | 51 | | |
| |||
Lines changed: 5 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
| 86 | + | |
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
| 102 | + | |
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | | - | |
| 115 | + | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
| 118 | + | |
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| |||
Lines changed: 32 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
| 11 | + | |
| 12 | + | |
15 | 13 | | |
16 | 14 | | |
17 | | - | |
| 15 | + | |
18 | 16 | | |
19 | 17 | | |
20 | 18 | | |
| |||
28 | 26 | | |
29 | 27 | | |
30 | 28 | | |
31 | | - | |
| 29 | + | |
| 30 | + | |
32 | 31 | | |
33 | 32 | | |
34 | 33 | | |
| |||
46 | 45 | | |
47 | 46 | | |
48 | 47 | | |
49 | | - | |
| 48 | + | |
50 | 49 | | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
0 commit comments