@@ -16,7 +16,7 @@ const suite = createControlUiE2eSuite({
1616const captureProof = process . env . OPENCLAW_CAPTURE_UI_PROOF === "1" ;
1717
1818suite . define ( ( ) => {
19- it ( "locks update policy while an automatic apply runs and reports its terminal failure " , async ( ) => {
19+ it ( "locks update policy while an automatic apply runs and shows readable recovery guidance " , async ( ) => {
2020 const artifactDir = captureProof
2121 ? createControlUiE2eArtifactDir ( "updates-automatic-lifecycle" )
2222 : null ;
@@ -56,6 +56,7 @@ suite.define(() => {
5656 expect ( ( await page . goto ( `${ suite . server . baseUrl } settings/updates` ) ) ?. status ( ) ) . toBe ( 200 ) ;
5757 await gateway . waitForRequest ( "update.status" ) ;
5858 const policy = page . getByRole ( "switch" , { name : "Automatic updates" } ) ;
59+ const checks = page . getByRole ( "switch" , { name : "Check for updates" } ) ;
5960 await policy . waitFor ( ) ;
6061 await expect . poll ( ( ) => policy . isDisabled ( ) ) . toBe ( false ) ;
6162
@@ -84,6 +85,7 @@ suite.define(() => {
8485 }
8586 expect ( await status . textContent ( ) ) . toContain ( "Applying update" ) ;
8687 expect ( await policy . isDisabled ( ) ) . toBe ( true ) ;
88+ expect ( await checks . isDisabled ( ) ) . toBe ( true ) ;
8789 expect ( await page . locator ( "wa-radio-group" ) . getAttribute ( "disabled" ) ) . not . toBeNull ( ) ;
8890 expect (
8991 await page . getByRole ( "button" , { name : "Updating…" , exact : true } ) . isDisabled ( ) ,
@@ -92,28 +94,50 @@ suite.define(() => {
9294 await gateway . setMethodResponse ( "update.status" , {
9395 sentinel : {
9496 kind : "update" ,
95- status : "error " ,
97+ status : "skipped " ,
9698 ts : now ,
97- stats : { mode : "npm" , reason : "global-install-failed " } ,
99+ stats : { mode : "npm" , reason : "managed-service-handoff-unavailable " } ,
98100 } ,
99101 schedule,
100102 } ) ;
101103 await gateway . emitGatewayEvent ( "update.available" , { schedule } ) ;
102- await status . filter ( { hasText : "global-install-failed " } ) . waitFor ( ) ;
104+ await status . filter ( { hasText : "Stop the foreground Gateway " } ) . waitFor ( ) ;
103105 expect ( await policy . isDisabled ( ) ) . toBe ( false ) ;
106+ expect ( await checks . isDisabled ( ) ) . toBe ( false ) ;
104107 expect ( await gateway . getRequests ( "update.run" ) ) . toHaveLength ( 0 ) ;
108+ await status . scrollIntoViewIfNeeded ( ) ;
105109 if ( artifactDir ) {
106110 await page . screenshot ( {
107111 animations : "disabled" ,
108112 fullPage : true ,
109- path : path . join ( artifactDir , "02-automatic-failure .png" ) ,
113+ path : path . join ( artifactDir , "02-automatic-recovery .png" ) ,
110114 } ) ;
111115 }
116+ const geometry = await status . evaluate ( ( element ) => {
117+ const row = element . closest ( ".settings-row" ) ;
118+ const title = row ?. querySelector ( ".settings-row__title" ) ;
119+ if ( ! row || ! title ) {
120+ throw new Error ( "Missing update status row or title" ) ;
121+ }
122+ const bounds = element . getBoundingClientRect ( ) ;
123+ const rowBounds = row . getBoundingClientRect ( ) ;
124+ const titleBounds = title . getBoundingClientRect ( ) ;
125+ return {
126+ insideRow : bounds . left >= rowBounds . left && bounds . right <= rowBounds . right ,
127+ overlapsTitle :
128+ bounds . left < titleBounds . right &&
129+ bounds . right > titleBounds . left &&
130+ bounds . top < titleBounds . bottom &&
131+ bounds . bottom > titleBounds . top ,
132+ overflows : element . scrollWidth > element . clientWidth ,
133+ } ;
134+ } ) ;
135+ expect ( geometry ) . toEqual ( { insideRow : true , overlapsTitle : false , overflows : false } ) ;
112136 } ,
113137 ) ;
114138 } ) ;
115139
116- it ( "renders live campaign status without requesting config.schema " , async ( ) => {
140+ it ( "resumes disabled update checks through autosave and renders the live campaign " , async ( ) => {
117141 if ( captureProof ) {
118142 await mkdir ( path . join ( suite . artifactDir , "updates-settings" ) , { recursive : true } ) ;
119143 }
@@ -133,7 +157,9 @@ suite.define(() => {
133157 : { } ) ,
134158 } ,
135159 async ( { page } ) => {
136- const config = { update : { auto : { enabled : true } , channel : "stable" } } ;
160+ const config = {
161+ update : { auto : { enabled : true } , channel : "stable" , checkOnStart : false } ,
162+ } ;
137163 const gateway = await installMockGateway ( page , {
138164 featureMethods : [ "config.get" , "config.set" , "config.apply" , "update.run" ] ,
139165 methodResponses : {
@@ -158,6 +184,37 @@ suite.define(() => {
158184 await gateway . waitForRequest ( "config.get" ) ;
159185 expect ( await gateway . getRequests ( "config.schema" ) ) . toHaveLength ( 0 ) ;
160186
187+ const content = page . locator ( "#control-ui-main" ) ;
188+ await content . getByText ( "Updates" , { exact : true } ) . waitFor ( ) ;
189+ const checks = content . getByRole ( "switch" , { name : "Check for updates" , exact : true } ) ;
190+ const automatic = content . getByRole ( "switch" , { name : "Automatic updates" , exact : true } ) ;
191+ await expect . poll ( ( ) => automatic . isChecked ( ) ) . toBe ( true ) ;
192+ if ( captureProof ) {
193+ await page . screenshot ( {
194+ animations : "disabled" ,
195+ fullPage : true ,
196+ path : path . join (
197+ suite . artifactDir ,
198+ "updates-settings" ,
199+ "00-updates-checks-disabled.png" ,
200+ ) ,
201+ } ) ;
202+ }
203+ expect ( await checks . isChecked ( ) ) . toBe ( false ) ;
204+ expect ( await automatic . isDisabled ( ) ) . toBe ( true ) ;
205+ await content
206+ . locator ( ".settings-row__title" )
207+ . filter ( { hasText : / ^ C h e c k f o r u p d a t e s $ / } )
208+ . click ( ) ;
209+ const checksSaved = await gateway . waitForRequest ( "config.set" ) ;
210+ const checksRaw = ( checksSaved . params as { raw ?: unknown } ) . raw ;
211+ expect ( typeof checksRaw ) . toBe ( "string" ) ;
212+ expect ( JSON . parse ( String ( checksRaw ) ) ) . toMatchObject ( {
213+ update : { checkOnStart : true , channel : "stable" , auto : { enabled : true } } ,
214+ } ) ;
215+ await expect . poll ( ( ) => automatic . isDisabled ( ) ) . toBe ( false ) ;
216+ expect ( await automatic . isChecked ( ) ) . toBe ( true ) ;
217+
161218 await gateway . emitGatewayEvent ( "update.available" , {
162219 updateAvailable : {
163220 currentVersion : "2026.8.1" ,
@@ -180,8 +237,6 @@ suite.define(() => {
180237 } ,
181238 } ) ;
182239
183- const content = page . locator ( "#control-ui-main" ) ;
184- await content . getByText ( "Updates" , { exact : true } ) . waitFor ( ) ;
185240 const timer = content . locator ( "[role='timer']" ) ;
186241 await expect . poll ( ( ) => timer . textContent ( ) ) . toContain ( "Updating in 0:" ) ;
187242 const firstCountdown = await timer . textContent ( ) ;
@@ -200,8 +255,15 @@ suite.define(() => {
200255 } ) ;
201256 }
202257
258+ const writesBeforeChannelChange = ( await gateway . getRequests ( "config.set" ) ) . length ;
203259 await content . getByRole ( "radio" , { name : "Beta" , exact : true } ) . click ( ) ;
204- const configSet = await gateway . waitForRequest ( "config.set" ) ;
260+ await expect
261+ . poll ( async ( ) => ( await gateway . getRequests ( "config.set" ) ) . length )
262+ . toBe ( writesBeforeChannelChange + 1 ) ;
263+ const configSet = ( await gateway . getRequests ( "config.set" ) ) . at ( - 1 ) ;
264+ if ( ! configSet ) {
265+ throw new Error ( "Missing channel config write" ) ;
266+ }
205267 const raw = ( configSet . params as { raw ?: unknown } ) . raw ;
206268 expect ( typeof raw ) . toBe ( "string" ) ;
207269 expect ( JSON . parse ( String ( raw ) ) ) . toMatchObject ( { update : { channel : "beta" } } ) ;
@@ -249,6 +311,9 @@ suite.define(() => {
249311 expect ( await page . getByRole ( "switch" , { name : "Automatic updates" } ) . isDisabled ( ) ) . toBe (
250312 true ,
251313 ) ;
314+ expect ( await page . getByRole ( "switch" , { name : "Check for updates" } ) . isDisabled ( ) ) . toBe (
315+ true ,
316+ ) ;
252317 expect ( await page . getByRole ( "button" , { name : "Update now" } ) . isDisabled ( ) ) . toBe ( true ) ;
253318 expect ( await gateway . getRequests ( "config.schema" ) ) . toHaveLength ( 0 ) ;
254319
0 commit comments