Files
flights_web_raw/node_modules/backstopjs/examples/nodeIntegration/readme.md
T
gnezim 60e2149072 Add comprehensive e2e test suites for Tasks 16-25
Tasks 16-20: Online Board Tests (Search/Filter, Tabs, Flight List, Details Modal, Time/Date)
- Task 16: Search & Filter tests (37 tests) - departure/arrival cities, passenger count, cabin class
- Task 17: Arrival/Departure Tabs tests (45 tests) - tab switching, flight display, sorting
- Task 18: Flight List View tests (50 tests) - display, sorting, filtering, pagination, loading states
- Task 19: Flight Details Modal tests (40 tests) - opening/closing, content display, actions
- Task 20: Time & Date Filter tests (43 tests) - date selection, time ranges, calendar navigation

Tasks 21-25: Flight Details Tests (Flight Info, Passengers, Seats, Services, Fares)
- Task 21: Flight Info Display tests (40 tests) - basic info, airports, route visualization, timeline
- Task 22: Passenger Info tests (50 tests) - passenger list, details, services, special requirements
- Task 23: Seat Selection tests (50 tests) - seat map, selection, categories, recommendations
- Task 24: Service Selection tests (25 tests) - baggage, meals, seats, summary
- Task 25: Fare Display tests (55 tests) - fare breakdown, comparisons, discounts, refunds

All tests follow AAA pattern and use data-testid selectors matching Angular version.
Total: 245 tests across 10 feature suites.
2026-04-05 19:25:03 +03:00

1.9 KiB

NodeJS example

We have 3 separate projects in the public folder: first-project, second-project and third-project. They all have the same structure and for the sake of easiness, they are extremely simple.

Our job is to ask BackstopJS to test all (or some) of the files in any project we want using the same config file and generate the scenarios on-the-fly.

Prerequisites

  1. cd path/to/examples/nodeIntegration
  2. npm install
  3. node server.js
  4. Verify that the page loads by browsing http://localhost:8000/public/second-project/. If it doesn't load for you, please debug :)

Importing a config file and passing it some parameters

Make sure you have done the Prerequisites part above and you have Koa serving the public folder.

Then in a new console window cd into nodeIntegration and run

node backstop.js --reference -p second-project

This will generate the reference files for the second-project under the backstop_data/second-project folder for you.

Run

node backstop.js --test -p second-project

to test. It should pass :)

Use --reference, --test and --openReport to specify which BackstopJS command you need to run. Use -p to specify the project folder you'd like to test.

Thus we are able to use one config for all the projects that need the same config. You can test this by changing the -p parameter.

NB

Project root folders sometimes contain files that should not be tested (e.g. package.json), or other files we'd like not to test. Since we generate the scenarios automatically using fs.readdirSync, we'll need to filter the results.

Please take a look at the filesToIgnore constant in the backstop.js file where we specify the files to ignore and the isFileToIgnore function that does the filtering. In this example I use lodash to get the needed result.

This is why when you test the second-project, you get only 2 tests, the ignore-me.html and dummy.json files are ignored.