FE9: End-to-end tests and shipping safely

Lesson 4 of 5 ยท reading 15โ€“25 minutes; practice and project time is on the module page

CI pipelines and preview deployments

๐ŸŽฏYou'll be able to

Run tests in a CI pipeline and review changes on preview deployments.

๐Ÿ The everyday picture

A factory line has checkpoints: each station checks its part before passing it on, and a faulty item is pulled off the line before packing. A CI pipeline does the same for every code change.

๐Ÿ“˜What it really is

๐Ÿ“A worked example

Kirana's pull request pipeline:

Step Time Blocks merge?
Lint, format, type check 40 s Yes
Unit and component tests 70 s Yes
Build, with bundle size budget (170 KB for product page) 60 s Yes
E2E: 5 journeys against the preview 3 min Yes
Lighthouse on product page (mobile) 1 min Warning only below target
Preview URL posted on the pull request โ€” โ€”

A pull request that accidentally imported the whole icon set failed the size budget and was fixed before review.

๐ŸŒWhere it's used

๐Ÿ“Case scenario

A team merges straight to main and deploys by hand. A Friday change breaks checkout on Safari, and nobody notices until Monday. You set up branch protection, a CI pipeline with E2E tests on WebKit, and preview deployments. The next Safari bug is caught on its pull request, before it reaches anyone.

๐Ÿ–ฑ๏ธTry it

Write a GitHub Actions workflow for your Kirana project that runs lint, type check, tests and build on every pull request. Connect a host for preview deployments, open a pull request, and check that the preview URL appears.

โš ๏ธCommon mistakes

๐Ÿ› ๏ธFor your project

For the capstone, run the kit's tests in a pipeline or record a full local run; either is acceptable evidence.

โœ…Quick check

What is a preview deployment?

Show the answer

A temporary live copy of the app built from a pull request, so people can try the change before it merges.

Why keep the CI pipeline fast?

Show the answer

Slow pipelines delay every change and tempt people to skip or bypass them.

โ† PreviousTest data and environments
ProLearners Assist