@@ -5,6 +5,8 @@ import { Page } from "playwright";
55import { SmokeTestLogger } from "./helper/smokeTestLogger" ;
66import { app , screenshots } from "./main" ;
77import * as assert from "assert" ;
8+ import { ElementHelper } from "./helper/elementHelper" ;
9+ import { Element } from "./helper/constants" ;
810
911export function startCommandPaletteTests ( ) : void {
1012 describe ( "CommandPaletteTest" , ( ) => {
@@ -40,19 +42,20 @@ export function startCommandPaletteTests(): void {
4042 afterEach ( dispose ) ;
4143
4244 it ( "Verify react native command is visible in command palette" , async ( ) => {
43- const page = await initApp ( ) ;
45+ const text = "React Native: Start Packager" ;
46+ await initApp ( ) ;
4447
45- const cmdKey = process . platform === "darwin" ? "Meta" : "Control" ;
46- await page . keyboard . press ( `${ cmdKey } +Shift+P` ) ;
47- await page . waitForSelector ( ".quick-input-widget" , { timeout : 10000 } ) ;
48+ await ElementHelper . openCommandPalette ( ) ;
49+ await ElementHelper . WaitElementClassNameVisible ( Element . commandPaletteClassName , 5000 ) ;
4850
49- await page . keyboard . type ( "React Native: Start Packager" ) ;
50- const option = await page . waitForSelector ( "#quickInput_list .monaco-list-row.focused" , {
51- timeout : 30000 ,
52- } ) ;
51+ await ElementHelper . inputText ( text ) ;
52+ const option = await ElementHelper . WaitElementSelectorVisible (
53+ Element . commandPaletteFocusedItemSelector ,
54+ 5000 ,
55+ ) ;
5356
5457 const value = await option . getAttribute ( "aria-label" ) ;
55- assert . ok ( value ?. includes ( "React Native: Start Packager" ) ) ;
58+ assert . ok ( value ?. includes ( text ) ) ;
5659 } ) ;
5760 } ) ;
5861}
0 commit comments