@@ -13,7 +13,8 @@ const recipe: WorkspaceRecipe = {
1313 startupProbes : [
1414 { name : "database" , type : "wp-cli" , command : "option get siteurl" , metadata : { role : "readiness" } } ,
1515 { name : "bootstrap" , type : "php" , code : "echo 'ready';" } ,
16- { name : "homepage" , type : "http" , url : "/" } ,
16+ { name : "homepage" , type : "browser" , url : "/" } ,
17+ { name : "api" , type : "http" , url : "/wp-json/" , expectStatus : 200 } ,
1718 ] ,
1819 } ,
1920 workflow : { steps : [ { command : "wordpress.run-php" , args : [ "code=echo 'workload';" ] } ] } ,
@@ -22,6 +23,7 @@ const recipe: WorkspaceRecipe = {
2223const policy = recipePolicy ( recipe )
2324assert . ok ( policy . commands . includes ( "wordpress.wp-cli" ) , "wp-cli startup probes are policy-visible" )
2425assert . ok ( policy . commands . includes ( "wordpress.run-php" ) , "php startup probes are policy-visible" )
26+ assert . ok ( policy . commands . includes ( "wordpress.browser-probe" ) , "browser startup probes are policy-visible" )
2527
2628const executed : Array < { command : string ; args : string [ ] } > = [ ]
2729const runtime = {
@@ -46,14 +48,20 @@ const results = await runDistributionStartupProbes(recipe, runtime, executions)
4648assert . deepEqual ( executed , [
4749 { command : "wordpress.wp-cli" , args : [ "command=option get siteurl" ] } ,
4850 { command : "wordpress.run-php" , args : [ "code=echo 'ready';" ] } ,
51+ { command : "wordpress.browser-probe" , args : [ "url=/" ] } ,
4952] )
50- assert . equal ( executions . length , 2 )
53+ assert . equal ( executions . length , 3 )
5154assert . deepEqual ( results . map ( ( result ) => [ result . name , result . type , result . status ] ) , [
5255 [ "database" , "wp-cli" , "passed" ] ,
5356 [ "bootstrap" , "php" , "passed" ] ,
54- [ "homepage" , "http" , "skipped" ] ,
57+ [ "homepage" , "browser" , "passed" ] ,
58+ [ "api" , "http" , "skipped" ] ,
5559] )
5660assert . equal ( results [ 0 ] ?. metadata ?. role , "readiness" )
61+ assert . equal ( results [ 3 ] ?. missingCommand , "wordpress.http-request" )
62+ assert . equal ( results [ 3 ] ?. url , "/wp-json/" )
63+ assert . equal ( results [ 3 ] ?. expectStatus , 200 )
64+ assert . deepEqual ( results [ 3 ] ?. availableCommands , [ "wordpress.rest-request" , "wordpress.browser-probe" ] )
5765assert . equal ( distributionStartupProbeFailure ( results ) , undefined )
5866
5967const summary = normalizeRecipeRunSummary ( {
0 commit comments