test(e2e): browser suite for the flows the server tests cannot see
Playwright under e2e/, its own npm project so Meteor never sees the dependency (.meteorignore keeps the directory out of the bundle — a config file at the app root is otherwise eagerly loaded into the server and crashes it). Covers what the phase asked for: sign up / log in, creating a zone from the map and watching the union get painted on /subscriptions and /zones, removing it again, commenting on a fire, and switching language. The zone spec is the flow that froze staging on 2026-07-30 — it passes only if the server is still answering DDP while the union is recomputed. docker-compose.e2e.yml is a throwaway stack (Mongo on tmpfs, no named volume) so the destructive seeds cannot be pointed at anything real by accident; playwright.config.js refuses to start against the staging or production domains. i18n.spec.js leaves a test.fixme on a real bug found while writing it: the language chosen in the profile does not survive a page reload.
This commit is contained in:
parent
3b04ebceb3
commit
a3f2929ff7
14 changed files with 708 additions and 0 deletions
61
e2e/seed.js
Normal file
61
e2e/seed.js
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* Deterministic seed for the browser e2e suite (mongosh script).
|
||||
*
|
||||
* ⚠️ DESTRUCTIVE: it empties the collections it seeds. It is only ever meant for
|
||||
* the throwaway Mongo of docker-compose.e2e.yml (or a local scratch one). Never
|
||||
* point it at staging or production — that is what e2e/seed.sh guards against.
|
||||
*
|
||||
* mongosh --host localhost:27021 fuegos e2e/seed.js
|
||||
*
|
||||
* The subscriptions collection is deliberately NOT seeded: the whole point of
|
||||
* the zone spec is to create one through the UI and watch the union appear.
|
||||
*/
|
||||
|
||||
var FIRE_A = ObjectId('e2e0000000000000000000a1');
|
||||
var FIRE_B = ObjectId('e2e0000000000000000000b2');
|
||||
|
||||
// Madrid, so a zone created around the map's default view sees them.
|
||||
var LAT = 40.41;
|
||||
var LON = -3.70;
|
||||
var WHEN = ISODate('2026-07-30T05:30:00.000Z');
|
||||
var WHEN_B = ISODate('2026-07-30T06:30:00.000Z');
|
||||
var FIXED = ISODate('2026-07-30T00:00:00.000Z');
|
||||
|
||||
db.activefires.deleteMany({});
|
||||
db.activefires.insertMany([
|
||||
{
|
||||
_id: FIRE_A,
|
||||
ourid: { type: 'Point', coordinates: [LON, LAT] },
|
||||
lat: LAT, lon: LON, type: 'viirs', when: WHEN,
|
||||
scan: 0.5, track: 0.4, acq_date: '2026-07-30', acq_time: '05:30',
|
||||
satellite: 'N', confidence: 50, version: '1.0NRT', frp: 4.3,
|
||||
daynight: 'N', bright_ti4: 330.2, bright_ti5: 291,
|
||||
createdAt: FIXED, updatedAt: FIXED
|
||||
},
|
||||
{
|
||||
_id: FIRE_B,
|
||||
ourid: { type: 'Point', coordinates: [LON + 0.02, LAT + 0.02] },
|
||||
lat: LAT + 0.02, lon: LON + 0.02, type: 'viirs', when: WHEN_B,
|
||||
scan: 0.5, track: 0.4, acq_date: '2026-07-30', acq_time: '06:30',
|
||||
satellite: 'N', confidence: 60, version: '1.0NRT', frp: 6.1,
|
||||
daynight: 'N', bright_ti4: 331.0, bright_ti5: 292,
|
||||
createdAt: FIXED, updatedAt: FIXED
|
||||
}
|
||||
]);
|
||||
db.activefires.createIndex({ ourid: '2dsphere' });
|
||||
|
||||
db.activefiresunion.deleteMany({});
|
||||
db.activefiresunion.createIndex({ shape: '2dsphere' });
|
||||
|
||||
db.comments.deleteMany({});
|
||||
db.falsePositives.deleteMany({});
|
||||
db.industries.deleteMany({});
|
||||
|
||||
// Anything left over from a previous run of the suite: users it created, their
|
||||
// zones, and the stored union computed from them.
|
||||
db.subscriptions.deleteMany({});
|
||||
db.users.deleteMany({ 'emails.address': /^e2e\+/ });
|
||||
db.siteSettings.deleteMany({ name: /^subs-(public|private)-union/ });
|
||||
db.siteSettings.deleteMany({ name: 'subs-union-count' });
|
||||
|
||||
print('e2e seed OK: ' + db.activefires.countDocuments({}) + ' active fires, 0 subscriptions');
|
||||
Loading…
Add table
Add a link
Reference in a new issue