Files
flights_web_raw/e2e/node_modules/@angular-devkit/architect/testing/test-project-host.js
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

110 lines
5.1 KiB
JavaScript
Executable File

"use strict";
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.TestProjectHost = void 0;
const core_1 = require("@angular-devkit/core");
const node_1 = require("@angular-devkit/core/node");
const rxjs_1 = require("rxjs");
/**
* @deprecated
*/
class TestProjectHost extends node_1.NodeJsSyncHost {
_templateRoot;
_currentRoot = null;
_scopedSyncHost = null;
constructor(_templateRoot) {
super();
this._templateRoot = _templateRoot;
}
root() {
if (this._currentRoot === null) {
throw new Error('TestProjectHost must be initialized before being used.');
}
return this._currentRoot;
}
scopedSync() {
if (this._currentRoot === null || this._scopedSyncHost === null) {
throw new Error('TestProjectHost must be initialized before being used.');
}
return this._scopedSyncHost;
}
initialize() {
const recursiveList = (path) => this.list(path).pipe(
// Emit each fragment individually.
(0, rxjs_1.concatMap)((fragments) => (0, rxjs_1.from)(fragments)),
// Join the path with fragment.
(0, rxjs_1.map)((fragment) => (0, core_1.join)(path, fragment)),
// Emit directory content paths instead of the directory path.
(0, rxjs_1.mergeMap)((path) => this.isDirectory(path).pipe((0, rxjs_1.concatMap)((isDir) => (isDir ? recursiveList(path) : (0, rxjs_1.of)(path))))));
// Find a unique folder that we can write to use as current root.
return this.findUniqueFolderPath().pipe(
// Save the path and create a scoped host for it.
(0, rxjs_1.tap)((newFolderPath) => {
this._currentRoot = newFolderPath;
this._scopedSyncHost = new core_1.virtualFs.SyncDelegateHost(new core_1.virtualFs.ScopedHost(this, this.root()));
}),
// List all files in root.
(0, rxjs_1.concatMap)(() => recursiveList(this._templateRoot)),
// Copy them over to the current root.
(0, rxjs_1.concatMap)((from) => {
const to = (0, core_1.join)(this.root(), (0, core_1.relative)(this._templateRoot, from));
return this.read(from).pipe((0, rxjs_1.concatMap)((buffer) => this.write(to, buffer)));
}), (0, rxjs_1.map)(() => { }));
}
restore() {
if (this._currentRoot === null) {
return rxjs_1.EMPTY;
}
// Delete the current root and clear the variables.
// Wait 50ms and retry up to 10 times, to give time for file locks to clear.
return this.exists(this.root()).pipe((0, rxjs_1.delay)(50), (0, rxjs_1.concatMap)((exists) => (exists ? this.delete(this.root()) : rxjs_1.EMPTY)), (0, rxjs_1.retry)(10), (0, rxjs_1.finalize)(() => {
this._currentRoot = null;
this._scopedSyncHost = null;
}));
}
writeMultipleFiles(files) {
Object.keys(files).forEach((fileName) => {
let content = files[fileName];
if (typeof content == 'string') {
content = core_1.virtualFs.stringToFileBuffer(content);
}
else if (content instanceof Buffer) {
content = content.buffer.slice(content.byteOffset, content.byteOffset + content.byteLength);
}
this.scopedSync().write((0, core_1.normalize)(fileName), content);
});
}
replaceInFile(path, match, replacement) {
const content = core_1.virtualFs.fileBufferToString(this.scopedSync().read((0, core_1.normalize)(path)));
this.scopedSync().write((0, core_1.normalize)(path), core_1.virtualFs.stringToFileBuffer(content.replace(match, replacement)));
}
appendToFile(path, str) {
const content = core_1.virtualFs.fileBufferToString(this.scopedSync().read((0, core_1.normalize)(path)));
this.scopedSync().write((0, core_1.normalize)(path), core_1.virtualFs.stringToFileBuffer(content.concat(str)));
}
fileMatchExists(dir, regex) {
const [fileName] = this.scopedSync()
.list((0, core_1.normalize)(dir))
.filter((name) => name.match(regex));
return fileName || undefined;
}
copyFile(from, to) {
const content = this.scopedSync().read((0, core_1.normalize)(from));
this.scopedSync().write((0, core_1.normalize)(to), content);
}
findUniqueFolderPath() {
// 11 character alphanumeric string.
const randomString = Math.random().toString(36).slice(2);
const newFolderName = `test-project-host-${(0, core_1.basename)(this._templateRoot)}-${randomString}`;
const newFolderPath = (0, core_1.join)((0, core_1.dirname)(this._templateRoot), newFolderName);
return this.exists(newFolderPath).pipe((0, rxjs_1.concatMap)((exists) => (exists ? this.findUniqueFolderPath() : (0, rxjs_1.of)(newFolderPath))));
}
}
exports.TestProjectHost = TestProjectHost;
//# sourceMappingURL=test-project-host.js.map