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.
96 lines
2.6 KiB
JavaScript
96 lines
2.6 KiB
JavaScript
const express = require('express');
|
|
const https = require('https');
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
const util = require('util');
|
|
const os = require('os');
|
|
|
|
const USE_LOCALHOST = true;
|
|
const HTTP_PORT = process.env.SSWS_HTTP_PORT || 3000;
|
|
const HTTPS_PORT = process.env.SSWS_HTTPS_PORT || 3001;
|
|
const KEY_PATH = 'certs/key.pem';
|
|
const CERT_PATH = 'certs/cert.pem';
|
|
|
|
const LOCALHOST_IP = '127.0.0.1';
|
|
const ROOT_DIR = path.resolve(process.argv[2] || './');
|
|
|
|
const app = express();
|
|
const ip_addresses = getAddresses();
|
|
|
|
if (!ip_addresses || ip_addresses.length < 1) {
|
|
console.log("Could not resolve local IP address.");
|
|
return 0;
|
|
}
|
|
|
|
var NODE_HOST = USE_LOCALHOST ? LOCALHOST_IP : ip_addresses[ip_addresses.length-1];
|
|
|
|
//Runs every time a request is recieved
|
|
function logger(req, res, next) {
|
|
console.log('Request from: ', req.path); //Log the request to the console
|
|
next(); //Run the next handler (IMPORTANT, otherwise your page won't be served)
|
|
}
|
|
|
|
/**
|
|
* To add middleware set the third arg to a path that resolves to a file exporting a function like so...
|
|
* module.exports = (app) => { app.use(someCoolThingHere);}
|
|
*/
|
|
const MIDDLEWARE_PATH = path.resolve(process.argv[3] || false);
|
|
if (MIDDLEWARE_PATH) {
|
|
try {
|
|
var initMiddleware = require(MIDDLEWARE_PATH);
|
|
initMiddleware(app);
|
|
} catch (err) {
|
|
console.log('Error initalizing middleware. ', err);
|
|
}
|
|
} else {
|
|
console.log('No middleware found.');
|
|
}
|
|
|
|
app.use(logger);
|
|
app.use(express.static(ROOT_DIR));
|
|
|
|
console.log('\n---------------');
|
|
console.log('Starting static hosts with root: ' + ROOT_DIR);
|
|
console.log('Press Ctrl + C to exit.');
|
|
console.log('---------------');
|
|
|
|
app.listen(HTTP_PORT, (err) => {
|
|
if (err) {
|
|
console.log('Http method retrurned an error when trying to start.', err);
|
|
} else {
|
|
console.log('Listening on: http://' + NODE_HOST + ':' + HTTP_PORT + '');
|
|
}
|
|
});
|
|
|
|
const server = https.createServer({
|
|
key: fs.readFileSync(path.resolve(__dirname, KEY_PATH)),
|
|
cert: fs.readFileSync(path.resolve(__dirname, CERT_PATH))
|
|
}, app);
|
|
server.listen(HTTPS_PORT, NODE_HOST, (err) => {
|
|
if (err) {
|
|
console.log('Https method retrurned an error when trying to start.', err);
|
|
} else {
|
|
console.log('Listening on: https://' + NODE_HOST + ':' + HTTPS_PORT + '');
|
|
}
|
|
});
|
|
|
|
//=======
|
|
function getAddresses() {
|
|
var
|
|
network = os.networkInterfaces(),
|
|
interfaces = [],
|
|
addresses = [];
|
|
|
|
for (prop in network) {
|
|
interfaces.push(network[prop]);
|
|
}
|
|
|
|
interfaces.forEach(function(net) {
|
|
net.forEach(function(address) {
|
|
if (address.family == 'IPv4' && !address.internal) addresses.push(address.address);
|
|
});
|
|
});
|
|
|
|
return addresses;
|
|
}
|