Skip to content

Commit

Permalink
e2e: ux windows tray added pull secret window delay
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianriobo authored and anjannath committed Oct 4, 2021
1 parent c4e47c7 commit 83710d3
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions test/extended/crc/ux/tray/tray_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ const (
pullSecretWindowID string = "Pull Secret Picker"
pullSecretButtonOkID string = "OK"

elementClickTime time.Duration = 2 * time.Second
elementClickTime time.Duration = 2 * time.Second
pullSecretWindowDelayTime time.Duration = 8 * time.Second
)

var (
Expand Down Expand Up @@ -133,6 +134,10 @@ func (g gowinxHandler) ConnectClusterAsDeveloper() error {
func initialize() {
// Initialize context
ux.Initialize()
// Ensure clean desktop
if err := exec.Command("powershell.exe", "-c", "(New-Object", "-ComObject", "\"Shell.Application\").minimizeall()").Run(); err != nil {
logging.Error(err)
}
}

func finalize() {
Expand All @@ -143,6 +148,7 @@ func finalize() {
func click(action string) (err error) {
// Initialize base elements
initialize()
time.Sleep(elementClickTime)
_, err = clickOnContextMenu(action)
// Finalize context
finalize()
Expand Down Expand Up @@ -224,7 +230,11 @@ func connectClusterAs(connectedUser string) error {
return err
}
// Check user
return clicumber.CommandReturnShouldContain("oc whoami", connectedUser)
err = clicumber.ExecuteCommand("oc whoami")
if err != nil {
return err
}
return clicumber.CommandReturnShouldMatch("stdout", connectedUser)
}

func checkTrayShowsStatusValue(expectedValue string) (err error) {
Expand All @@ -246,12 +256,12 @@ func checkTrayShowsStatusValue(expectedValue string) (err error) {
}

func fillFullSecretField(pullSecretLocation string) error {
time.Sleep(elementClickTime)
// Get pull secret content
err := exec.Command("powershell.exe", "-c", "Get-Content", pullSecretLocation, "|", "Set-Clipboard").Run()
if err != nil {
return err
}
time.Sleep(pullSecretWindowDelayTime)
pullSecretWindow, err := ux.GetActiveElement(pullSecretWindowID, ux.WINDOW)
if err != nil {
logging.Infof("Pullsecret file already configured")
Expand Down

0 comments on commit 83710d3

Please sign in to comment.