Repository navigation
fix(seeds): get demo accounts past the legal gate, and the e2e users past onboarding - #576
Merged
Merged
Conversation
…past onboarding Closes #575. Two problems, one of which affected every demo account rather than just the e2e ones. 1. Legal versions were hardcoded and had silently gone stale. The seed wrote privacy_policy_version = '1.0' and terms_of_service_version = '1.0'. Migration 342 later made core.legal_documents the source of truth and publishes 'v1.0'. The check is a string equality — `acceptedVersion !== doc.version` — so '1.0' has not matched since 342 landed. Every demo user was therefore past /onboarding but bounced to /legal-update. That is why loading tests/.auth/super-admin.json and navigating to /office/applications produced the public marketing page. The seed now reads the version from core.legal_documents instead of hardcoding it, so the next version bump cannot desync it again. That is the actual fix — updating the literal to 'v1.0' would have worked until the next publish. 2. Two of the three accounts auth.setup.ts uses were not in this seed. [email protected] and [email protected] had a name but no address, no user_types and no industry_id, so they failed the prerequisites check on three counts and landed on /onboarding. Both are now seeded in steps 2, 3 and 4 alongside the existing demo users. Verified rather than assumed: - 9/9 demo accounts pass every gate the prerequisites check applies. - GET /v1/prerequisites/check returns isComplete=true, needsOnboarding=false, needsLegalAcceptance=false. - The Playwright setup project goes from 1 passed / 1 failed / 1 flaky to 3 passed, producing admin.json, user.json and super-admin.json. - Specs now reach the app rather than the marketing page. The office kanban spec still cannot be added to testMatch, for a third reason that is not this one: ApplicationsKanbanBoard renders no testID, data-testid or nativeID anywhere, while kanban-helpers.ts waits on [data-column], [data-status] and kanban-column-*. Those selectors match nothing in the implementation, so the spec cannot pass on any data. Filed separately; the comment in playwright.config.ts says so.
18 of 23 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #575.
Two problems. The first affected every demo account, not just the e2e ones.
1. The legal versions were hardcoded and had gone silently stale
The seed wrote
privacy_policy_version = '1.0'/terms_of_service_version = '1.0'. Migration 342 later madecore.legal_documentsthe source of truth and publishes'v1.0'. The check is a string equality:'1.0' !== 'v1.0', so every demo user has been legally stale since 342 landed — past/onboarding, bounced to/legal-update. That is why loadingtests/.auth/super-admin.jsonand navigating to/office/applicationsproduced the public marketing page.The seed now reads the version from
core.legal_documentsrather than hardcoding it. Updating the literal to'v1.0'would have worked until the next publish; deriving it means the next bump cannot desync the seed again.2. Two of the three accounts
auth.setup.tsuses were not in this seed[email protected]and[email protected]had a name but no address, nouser_typesand noindustry_id— failing the prerequisites check on three counts and landing on/onboarding. Both are now seeded alongside the existing demo users in steps 2, 3 and 4.Verified, not assumed
GET /v1/prerequisites/checkisComplete=true,needsOnboarding=false,needsLegalAcceptance=falseadmin.json,user.json,super-admin.json— all threeThere is a third blocker, and it is not this one
The office kanban spec still cannot go into
testMatch. Now that auth works I ran it, and it fails on selectors:ApplicationsKanbanBoardrenders notestID,data-testidornativeIDanywhere, whilekanban-helpers.tswaits on[data-column="new"],[data-status="new"]andkanban-column-new. Those match nothing in the implementation, so the spec cannot pass on any data. The comment inplaywright.config.tsrecords that, and it is filed separately.This is the same shape as the rest of the #539 epic: ~30 tests and a helper library written against an implementation they were never run against.