@@ -15,8 +15,9 @@ function stubApi(page: Page, state: { genres: string[] }) {
1515 page . route ( '**/v2/**' , ( r ) => r . fulfill ( { json : [ ] } ) ) ,
1616 page . route ( '**/v2/Settings' , ( r ) =>
1717 r . fulfill ( {
18- json : { apiKey : '' , metronConfigured : false , discoveryGenres : state . genres , syncedIndexers : [ ] , downloadClients : [ ] } ,
18+ json : { apiKey : '' , metronConfigured : false , discoveryGenres : state . genres , discoveryFeeds : [ 'manga' ] , syncedIndexers : [ ] , downloadClients : [ ] } ,
1919 } ) ) ,
20+ page . route ( '**/v2/Discover/Genres' , ( r ) => r . fulfill ( { json : [ 'Action' , 'Horror' , 'Romance' , 'Sci-Fi' , 'Thriller' ] } ) ) ,
2021 page . route ( '**/v2/Settings/DiscoveryGenres' , async ( r ) => {
2122 state . genres = r . request ( ) . postDataJSON ( ) as string [ ] ;
2223 return r . fulfill ( { json : { } } ) ;
@@ -27,38 +28,36 @@ function stubApi(page: Page, state: { genres: string[] }) {
2728 ] ) ;
2829}
2930
30- test ( 'editing discovery genres updates the rails on the next Discover visit' , async ( { page } ) => {
31+ test ( 'picking a genre updates the rails on the next Discover visit' , async ( { page } ) => {
3132 const state = { genres : [ 'Action' ] } ;
3233 await stubApi ( page , state ) ;
3334
3435 await page . goto ( '/discover' ) ;
3536 await expect ( page . getByText ( 'Sakamoto Days' ) ) . toBeVisible ( ) ;
3637
37- // Edit genres on the settings page (SPA navigation, warm caches). Committing a tag saves it .
38+ // Edit genres on the settings page (SPA navigation, warm caches). Picking a genre auto- saves.
3839 await page . getByRole ( 'link' , { name : 'Settings' } ) . first ( ) . click ( ) ;
3940 await page . getByRole ( 'tab' , { name : 'Discovery' } ) . click ( ) ;
40- const tags = page . getByPlaceholder ( 'Add a genre…' ) ;
41- await tags . click ( ) ;
42- await tags . fill ( 'Horror' ) ;
43- await tags . press ( 'Enter' ) ;
41+ await page . getByRole ( 'button' , { name : 'Show popup' } ) . click ( ) ;
42+ await page . getByRole ( 'option' , { name : 'Horror' , exact : true } ) . click ( ) ;
4443 await expect . poll ( ( ) => state . genres ) . toEqual ( [ 'Action' , 'Horror' ] ) ;
4544
4645 // Back to Discover the way a user would — through the nav, not a reload.
46+ await page . keyboard . press ( 'Escape' ) ;
4747 await page . getByRole ( 'link' , { name : 'Discover' } ) . first ( ) . click ( ) ;
4848 await expect ( page . getByText ( 'Uzumaki' ) ) . toBeVisible ( ) ;
4949} ) ;
5050
51- test ( 'a genre typed but not committed with Enter is still saved ' , async ( { page } ) => {
51+ test ( 'the genre list offers only AniList genres — no free-text like "Gore" ' , async ( { page } ) => {
5252 const state = { genres : [ 'Action' ] } ;
5353 await stubApi ( page , state ) ;
5454
5555 await page . goto ( '/settings' ) ;
5656 await page . getByRole ( 'tab' , { name : 'Discovery' } ) . click ( ) ;
57- const tags = page . getByPlaceholder ( 'Add a genre…' ) ;
58- await tags . click ( ) ;
59- await tags . fill ( 'Horror' ) ;
60- // No Enter — the user types it and moves on, expecting it to count.
61- await tags . press ( 'Tab' ) ;
57+ await page . getByRole ( 'button' , { name : 'Show popup' } ) . click ( ) ;
6258
63- await expect . poll ( ( ) => state . genres ) . toEqual ( [ 'Action' , 'Horror' ] ) ;
59+ // The valid genres are offered; an unsupported genre simply isn't in the list to pick.
60+ await expect ( page . getByRole ( 'option' , { name : 'Horror' , exact : true } ) ) . toBeVisible ( ) ;
61+ await expect ( page . getByRole ( 'option' , { name : 'Gore' , exact : true } ) ) . toHaveCount ( 0 ) ;
62+ expect ( state . genres ) . toEqual ( [ 'Action' ] ) ;
6463} ) ;
0 commit comments