77 "path"
88 "path/filepath"
99
10+ "errors"
1011 "strings"
1112 "time"
1213
@@ -15,7 +16,7 @@ import (
1516
1617 "github.com/go-rod/rod/lib/launcher"
1718 "github.com/go-rod/rod/lib/proto"
18- "github.com/go-rod/rod/lib/utils"
19+ "github.com/go-rod/rod/lib/utils"
1920
2021 "github.com/sirupsen/logrus"
2122)
@@ -105,7 +106,10 @@ func main() {
105106 }
106107 logrus .Info ("Cluster installation started successfully." )
107108
108- waitForClusterConsoleLink (page , filepath .Join (screenshotPath , "09-installation-progress.png" ))
109+ err = waitForClusterConsoleLink (page , filepath .Join (screenshotPath , "09-installation-progress.png" ))
110+ if err != nil {
111+ log .Fatalf ("%v" , err )
112+ }
109113}
110114
111115func clusterDetails (page * rod.Page , path string ) error {
@@ -215,13 +219,14 @@ func startInstallation(page *rod.Page, client *resty.Client, path string) error
215219
216220func waitForClusterConsoleLink (page * rod.Page , path string ) error {
217221 for {
218- failMsg , _ := page .Timeout (5 * time .Second ).ElementR ("div.pf-v5-c-empty-state__body " , `Failed on` )
222+ failMsg , _ := page .Timeout (5 * time .Second ).ElementR ("#cluster-progress-status-value " , `Failed on` )
219223 if failMsg != nil {
220- logrus .Error ("Cluster installation failed." )
221- if err := saveFullPageScreenshot (page , path ); err != nil {
222- return err
224+ if visible , _ := failMsg .Visible (); visible {
225+ if err := saveFullPageScreenshot (page , path ); err != nil {
226+ return err
227+ }
228+ return errors .New ("cluster installation failed" )
223229 }
224- return fmt .Errorf ("cluster installation failed" )
225230 }
226231
227232 consoleURL , _ := page .Timeout (5 * time .Second ).ElementR ("button.pf-v5-c-button" , `https://console-openshift-console.apps.abi-ove-isobuilder.redhat.com` )
0 commit comments