From 96fe3bc32f3b2e4c14ee3efcff4d621ae0b7f45a Mon Sep 17 00:00:00 2001 From: Philip Hands Date: Sun, 22 May 2016 10:54:55 +0200 Subject: lvc: become much more patient --- cucumber/features/step_definitions/common_steps.rb | 127 +++++++++++---------- 1 file changed, 64 insertions(+), 63 deletions(-) diff --git a/cucumber/features/step_definitions/common_steps.rb b/cucumber/features/step_definitions/common_steps.rb index 987ac5a8..d8611195 100644 --- a/cucumber/features/step_definitions/common_steps.rb +++ b/cucumber/features/step_definitions/common_steps.rb @@ -266,15 +266,16 @@ end Given /^I boot to the d-i splash screen$/ do boot_timeout = 60 + @patience = 6 - @screen.wait("d-i8_bootsplash.png", boot_timeout) + @screen.wait("d-i8_bootsplash.png", boot_timeout * @patience) end Given /^I select ([a-z]*) mode and wait for the remote shell$/ do |ui_mode| sleep(20) # FIXME -- this should not be needed, but we'll try it for j.d.n's sake if "gui" == ui_mode @screen.type(Sikuli::Key.DOWN) - #@screen.wait("d-i_bootmenu_graphical.png", 10) + #@screen.wait("d-i_bootmenu_graphical.png", 10 * @patience) sleep(20) # FIXME -- this should not be needed, but we'll try it for j.d.n's sake end @@ -286,55 +287,55 @@ Given /^I select ([a-z]*) mode and wait for the remote shell$/ do |ui_mode| debug_log("debug: About to type ENTER at the bootsplash", :color => :blue) @screen.type(Sikuli::Key.ENTER) # we're disabling the above editing of the command line, since it's breaking on jenkins.debian.net for reasons unknown debug_log("debug: waiting for it to get to the 'English' prompt...", :color => :blue) - @screen.wait(diui_png("English",ui_mode), 3*60) # FIXME -- this is just to pause until the remote shell would have been up, so is a kludge + @screen.wait(diui_png("English",ui_mode), 3*60 * @patience) # FIXME -- this is just to pause until the remote shell would have been up, so is a kludge debug_log("debug: found the 'English' prompt", :color => :blue) end Given /^in ([a-z]*) mode I select British English$/ do |ui_mode| - @screen.wait(diui_png("English",ui_mode), 30) + @screen.wait(diui_png("English",ui_mode), 30 * @patience) @screen.type(Sikuli::Key.ENTER) - @screen.wait(diui_png("SelectYourLocation",ui_mode), 10) + @screen.wait(diui_png("SelectYourLocation",ui_mode), 10 * @patience) @screen.type(Sikuli::Key.UP) - @screen.wait(diui_png("UnitedKingdom",ui_mode), 10) + @screen.wait(diui_png("UnitedKingdom",ui_mode), 10 * @patience) @screen.type(Sikuli::Key.ENTER) - @screen.wait(diui_png("BritishEnglish",ui_mode), 10) + @screen.wait(diui_png("BritishEnglish",ui_mode), 10 * @patience) @screen.type(Sikuli::Key.ENTER) end Given /^in ([a-z]*) mode I accept the hostname, using "([^"]*)" as the domain$/ do |ui_mode,domain| - @screen.wait(diui_png("EnterTheHostname",ui_mode), 5*60) + @screen.wait(diui_png("EnterTheHostname",ui_mode), 5*60 * @patience) @screen.type(Sikuli::Key.ENTER) - @screen.wait(diui_png("DomainName",ui_mode), 10) + @screen.wait(diui_png("DomainName",ui_mode), 10 * @patience) @screen.type(domain + Sikuli::Key.ENTER) - @screen.waitVanish(diui_png("DomainName",ui_mode), 10) + @screen.waitVanish(diui_png("DomainName",ui_mode), 10 * @patience) end Given /^in ([a-z]*) mode I set the root password to "([^"]*)"$/ do |ui_mode, rootpw| # Root Password, twice - @screen.wait(diui_png("RootPassword",ui_mode), 30) + @screen.wait(diui_png("RootPassword",ui_mode), 30 * @patience) @screen.type(rootpw) if "gui" == ui_mode @screen.type(Sikuli::Key.TAB) else @screen.type(Sikuli::Key.ENTER) - @screen.waitVanish(diui_png("RootPassword",ui_mode), 10) + @screen.waitVanish(diui_png("RootPassword",ui_mode), 10 * @patience) end @screen.type(rootpw + Sikuli::Key.ENTER) end Given /^in ([a-z]*) mode I set the password for "([^"]*)" to be "([^"]*)"$/ do |ui_mode,fullname,password| # Username, and password twice - @screen.wait(diui_png("NameOfUser",ui_mode), 10) + @screen.wait(diui_png("NameOfUser",ui_mode), 10 * @patience) @screen.type(fullname + Sikuli::Key.ENTER) - @screen.waitVanish(diui_png("NameOfUser",ui_mode), 10) + @screen.waitVanish(diui_png("NameOfUser",ui_mode), 10 * @patience) @screen.type(Sikuli::Key.ENTER) - @screen.wait(diui_png("UserPassword",ui_mode), 10) + @screen.wait(diui_png("UserPassword",ui_mode), 10 * @patience) @screen.type(password) if "gui" == ui_mode @screen.type(Sikuli::Key.TAB) else @screen.type(Sikuli::Key.ENTER) - @screen.waitVanish(diui_png("UserPassword",ui_mode), 10) + @screen.waitVanish(diui_png("UserPassword",ui_mode), 10 * @patience) end @screen.type(password + Sikuli::Key.ENTER) end @@ -342,54 +343,54 @@ end #@screen.wait(diui_png("NoDiskFound",ui_mode), 60) Given /^in ([a-z]*) mode I select full-disk, single-filesystem partitioning$/ do |ui_mode| - @screen.wait(diui_png("PartitioningMethod",ui_mode), 60) - sleep(10) - @screen.wait(diui_png("PartitioningMethod",ui_mode), 10) + @screen.wait(diui_png("PartitioningMethod",ui_mode), 60 * @patience) + sleep(10 * @patience) + @screen.wait(diui_png("PartitioningMethod",ui_mode), 10 * @patience) @screen.type(Sikuli::Key.ENTER) - @screen.wait(diui_png("SelectDiskToPartition",ui_mode), 10) + @screen.wait(diui_png("SelectDiskToPartition",ui_mode), 10 * @patience) @screen.type(Sikuli::Key.ENTER) - @screen.wait(diui_png("PartitioningScheme",ui_mode), 10) + @screen.wait(diui_png("PartitioningScheme",ui_mode), 10 * @patience) @screen.type(Sikuli::Key.ENTER) - @screen.wait(diui_png("FinishPartitioning",ui_mode), 10) - sleep(5) # FIXME -- why do we need this? It's weird that the wait is not enough + @screen.wait(diui_png("FinishPartitioning",ui_mode), 10 * @patience) + sleep(5 * @patience) # FIXME -- why do we need this? It's weird that the wait is not enough @screen.type(Sikuli::Key.ENTER) # prompt about Writing Partitions to disk: - @screen.wait(diui_png("No",ui_mode), 10) + @screen.wait(diui_png("No",ui_mode), 10 * @patience) if "gui" == ui_mode @screen.type(Sikuli::Key.DOWN) else @screen.type(Sikuli::Key.TAB) end - @screen.wait(diui_png("Yes",ui_mode), 10) + @screen.wait(diui_png("Yes",ui_mode), 10 * @patience) @screen.type(Sikuli::Key.ENTER) end Given /^in ([a-z]*) mode I note that the Base system is being installed$/ do |ui_mode| - @screen.wait(diui_png("InstallingBaseSystem",ui_mode), 30) - @screen.waitVanish(diui_png("InstallingBaseSystem",ui_mode), 15 * 60) + @screen.wait(diui_png("InstallingBaseSystem",ui_mode), 30 * @patience) + @screen.waitVanish(diui_png("InstallingBaseSystem",ui_mode), 15 * 60 * @patience) end Given /^in ([a-z]*) mode I accept the default mirror$/ do |ui_mode| - @screen.wait(diui_png("MirrorCountry",ui_mode), 10 * 60) + @screen.wait(diui_png("MirrorCountry",ui_mode), 10 * 60 * @patience) @screen.type(Sikuli::Key.ENTER) - @screen.wait(diui_png("ArchiveMirror",ui_mode), 5) + @screen.wait(diui_png("ArchiveMirror",ui_mode), 5 * @patience) @screen.type(Sikuli::Key.ENTER) - @screen.wait(diui_png("HttpProxy",ui_mode), 5) + @screen.wait(diui_png("HttpProxy",ui_mode), 5 * @patience) @screen.type("http://local-http-proxy:3128/" + Sikuli::Key.ENTER) #@screen.type(Sikuli::Key.ENTER) end Given /^in ([a-z]*) mode I neglect to scan more CDs$/ do |ui_mode| - @screen.wait(diui_png("ScanCD",ui_mode), 15 * 60) + @screen.wait(diui_png("ScanCD",ui_mode), 15 * 60 * @patience) @screen.type(Sikuli::Key.ENTER) - @screen.wait(diui_png("UseNetMirror",ui_mode), 10) - @screen.wait(diui_png("Yes",ui_mode), 10) + @screen.wait(diui_png("UseNetMirror",ui_mode), 10 * @patience) + @screen.wait(diui_png("Yes",ui_mode), 10 * @patience) if "gui" == ui_mode @screen.type(Sikuli::Key.DOWN) else @screen.type(Sikuli::Key.TAB) end - @screen.wait(diui_png("No",ui_mode), 10) + @screen.wait(diui_png("No",ui_mode), 10 * @patience) @screen.type(Sikuli::Key.ENTER) end @@ -406,37 +407,37 @@ Given /^in ([a-z]*) mode I ignore Popcon$/ do |ui_mode| raise "Failed to access the mirror (perhaps a duff proxy?)" end @screen.type(Sikuli::Key.ENTER) - @screen.waitVanish(diui_png("popcon",ui_mode), 10) + @screen.waitVanish(diui_png("popcon",ui_mode), 10 * @patience) end Given /^in ([a-z]*) mode we reach the Tasksel prompt$/ do |ui_mode| - @screen.wait(diui_png("ChooseSoftware",ui_mode), 5 * 60) + @screen.wait(diui_png("ChooseSoftware",ui_mode), 5 * 60 * @patience) end Given /^in ([a-z]*) mode I unset the Desktop task$/ do |ui_mode| - @screen.wait(diui_png("DesktopTask_Yes",ui_mode), 2 * 60) + @screen.wait(diui_png("DesktopTask_Yes",ui_mode), 2 * 60 * @patience) # deal with post-snapshot screen flicker FIXME -- check if we really need this - sleep(5) - @screen.wait(diui_png("DesktopTask_Yes",ui_mode), 10) + sleep(5 * @patience) + @screen.wait(diui_png("DesktopTask_Yes",ui_mode), 10 * @patience) @screen.type(Sikuli::Key.SPACE) - @screen.waitVanish(diui_png("DesktopTask_Yes",ui_mode), 10) + @screen.waitVanish(diui_png("DesktopTask_Yes",ui_mode), 10 * @patience) if "gui" == ui_mode - @screen.wait(diui_png("CONTINUEunselected",ui_mode), 10) + @screen.wait(diui_png("CONTINUEunselected",ui_mode), 10 * @patience) @screen.type(Sikuli::Key.TAB) - @screen.wait(diui_png("CONTINUEselected",ui_mode), 10) + @screen.wait(diui_png("CONTINUEselected",ui_mode), 10 * @patience) end @screen.type(Sikuli::Key.ENTER) end Given /^in ([a-z]*) mode I unset the Desktop and Print tasks$/ do |ui_mode| - @screen.wait(diui_png("DesktopTask_Yes",ui_mode), 2 * 60) + @screen.wait(diui_png("DesktopTask_Yes",ui_mode), 2 * 60 * @patience) # deal with post-snapshot screen flicker FIXME -- check if we really need this - sleep(5) - @screen.wait(diui_png("DesktopTask_Yes",ui_mode), 10) + sleep(5 * @patience) + @screen.wait(diui_png("DesktopTask_Yes",ui_mode), 10 * @patience) @screen.type(Sikuli::Key.SPACE) @screen.type(Sikuli::Key.DOWN) @@ -448,34 +449,34 @@ Given /^in ([a-z]*) mode I unset the Desktop and Print tasks$/ do |ui_mode| @screen.type(Sikuli::Key.DOWN) @screen.type(Sikuli::Key.DOWN) @screen.type(Sikuli::Key.SPACE) - @screen.waitVanish(diui_png("DesktopTask_Yes",ui_mode), 10) + @screen.waitVanish(diui_png("DesktopTask_Yes",ui_mode), 10 * @patience) if "gui" == ui_mode - @screen.wait(diui_png("CONTINUEunselected",ui_mode), 10) + @screen.wait(diui_png("CONTINUEunselected",ui_mode), 10 * @patience) @screen.type(Sikuli::Key.TAB) - @screen.wait(diui_png("CONTINUEselected",ui_mode), 10) + @screen.wait(diui_png("CONTINUEselected",ui_mode), 10 * @patience) end @screen.type(Sikuli::Key.ENTER) end Given /^in ([a-z]*) mode I select the ([a-zA-Z]*) Desktop task$/ do |ui_mode,desktop| - @screen.wait(diui_png("DesktopTask_Yes",ui_mode), 2 * 60) + @screen.wait(diui_png("DesktopTask_Yes",ui_mode), 2 * 60 * @patience) # deal with post-snapshot screen flicker -- FIXME this needs to be fixed via looking to see if the remote login is working before we look at the screen debug_log("debug: Found DesktopTask_Yes, pausing for 20s", :color => :blue) - sleep(20) + sleep(20 * @patience) @screen.type(Sikuli::Key.DOWN) @screen.type(Sikuli::Key.DOWN) if "XFCE" == desktop @screen.type(Sikuli::Key.SPACE) - @screen.wait(diui_png("Desktop+" + desktop,ui_mode), 10) + @screen.wait(diui_png("Desktop+" + desktop,ui_mode), 10 * @patience) if "gui" == ui_mode - @screen.wait(diui_png("CONTINUEunselected",ui_mode), 10) + @screen.wait(diui_png("CONTINUEunselected",ui_mode), 10 * @patience) @screen.type(Sikuli::Key.TAB) - @screen.wait(diui_png("CONTINUEselected",ui_mode), 10) + @screen.wait(diui_png("CONTINUEselected",ui_mode), 10 * @patience) end @screen.type(Sikuli::Key.ENTER) - @screen.waitVanish(diui_png("Desktop+Gnome",ui_mode), 10) + @screen.waitVanish(diui_png("Desktop+Gnome",ui_mode), 10 * @patience) end Given /^in ([a-z]*) mode I wait while the bulk of the packages are installed$/ do |ui_mode| @@ -513,35 +514,35 @@ Given /^in ([a-z]*) mode I wait while the bulk of the packages are installed$/ d end Given /^in ([a-z]*) mode I install GRUB$/ do |ui_mode| - @screen.wait(diui_png("InstallGRUB",ui_mode), 2 * 60) + @screen.wait(diui_png("InstallGRUB",ui_mode), 2 * 60 * @patience) debug_log("debug: Found InstallGRUB", :color => :blue) - sleep(10) # FIXME -- this is a kludge to deal with the snapshot coming back -- should be done via the remote shell check instead - @screen.wait(diui_png("InstallGRUB",ui_mode), 10) + sleep(10 * @patience) # FIXME -- this is a kludge to deal with the snapshot coming back -- should be done via the remote shell check instead + @screen.wait(diui_png("InstallGRUB",ui_mode), 10 * @patience) debug_log("debug: Found InstallGRUB (again)", :color => :blue) if "gui" == ui_mode debug_log("debug: We're in GUI mode", :color => :blue) - @screen.wait(diui_png("CONTINUEunselected",ui_mode), 10) + @screen.wait(diui_png("CONTINUEunselected",ui_mode), 10 * @patience) debug_log("debug: Found CONTINUEunselected", :color => :blue) debug_log("debug: Press TAB", :color => :blue) @screen.type(Sikuli::Key.TAB) - @screen.wait(diui_png("CONTINUEselected",ui_mode), 10) + @screen.wait(diui_png("CONTINUEselected",ui_mode), 10 * @patience) debug_log("debug: Found CONTINUEselected", :color => :blue) end debug_log("debug: Press ENTER", :color => :blue) @screen.type(Sikuli::Key.ENTER) - @screen.wait(diui_png("GRUBEnterDev",ui_mode), 10 * 60) + @screen.wait(diui_png("GRUBEnterDev",ui_mode), 10 * 60 * @patience) @screen.type(Sikuli::Key.DOWN) - @screen.wait(diui_png("GRUBdev",ui_mode), 10) + @screen.wait(diui_png("GRUBdev",ui_mode), 10 * @patience) @screen.type(Sikuli::Key.ENTER) end Given /^in ([a-z]*) mode I allow reboot after the install is complete$/ do |ui_mode| - @screen.wait(diui_png("InstallComplete",ui_mode), 4 * 60) + @screen.wait(diui_png("InstallComplete",ui_mode), 4 * 60 * @patience) @screen.type(Sikuli::Key.ENTER) end Given /^I wait for the reboot$/ do - @screen.wait(bootsplash, 10 * 60) + @screen.wait(bootsplash, 10 * 60 * @patience) end Given /^I should see a ([a-zA-Z]*) Login prompt$/ do |style| -- cgit v1.2.3-70-g09d2