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.
This commit is contained in:
gnezim
2026-04-05 19:25:03 +03:00
parent 21c6ed4f82
commit 60e2149072
31032 changed files with 5222883 additions and 2 deletions
+148
View File
@@ -0,0 +1,148 @@
const React = require('react');
const Search = require('./Search');
const Map = require('./Map');
const CurrentLocation = require('./CurrentLocation');
const LocationList = require('./LocationList');
const App = React.createClass({
getInitialState() {
// Extract the favorite locations from local storage
let favorites = [];
if (localStorage.favorites) {
favorites = JSON.parse(localStorage.favorites);
}
// Nobody would get mad if we center it on Paris by default
return {
favorites: favorites,
currentAddress: 'Paris, France',
mapCoordinates: {
lat: 48.856614,
lng: 2.3522219
}
};
},
toggleFavorite(address) {
if (this.isAddressInFavorites(address)) {
this.removeFromFavorites(address);
} else {
this.addToFavorites(address);
}
},
addToFavorites(address) {
const favorites = this.state.favorites;
favorites.push({
address: address,
timestamp: Date.now()
});
this.setState({
favorites: favorites
});
localStorage.favorites = JSON.stringify(favorites);
},
removeFromFavorites(address) {
const favorites = this.state.favorites;
let index = -1;
for (let i = 0; i < favorites.length; i++) {
if (favorites[i].address == address) {
index = i;
break;
}
}
// If it was found, remove it from the favorites array
if (index !== -1) {
favorites.splice(index, 1);
this.setState({
favorites: favorites
});
localStorage.favorites = JSON.stringify(favorites);
}
},
isAddressInFavorites(address) {
const favorites = this.state.favorites;
for (let i = 0; i < favorites.length; i++) {
if (favorites[i].address == address) {
return true;
}
}
return false;
},
searchForAddress(address) {
const self = this;
// We will use GMaps' geocode functionality,
// which is built on top of the Google Maps API
GMaps.geocode({
address: address,
callback: function (results, status) {
if (status !== 'OK') return;
const latlng = results[0].geometry.location;
self.setState({
currentAddress: results[0].formatted_address,
mapCoordinates: {
lat: latlng.lat(),
lng: latlng.lng()
}
});
setTimeout(function () {
console.log('gmapResponded');
}, 1000);
}
});
},
componentDidMount() {
const that = this;
setTimeout(function () {
that.searchForAddress('San Francisco');
}, 2000);
},
render() {
return (
<div>
<h1>Your Google Maps Locations</h1>
<Search onSearch={this.searchForAddress}/>
<Map lat={this.state.mapCoordinates.lat} lng={this.state.mapCoordinates.lng}/>
<CurrentLocation address={this.state.currentAddress}
favorite={this.isAddressInFavorites(this.state.currentAddress)}
onFavoriteToggle={this.toggleFavorite}/>
<LocationList locations={this.state.favorites} activeLocationAddress={this.state.currentAddress}
onClick={this.searchForAddress}/>
</div>
);
}
});
module.exports = App;
@@ -0,0 +1,26 @@
const React = require('react');
const CurrentLocation = React.createClass({
toggleFavorite() {
this.props.onFavoriteToggle(this.props.address);
},
render() {
let starClassName = 'glyphicon glyphicon-star-empty';
if (this.props.favorite) {
starClassName = 'glyphicon glyphicon-star';
}
return (
<div className="col-xs-12 col-md-6 col-md-offset-3 current-location">
<h4 id="save-location">{this.props.address}</h4>
<span className={starClassName} onClick={this.toggleFavorite} aria-hidden="true"></span>
</div>
);
}
});
module.exports = CurrentLocation;
@@ -0,0 +1,28 @@
const React = require('react');
const moment = require('moment');
const LocationItem = React.createClass({
handleClick () {
this.props.onClick(this.props.address);
},
render () {
let cn = 'list-group-item';
if (this.props.active) {
cn += ' active-location';
}
return (
<a className={cn} onClick={this.handleClick}>
{this.props.address}
<span className="createdAt">{ moment(this.props.timestamp).fromNow() }</span>
<span className="glyphicon glyphicon-menu-right"></span>
</a>
);
}
});
module.exports = LocationItem;
@@ -0,0 +1,33 @@
const React = require('react');
const LocationItem = require('./LocationItem');
const LocationList = React.createClass({
render() {
const self = this;
const locations = this.props.locations.map(function (l) {
const active = self.props.activeLocationAddress == l.address;
// Notice that we are passing the onClick callback of this
// LocationList to each LocationItem.
return <LocationItem address={l.address} timestamp={l.timestamp}
active={active} onClick={self.props.onClick}/>;
});
if (!locations.length) {
return null;
}
return (
<div className="list-group col-xs-12 col-md-6 col-md-offset-3">
<span className="list-group-item active">Saved Locations</span>
{locations}
</div>
);
}
});
module.exports = LocationList;
+50
View File
@@ -0,0 +1,50 @@
const React = require('react');
const Map = React.createClass({
componentDidMount() {
// Only componentDidMount is called when the component is first added to
// the page. This is why we are calling the following method manually.
// This makes sure that our map initialization code is run the first time.
this.componentDidUpdate();
},
componentDidUpdate() {
if (this.lastLat == this.props.lat && this.lastLng == this.props.lng) {
// The map has already been initialized at this address.
// Return from this method so that we don't reinitialize it
// (and cause it to flicker).
return;
}
this.lastLat = this.props.lat;
this.lastLng = this.props.lng;
const map = new GMaps({
el: '#map',
lat: this.props.lat,
lng: this.props.lng
});
// Adding a marker to the location we are showing
map.addMarker({
lat: this.props.lat,
lng: this.props.lng
});
},
render() {
return (
<div className="map-holder">
<p>Loading...</p>
<div id="map"></div>
</div>
);
}
});
module.exports = Map;
+43
View File
@@ -0,0 +1,43 @@
const React = require('react');
const Search = React.createClass({
getInitialState() {
return {value: ''};
},
handleChange(event) {
this.setState({value: event.target.value});
},
handleSubmit(event) {
event.preventDefault();
// When the form is submitted, call the onSearch callback that is passed to the component
this.props.onSearch(this.state.value);
// Unfocus the text input field
this.getDOMNode().querySelector('input').blur();
},
render() {
return (
<form id="geocoding_form" className="form-horizontal" onSubmit={this.handleSubmit}>
<div className="form-group">
<div className="col-xs-12 col-md-6 col-md-offset-3">
<div className="input-group">
<input type="text" className="form-control" id="address" placeholder="Find a location..."
value={this.state.value} onChange={this.handleChange}/>
<span className="input-group-btn">
<span className="glyphicon glyphicon-search" aria-hidden="true"></span>
</span>
</div>
</div>
</div>
</form>
);
}
});
module.exports = Search;