1
1
import { test } from '@playwright/test' ;
2
2
import { NewtabPage } from '../../../integration-tests/new-tab.page.js' ;
3
3
import { OmnibarPage } from './omnibar.page.js' ;
4
+ import { CustomizerPage } from '../../customizer/integration-tests/customizer.page.js' ;
4
5
5
6
test . describe ( 'omnibar widget persistence' , ( ) => {
6
7
test ( 'remembers input across tabs' , async ( { page } , workerInfo ) => {
@@ -11,14 +12,14 @@ test.describe('omnibar widget persistence', () => {
11
12
await omnibar . ready ( ) ;
12
13
13
14
// first fill
14
- await omnibar . input ( { mode : 'search' , value : 'shoes' } ) ;
15
+ await omnibar . types ( { mode : 'search' , value : 'shoes' } ) ;
15
16
16
17
// switch
17
18
await omnibar . didSwitchToTab ( '02' , [ '01' , '02' ] ) ;
18
19
await omnibar . expectInputValue ( '' ) ;
19
20
20
21
// second fill
21
- await omnibar . input ( { mode : 'search' , value : 'dresses' } ) ;
22
+ await omnibar . types ( { mode : 'search' , value : 'dresses' } ) ;
22
23
23
24
// back to first
24
25
await omnibar . didSwitchToTab ( '01' , [ '01' , '02' ] ) ;
@@ -36,7 +37,7 @@ test.describe('omnibar widget persistence', () => {
36
37
await omnibar . ready ( ) ;
37
38
38
39
// first fill
39
- await omnibar . input ( { mode : 'search' , value : 'shoes' } ) ;
40
+ await omnibar . types ( { mode : 'search' , value : 'shoes' } ) ;
40
41
await page . getByRole ( 'tab' , { name : 'Duck.ai' } ) . click ( ) ;
41
42
42
43
// new tab, should be opened with duck.ai input still visible
@@ -47,4 +48,29 @@ test.describe('omnibar widget persistence', () => {
47
48
await omnibar . didSwitchToTab ( '01' , [ '01' , '02' ] ) ;
48
49
await omnibar . expectChatValue ( 'shoes' ) ;
49
50
} ) ;
51
+ test ( 'adjusts mode of other tabs when duck.ai is disabled' , async ( { page } , workerInfo ) => {
52
+ const ntp = NewtabPage . create ( page , workerInfo ) ;
53
+ const omnibar = new OmnibarPage ( ntp ) ;
54
+ const customizer = new CustomizerPage ( ntp ) ;
55
+ await ntp . reducedMotion ( ) ;
56
+ await ntp . openPage ( { additional : { omnibar : true , tabs : true , 'tabs.debug' : true } } ) ;
57
+ await omnibar . ready ( ) ;
58
+
59
+ // first tab, switch to ai mode
60
+ await omnibar . switchMode ( { mode : 'ai' } ) ;
61
+
62
+ // switch to second tab, should be empty but still on duck.ai
63
+ await omnibar . didSwitchToTab ( '02' , [ '01' , '02' ] ) ;
64
+ await omnibar . expectValue ( { value : '' , mode : 'ai' } ) ;
65
+ await omnibar . types ( { value : 'shoes' , mode : 'ai' } ) ;
66
+
67
+ // now turn duck.ai off, 'shoes' should remain, but on search mode
68
+ await customizer . opensCustomizer ( ) ;
69
+ await omnibar . toggleDuckAiButton ( ) . uncheck ( ) ;
70
+ await omnibar . expectValue ( { value : 'shoes' , mode : 'search' } ) ;
71
+
72
+ // back to first tab, should be empty + search
73
+ await omnibar . didSwitchToTab ( '01' , [ '01' , '02' ] ) ;
74
+ await omnibar . expectValue ( { value : '' , mode : 'search' } ) ;
75
+ } ) ;
50
76
} ) ;
0 commit comments