1+ import { test , expect } from "@playwright/test" ;
2+ import App from "../support/app" ;
3+
4+ const TEXT_NOTE_TITLE = "Text notes" ;
5+ const CODE_NOTE_TITLE = "Code notes" ;
6+
7+ test ( "Open the note in the correct split pane" , async ( { page, context } ) => {
8+ const app = new App ( page , context ) ;
9+ await app . goto ( ) ;
10+ await app . closeAllTabs ( ) ;
11+
12+ // Open the first split.
13+ await app . goToNoteInNewTab ( TEXT_NOTE_TITLE ) ;
14+ const split1 = app . currentNoteSplit ;
15+
16+ // Create a new split.
17+ const splitButton = split1 . locator ( "button.bx-dock-right" ) ;
18+ await expect ( splitButton ) . toBeVisible ( ) ;
19+ await splitButton . click ( ) ;
20+
21+ // Search for "Code notes" in the empty area of the second split.
22+ const split2 = app . currentNoteSplit . nth ( 1 ) ; ;
23+ await expect ( split2 ) . toBeVisible ( ) ;
24+ const autocomplete = split2 . locator ( ".note-autocomplete" ) ;
25+ await autocomplete . fill ( CODE_NOTE_TITLE ) ;
26+ const resultsSelector = split2 . locator ( ".note-detail-empty-results" ) ;
27+ await expect ( resultsSelector ) . toContainText ( CODE_NOTE_TITLE ) ;
28+
29+ //Focus on the first split.
30+ const noteContent = split1 . locator ( ".note-detail-editable-text-editor" ) ;
31+ await expect ( noteContent . locator ( "p" ) ) . toBeVisible ( ) ;
32+ await noteContent . focus ( ) ;
33+
34+ // Click the search result in the second split.
35+ await resultsSelector . locator ( ".aa-suggestion" , { hasText : CODE_NOTE_TITLE } )
36+ . nth ( 1 ) . click ( ) ;
37+
38+ await expect ( split2 ) . toContainText ( CODE_NOTE_TITLE ) ;
39+ } ) ;
40+
41+ test ( "Can directly focus the autocomplete input within the split" , async ( { page, context } ) => {
42+ const app = new App ( page , context ) ;
43+ await app . goto ( ) ;
44+ await app . closeAllTabs ( ) ;
45+
46+ // Open the first split.
47+ await app . goToNoteInNewTab ( TEXT_NOTE_TITLE ) ;
48+ const split1 = app . currentNoteSplit ;
49+
50+ // Create a new split.
51+ const splitButton = split1 . locator ( "button.bx-dock-right" ) ;
52+ await expect ( splitButton ) . toBeVisible ( ) ;
53+ await splitButton . click ( ) ;
54+
55+ // Search for "Code notes" in the empty area of the second split.
56+ const split2 = app . currentNoteSplit . nth ( 1 ) ; ;
57+ await expect ( split2 ) . toBeVisible ( ) ;
58+
59+ // Focus the first split.
60+ const noteContent = split1 . locator ( ".note-detail-editable-text-editor" ) ;
61+ await expect ( noteContent . locator ( "p" ) ) . toBeVisible ( ) ;
62+ await noteContent . focus ( ) ;
63+ await noteContent . click ( ) ;
64+
65+ // click the autocomplete input box of the second split
66+ const autocomplete = split2 . locator ( ".note-autocomplete" ) ;
67+ await autocomplete . focus ( ) ;
68+ await autocomplete . click ( ) ;
69+
70+ await page . waitForTimeout ( 100 ) ;
71+ await expect ( autocomplete ) . toBeFocused ( ) ;
72+ } ) ;
0 commit comments