source: sasview/build_tools/sasview_deploy_test.au3 @ 26183bf

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalcmagnetic_scattrelease-4.2.2ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since 26183bf was e9f8208, checked in by Piotr Rozyczko <rozyczko@…>, 8 years ago

Removed debug directive from the script

  • Property mode set to 100755
File size: 5.0 KB
RevLine 
[6bb4edd]1; ****** REMEMBER TO SWITCH OFF UAC ON TARGET MACHINE!!! *********
2;
3; This script will install, run and uninstall SasView
4; given location of the installer. The exit code of the script
5; points at failure location:
6;
7; 0 - OK
[55bbe0b2]8; 1 - Installer failure
9; 2 - Problems running SasView (simple fitting)
10; 3 - Uninstaller failure
[6bb4edd]11
12#include <Constants.au3>
13#include <FileConstants.au3>
14#include <MsgBoxConstants.au3>
15#include <WinAPIFiles.au3>
16
17; Modifiable globals
[55bbe0b2]18Global $fInstallerLocation = @TempDir & "\setupSasView.exe"
19if $CmdLine[0] > 0 Then
20   ; If argument present - use it as local download path
21   $fInstallerLocation = $CmdLine[1]
[1cecc91]22EndIf
23
24Global $fUninstallerLocation = "C:\Program Files (x86)\SasView\unins000.exe"
[6bb4edd]25Global $lTimeout = 10          ; 10 sec timeout for waiting on windows
26Global $lInstallTimeout = 120  ; 2 min timeout for the installation process
27
28; General globals
29Global $installerPID = 0
30
31;; MAIN SCRIPT
32Install()
33RunSasView()
34Uninstall()
35Exit(0)
36
37;==============================================================
[1cecc91]38
[6bb4edd]39Func Install()
40   ;;;;; APPLICATION INSTALLED ;;;;;;;
41   Local $sSetupWindow = "Setup - SasView"
[55bbe0b2]42   Local $iFailFlag = 1
[6bb4edd]43   ; Run setup
44   if FileExists($fInstallerLocation) Then
45          $installerPID = Run($fInstallerLocation)
[1cecc91]46          Assert($installerPID, $iFailFlag)
[6bb4edd]47          Sleep(1000)
48   Else
49          ;$Error = ObjEvent(AutoIt.Error, "Setup file does not exist","123")
[1cecc91]50          Exit($iFailFlag)
[6bb4edd]51   EndIf
52
53   ; License click through
[55bbe0b2]54   WinActivate($sSetupWindow)
[6bb4edd]55   Local $test = WinWaitActive($sSetupWindow, "License Agreement", $lTimeout)
56   ;ConsoleWrite("license agreement: " & $test)
[1cecc91]57   Assert($test, $iFailFlag)
[6bb4edd]58   sleep(1000)
59
60   Send("{TAB}{up}{ENTER}")
61
62   ; Location
63   Sleep(1000)
64   $test = WinWaitActive($sSetupWindow, "Select Destination Location", $lTimeout)
[1cecc91]65   Assert($test, $iFailFlag)
[6bb4edd]66   Send("{ENTER}")
67
68   ; Icons, Startup entry
69   Sleep(1000)
70   $test = WinWaitActive($sSetupWindow, "Select Additional Tasks", $lTimeout)
[1cecc91]71   Assert($test, $iFailFlag)
[6bb4edd]72   Send("{ENTER}")
73
74   ; Ready to install...
75   Sleep(1000)
76   $test = WinWaitActive($sSetupWindow, "Ready to Install", $lTimeout)
[1cecc91]77   Assert($test, $iFailFlag)
[6bb4edd]78   Send("{ENTER}")
79
80   ; Final OK on running
81   Sleep(5000)
82   $test = WinWaitActive($sSetupWindow, "Completing the SasView Setup Wizard", $lInstallTimeout)
[1cecc91]83   Assert($test, $iFailFlag)
[6bb4edd]84   Send("{ENTER}")
85   ;ConsoleWrite("Installed" & @CRLF)
86
87EndFunc
88
89
90Func RunSasView()
91   ;;;;; APPLICATION STARTED ;;;;;;;
92   ; Start app - DEBUG ONLY
93   ;;Run("C:\Program Files (x86)\SasView\SasView.exe")
[dde9e0e]94   local $sActiveWindow = "SasView  - Fitting -"
[1cecc91]95   Local $iFailFlag = 2
[6bb4edd]96   ; Wait for the window
97   Sleep(1000)
[dde9e0e]98   Local $hWnd = WinWaitActive($sActiveWindow, "", $lTimeout)
[1cecc91]99   Assert($hWnd, $iFailFlag)
[6bb4edd]100
101   ;;;;; Load a File
102   ; Open File Load dialog
103   Send("!{f}{ENTER}")
104   WinWaitActive("Choose a file", "", $lTimeout)
[1cecc91]105   Assert($hWnd, $iFailFlag)
[6bb4edd]106   Sleep(200)
107
108   ; Focus is in file chooser - enter filename
109   Send("C:\Program Files (x86)\SasView\test\1d_data\cyl_400_20.txt")
110   Sleep(1000)
111   Send("{ENTER}")
112
113   ;; Send file to fitting
114   ControlClick($hWnd, "Send To", 231)
115
[dde9e0e]116   ;; Choose a python model
[6bb4edd]117   ControlCommand($hWnd, "", "ComboBox3", "SetCurrentSelection", 1)
[dde9e0e]118   ;; Calculate the model
119   ControlClick($hWnd, "Compute", 211)
120   ;; Assure we got the charts
121   Local $hPlot = WinWait($sActiveWindow, "Graph2", $lTimeout)
122   Assert($hPlot, $iFailFlag)
123   $hPlot = WinWait($sActiveWindow, "Graph3", $lTimeout)
124   Assert($hPlot, $iFailFlag)
125
126   sleep(1000)
127   ;; Calculate a compiled model
128   ControlClick($hWnd, "Send To", 231)
[6bb4edd]129
[dde9e0e]130   ;; Choose Shapes/Cylinder
131   ControlCommand($hWnd, "", "ComboBox2", "SetCurrentSelection", 1)
132   ControlCommand($hWnd, "", "ComboBox3", "SetCurrentSelection", 11)
[6bb4edd]133   ;; Calculate the model
134   ControlClick($hWnd, "Compute", 211)
135
[dde9e0e]136   ;; Assure we got another chart
137   $hPlot = WinWait($sActiveWindow, "Graph4", $lTimeout)
138   Assert($hPlot, $iFailFlag)
139
[6bb4edd]140   ;; Close SasView
141   WinClose($hWnd)
142
143   Local $hEnd = WinWaitActive("Confirm Exit", "", $lTimeout)
[1cecc91]144   Assert($hEnd, $iFailFlag)
[6bb4edd]145   ControlClick($hEnd, "", "[CLASS:Button; INSTANCE:1]")
146
147   Local $sv_closed = WinWaitClose($hWnd, "", $lTimeout)
[1cecc91]148   Assert($sv_closed, $iFailFlag)
[6bb4edd]149
150EndFunc
151
152Func Uninstall()
153;;;;; UNINSTALL ;;;;;;;
[1cecc91]154   Local $iFailFlag = 3
155   $installerPID = Run($fUninstallerLocation)
156   Assert($installerPID, $iFailFlag)
[6bb4edd]157
158   Local $sSetupWindow = "SasView Uninstall"
159
160   Local $test = WinWaitActive($sSetupWindow, "", $lTimeout)
[1cecc91]161   Assert($test, $iFailFlag)
[6bb4edd]162   Send("{TAB}{ENTER}")
163
164   WinActivate("SasView Uninstal")
165   $test = WinWaitActive($sSetupWindow, "SasView was successfully removed", $lTimeout)
[1cecc91]166   Assert($test, $iFailFlag)
[6bb4edd]167   Send("{ENTER}")
168
169EndFunc
170
171
172;;; HELPER FUNCTIONS ;;;;
173Func Assert($test, $lExitValue)
174   ;;; Asserts $test to be non-zero and exit with code $lExitValue ;;;
175   if $test == 0 Then
176          ProcessClose($installerPID)
177          Exit($lExitValue)
178   EndIf
179EndFunc
Note: See TracBrowser for help on using the repository browser.