mirror of
https://github.com/jcreek/LivingDexTracker.git
synced 2026-09-15 10:02:41 +00:00
test: replace ad-hoc tests with a layered suite and CI workflow
Splits testing into five layers so a failure points at the responsible one: - tests/unit isolated utility, repository and service tests - tests/data validates the tracked Pokémon, game, region and dex files - tests/integration schema, views, constraints, RLS and repositories - tests/bdd executable Gherkin for user-visible behaviour - tests/build service worker and manifest artifacts per build variant Replaces the two Playwright specs in client-test/ and the two Vitest files in test/. Adds a GitHub Actions workflow running the layers as separate jobs, a mock OAuth provider server so the Drive and Dropbox scenarios never touch real accounts, and a wrapper that reads the local Supabase keys from `supabase status` rather than hard-coding them. Extracts the pure formatting helpers out of PokedexExportService so they can be unit tested, and makes the provider endpoints configurable so the mock server can stand in for Google and Dropbox.
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
Feature: Account access
|
||||
As a trainer
|
||||
I want secure access to my account
|
||||
So that only I can update my collection
|
||||
|
||||
Scenario: Register a new account
|
||||
Given I am a new visitor
|
||||
When I register with valid account details
|
||||
Then I am told to confirm my email
|
||||
And a confirmation email is captured locally
|
||||
|
||||
Scenario: Sign in with valid credentials
|
||||
Given I have a confirmed account
|
||||
When I sign in with my credentials
|
||||
Then I arrive at my Pokédex list
|
||||
|
||||
Scenario: Reject invalid credentials
|
||||
Given I have a confirmed account
|
||||
When I sign in with an incorrect password
|
||||
Then I see a sign-in error
|
||||
|
||||
Scenario: Redirect an authenticated visitor
|
||||
Given I am signed in
|
||||
When I visit the public home page
|
||||
Then I arrive at my Pokédex list
|
||||
|
||||
Scenario: Sign out
|
||||
Given I am signed in
|
||||
When I sign out
|
||||
Then I return to the public home page
|
||||
|
||||
Scenario: Request a password reset
|
||||
Given I have a confirmed account
|
||||
When I request a password reset
|
||||
Then a password reset email is captured locally
|
||||
|
||||
@product-review
|
||||
Scenario: Reject mismatched replacement passwords
|
||||
Given I am on the password reset page with a recovery session
|
||||
When I enter two different replacement passwords
|
||||
Then I am told that the passwords do not match
|
||||
|
||||
Scenario: Complete a password reset
|
||||
Given I am on the password reset page with a recovery session
|
||||
When I enter a valid replacement password
|
||||
Then I am told that my password was updated
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
Feature: Backup and export
|
||||
As a trainer
|
||||
I want changes exported to my connected storage
|
||||
So that I retain a portable backup
|
||||
|
||||
Background:
|
||||
Given I am signed in
|
||||
|
||||
Scenario: Show disconnected backup providers
|
||||
When I visit backup settings
|
||||
Then Google Drive and Dropbox are shown as not connected
|
||||
|
||||
Scenario Outline: Connect a backup provider
|
||||
When I connect the mocked "<provider>" provider
|
||||
Then "<provider>" is shown as connected
|
||||
|
||||
Examples:
|
||||
| provider |
|
||||
| Google Drive |
|
||||
| Dropbox |
|
||||
|
||||
Scenario: Reject an invalid OAuth state
|
||||
When a mocked OAuth callback has an invalid state
|
||||
Then the backup connection is rejected
|
||||
|
||||
Scenario: Export escaped catch data without losing the update
|
||||
Given Google Drive is connected to the mocked provider
|
||||
And I have a Living Dex named "Quoted, Dex"
|
||||
When I save a catch note containing a comma and quote
|
||||
Then the mocked provider receives a valid escaped CSV
|
||||
And the catch update remains saved
|
||||
|
||||
Scenario: Refresh an expired provider token
|
||||
Given Dropbox is connected with an expired token
|
||||
When an export is requested
|
||||
Then the token is refreshed before the mocked upload
|
||||
|
||||
Scenario: Record provider failure without losing progress
|
||||
Given Google Drive is connected to a failing mocked provider
|
||||
When I update collection progress
|
||||
Then the catch update remains saved
|
||||
And the provider failure is shown in backup settings
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
Feature: Pokédex composition
|
||||
As a trainer
|
||||
I want the correct Pokémon in each configured dex
|
||||
So that completion totals are trustworthy
|
||||
|
||||
Background:
|
||||
Given I am signed in
|
||||
|
||||
Scenario: Build a national Living Dex from canonical forms
|
||||
Given I have a Living Dex named "National"
|
||||
When I inspect its entries without forms
|
||||
Then it contains 1025 unique species
|
||||
And named default forms are represented once
|
||||
|
||||
Scenario: Include all supported forms
|
||||
Given I have a Form Dex named "Forms"
|
||||
When I inspect its entries with forms
|
||||
Then every entry identity is unique
|
||||
And Basculin has 3 forms
|
||||
And Alcremie has 63 forms
|
||||
And Unown has 28 forms
|
||||
|
||||
Scenario: Render shiny artwork
|
||||
Given I have a Shiny Dex named "Shinies"
|
||||
When I view the Pokédex
|
||||
Then its Pokémon use shiny sprites
|
||||
|
||||
Scenario: Respect game and dex scope
|
||||
Given I have a Form Dex named "Black Forms" scoped to game "Black" and dex "Unova"
|
||||
When I inspect its entries with forms
|
||||
Then Rotom includes its named default form without duplicate forms
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
Feature: Pokédex lifecycle
|
||||
As a trainer
|
||||
I want to configure and manage Pokédexes
|
||||
So that each collection matches my goal
|
||||
|
||||
Background:
|
||||
Given I am signed in
|
||||
|
||||
Scenario: See the empty state
|
||||
Given I have no Pokédexes
|
||||
When I visit my Pokédex list
|
||||
Then I see the empty Pokédex message
|
||||
|
||||
Scenario: Validate a new Pokédex
|
||||
When I open the new Pokédex form
|
||||
Then I cannot create a Pokédex without a name and type
|
||||
|
||||
Scenario Outline: Create each supported Pokédex type
|
||||
When I create a Pokédex named "<name>" of type "<type>"
|
||||
Then the Pokédex "<name>" is available to view
|
||||
|
||||
Examples:
|
||||
| name | type |
|
||||
| Living | Living Dex |
|
||||
| Shiny | Shiny Dex |
|
||||
| Origin | Origin Dex |
|
||||
| Every Form | Form Dex |
|
||||
|
||||
Scenario: Create a game and dex scoped Pokédex
|
||||
When I create a Living Dex named "Black Regional" scoped to game "Black" and dex "Unova"
|
||||
Then the Pokédex "Black Regional" is available to view
|
||||
|
||||
Scenario: Reject a duplicate name
|
||||
Given I have a Living Dex named "My Collection"
|
||||
When I try to create another Living Dex named "My Collection"
|
||||
Then I am told that the Pokédex name is already used
|
||||
|
||||
Scenario: Edit a Pokédex
|
||||
Given I have a Living Dex named "Before Editing"
|
||||
When I rename it to "After Editing" and enable forms
|
||||
Then the Pokédex "After Editing" is available to view
|
||||
|
||||
Scenario: Cancel deleting a Pokédex
|
||||
Given I have a Living Dex named "Keep Me"
|
||||
When I cancel deleting "Keep Me"
|
||||
Then the Pokédex "Keep Me" is available to view
|
||||
|
||||
Scenario: Delete a Pokédex
|
||||
Given I have a Living Dex named "Delete Me"
|
||||
When I confirm deleting "Delete Me"
|
||||
Then the Pokédex "Delete Me" is no longer listed
|
||||
|
||||
Scenario: Keep another user's Pokédex private
|
||||
Given another trainer has a Pokédex
|
||||
When I request the other trainer's Pokédex
|
||||
Then the Pokédex is not disclosed
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
Feature: Progress tracking
|
||||
As a trainer
|
||||
I want to record collection state
|
||||
So that my Pokédex shows what remains
|
||||
|
||||
Background:
|
||||
Given I am signed in
|
||||
And I have a Living Dex named "Progress"
|
||||
And I view the Pokédex
|
||||
|
||||
Scenario: Mark a Pokémon caught
|
||||
When I mark the first Pokémon as caught
|
||||
Then the first Pokémon is shown as caught after reloading
|
||||
|
||||
Scenario: Keep caught and needs-to-evolve mutually exclusive
|
||||
When I mark the first Pokémon as caught
|
||||
And I mark the first Pokémon as needing evolution
|
||||
Then the first Pokémon needs evolution and is not marked caught
|
||||
|
||||
Scenario: Record HOME state and notes
|
||||
When I mark the first Pokémon as in HOME
|
||||
And I add the note "Caught, traded, and checked" to the first Pokémon
|
||||
Then its HOME state and note persist after reloading
|
||||
|
||||
Scenario: Update an entire box
|
||||
When I mark box 1 as caught
|
||||
Then box 1 contains 30 caught Pokémon
|
||||
|
||||
Scenario: Filter collection progress
|
||||
When I mark the first Pokémon as caught
|
||||
And I filter to Pokémon that are not caught
|
||||
Then the caught Pokémon is filtered out
|
||||
|
||||
Scenario: Remember box layout density
|
||||
When I select the "Compact" box layout
|
||||
And I reload the Pokédex
|
||||
Then the "Compact" box layout remains selected
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
Feature: Offline-friendly application
|
||||
As a trainer
|
||||
I want the installed site to survive network loss
|
||||
So that I can consult my collection anywhere
|
||||
|
||||
Scenario: Register the service worker
|
||||
When I open the built application
|
||||
Then a service worker controls the page
|
||||
And the application cache is present
|
||||
|
||||
Scenario: Navigate while offline
|
||||
Given I have opened the built application online
|
||||
When I go offline and revisit the home page with a trailing slash
|
||||
Then the application remains available
|
||||
|
||||
Scenario: Restore network access
|
||||
Given I have opened the built application online
|
||||
When I go offline and then return online
|
||||
Then the application remains available
|
||||
Reference in New Issue
Block a user