60e2149072
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.
48 lines
1.7 KiB
JavaScript
48 lines
1.7 KiB
JavaScript
'use strict';
|
|
|
|
var PNG = require('pngjs').PNG,
|
|
fs = require('fs'),
|
|
test = require('tap').test,
|
|
path = require('path'),
|
|
match = require('../.');
|
|
|
|
diffTest('1a', '1b', '1diff', 0.05, false, 143);
|
|
diffTest('2a', '2b', '2diff', 0.05, false, 12439);
|
|
diffTest('3a', '3b', '3diff', 0.05, false, 212);
|
|
diffTest('4a', '4b', '4diff', 0.05, false, 36089);
|
|
|
|
function diffTest(imgPath1, imgPath2, diffPath, threshold, includeAA, expectedMismatch) {
|
|
var name = 'comparing ' + imgPath1 + ' to ' + imgPath2 +
|
|
', threshold: ' + threshold + ', includeAA: ' + includeAA;
|
|
|
|
test(name, function (t) {
|
|
var img1 = readImage(imgPath1, function () {
|
|
var img2 = readImage(imgPath2, function () {
|
|
var expectedDiff = readImage(diffPath, function () {
|
|
var diff = new PNG({width: img1.width, height: img1.height});
|
|
|
|
var mismatch = match(img1.data, img2.data, diff.data, diff.width, diff.height, {
|
|
threshold: threshold,
|
|
includeAA: includeAA
|
|
});
|
|
|
|
var mismatch2 = match(img1.data, img2.data, null, diff.width, diff.height, {
|
|
threshold: threshold,
|
|
includeAA: includeAA
|
|
});
|
|
|
|
t.same(diff.data, expectedDiff.data, 'diff image');
|
|
t.same(mismatch, expectedMismatch, 'number of mismatched pixels');
|
|
t.same(mismatch, mismatch2, 'number of mismatched pixels');
|
|
|
|
t.end();
|
|
});
|
|
});
|
|
});
|
|
});
|
|
}
|
|
|
|
function readImage(name, done) {
|
|
return fs.createReadStream(path.join(__dirname, '/fixtures/' + name + '.png')).pipe(new PNG()).on('parsed', done);
|
|
}
|