@@ -1070,11 +1070,14 @@ async function executeEditorActionStep(page: import("playwright").Page, step: Ed
10701070 return { state : await page . evaluate ( ( ) => {
10711071 const wpData = ( window as unknown as { wp ?: { data ?: { select ?: ( store : string ) => Record < string , unknown > } } } ) . wp ?. data
10721072 const select = wpData ?. select
1073- if ( ! select ) {
1073+ if ( typeof select !== "function" ) {
10741074 return { storesAvailable : false }
10751075 }
10761076 const editor = select ( "core/editor" )
10771077 const blockEditor = select ( "core/block-editor" )
1078+ if ( ! editor || ! blockEditor ) {
1079+ return { storesAvailable : false }
1080+ }
10781081 const currentPost = typeof editor . getCurrentPost === "function" ? editor . getCurrentPost ( ) as Record < string , unknown > | null : null
10791082 const blocks = typeof blockEditor . getBlocks === "function" ? blockEditor . getBlocks ( ) as Array < Record < string , unknown > > : [ ]
10801083 return {
@@ -1147,6 +1150,9 @@ async function saveEditorPost(page: import("playwright").Page, step: Extract<Edi
11471150 const editor = select ( "core/editor" )
11481151 const blockEditor = dispatch ( "core/block-editor" )
11491152 const editorDispatch = dispatch ( "core/editor" )
1153+ if ( ! editor ) {
1154+ throw new Error ( "wp-codebox-editor-readiness-unavailable: core/editor store is unavailable" )
1155+ }
11501156 if ( typeof editorDispatch ?. savePost !== "function" ) {
11511157 throw new Error ( "wp-codebox-editor-save-unsupported: core/editor savePost is unavailable" )
11521158 }
@@ -1265,15 +1271,18 @@ interface EditorValidityArtifact {
12651271 summary : BrowserEditorValiditySummary
12661272}
12671273
1268- async function captureEditorState ( page : import ( "playwright" ) . Page , target : ReturnType < typeof editorOpenTargetFromArgs > ) : Promise < EditorStateSnapshot > {
1274+ export async function captureEditorState ( page : import ( "playwright" ) . Page , target : ReturnType < typeof editorOpenTargetFromArgs > ) : Promise < EditorStateSnapshot > {
12691275 const state = await page . evaluate ( ( ) => {
12701276 const wpData = ( window as unknown as { wp ?: { data ?: { select ?: ( store : string ) => Record < string , unknown > } } } ) . wp ?. data
12711277 const select = wpData ?. select
1272- if ( ! select ) {
1278+ if ( typeof select !== "function" ) {
12731279 return { storesAvailable : false }
12741280 }
12751281 const editor = select ( "core/editor" )
12761282 const blockEditor = select ( "core/block-editor" )
1283+ if ( ! editor || ! blockEditor ) {
1284+ return { storesAvailable : false }
1285+ }
12771286 const currentPost = typeof editor . getCurrentPost === "function" ? editor . getCurrentPost ( ) as Record < string , unknown > | null : null
12781287 const blocks = typeof blockEditor . getBlocks === "function" ? blockEditor . getBlocks ( ) as Array < Record < string , unknown > > : [ ]
12791288 return {
0 commit comments