99	"path/filepath" 
1010	"time" 
1111
12- 	"github.com/ftl/hellocontest/core/app " 
12+ 	"github.com/ftl/hellocontest/core" 
1313)
1414
1515const  ScreenshotsFolder  =  "./docs/screenshots" 
@@ -18,14 +18,15 @@ var ScreenshotsScript = &Script{
1818	sections : []* Section {
1919		{
2020			steps : []Step {
21+ 				SetTimebase ("2023-06-28T19:00:00Z" ),
2122				Wait (2  *  time .Second ),
2223			},
2324		},
2425		{
2526			enter : AskForScreenshot ("about dialog" , 1 * time .Second ),
2627			steps : []Step {
27- 				func (_  context.Context , app   * app. Controller ,  ui   func ( func ()) ) time.Duration  {
28- 					ui ( app .About )
28+ 				func (_  context.Context , r   * Runtime ) time.Duration  {
29+ 					r . UI ( r . App .About )
2930					return  0 
3031				},
3132				TriggerScreenshot ("about" ),
@@ -49,34 +50,46 @@ var ScreenshotsScript = &Script{
4950		{
5051			enter : AskForScreenshot ("new CWT, enter name CWT 2025 Test" , 1 * time .Second ),
5152			steps : []Step {
52- 				func (_  context.Context , app   * app. Controller ,  ui   func ( func ()) ) time.Duration  {
53- 					ui ( app .New )
54- 					ui (func () {
55- 						app .NewContestController .SelectContestIdentifier ("CW-OPS" )
56- 						app . NewContestController .EnterContestName ("CWT 2025 Test " )
57- 						app .NewContestController .RefreshView ()
53+ 				func (_  context.Context , r   * Runtime ) time.Duration  {
54+ 					r . UI ( r . App .New )
55+ 					r . UI (func () {
56+ 						r . App .NewContestController .SelectContestIdentifier ("CW-OPS" )
57+ 						r . App . NewContestController .EnterContestName ("CWT Screenshot Demo " )
58+ 						r . App .NewContestController .RefreshView ()
5859					})
5960					return  0 
6061				},
6162				TriggerScreenshot ("new_cwt" ),
62- 				Describe ("close the dialog with 'NEW', save the contest with the proposed filename" , 10 * time .Second ),
63+ 				Describe ("close the dialog with 'NEW', save the contest with the proposed filename\n the settings dialog will show up, just wait for the next set of instructions" , 10 * time .Second ),
64+ 				func (_  context.Context , r  * Runtime ) time.Duration  {
65+ 					r .UI (func () {
66+ 						r .App .Settings .EnterStationCallsign ("DL0ABC" )
67+ 						r .App .Settings .EnterStationOperator ("DL1ABC" )
68+ 						r .App .Settings .EnterStationLocator ("AA00xx" )
69+ 						r .App .Settings .SetContestStartTimeNow ()
70+ 						r .App .Settings .EnterContestExchangeValue (core .EntryField ("myExchange_1" ), "Walter" )
71+ 						r .App .Settings .EnterContestExchangeValue (core .EntryField ("myExchange_2" ), "DL" )
72+ 						r .App .Settings .RefreshView ()
73+ 					})
74+ 					return  0 
75+ 				},
6376				Describe ("set the current hour as start time, select a current call history file" , 20 * time .Second ),
6477				Describe ("contest settings dialog, complete" , 1 * time .Second ),
6578				TriggerScreenshot ("contest_settings_complete" ),
6679				Describe ("contest settings dialog, section 'My Exchange' with name Flo and dxcc_prefix DL" , 10 * time .Second ),
6780				TriggerScreenshot ("contest_settings_myexchange_cwt" ),
68- 				Describe ("close the contest settings dialog, screenshot of empty main window" , 5 * time .Second ),
81+ 				Describe ("close the contest settings dialog, screenshot of empty main window" , 10 * time .Second ),
6982				TriggerScreenshot ("main_window_empty" ),
7083			},
7184		},
7285		{
7386			enter : AskForScreenshot ("main window QSO data entry" , 0 ),
7487			steps : []Step {
75- 				func (_  context.Context , app   * app. Controller ,  ui   func ( func ()) ) time.Duration  {
76- 					ui (func () {
77- 						app .Entry .Clear ()
78- 						app .Entry .Enter ("DL3NEY" )
79- 						app .Entry .RefreshView ()
88+ 				func (_  context.Context , r   * Runtime ) time.Duration  {
89+ 					r . UI (func () {
90+ 						r . App .Entry .Clear ()
91+ 						r . App .Entry .Enter ("DL3NEY" )
92+ 						r . App .Entry .RefreshView ()
8093					})
8194					return  0 
8295				},
@@ -93,8 +106,8 @@ var ScreenshotsScript = &Script{
93106		{
94107			steps : []Step {
95108				Describe ("all screenshots taken, closing the application" , 0 ),
96- 				func (_  context.Context , app   * app. Controller ,  ui   func ( func ()) ) time.Duration  {
97- 					ui ( app .Quit )
109+ 				func (_  context.Context , r   * Runtime ) time.Duration  {
110+ 					r . UI ( r . App .Quit )
98111					return  0 
99112				},
100113			},
@@ -111,7 +124,7 @@ func DescribeScreenshot(description string, delay time.Duration) Step {
111124}
112125
113126func  ClearScreenshotsFolder () Step  {
114- 	return  func (_  context.Context , _  * app. Controller ,  _   func ( func ()) ) time.Duration  {
127+ 	return  func (_  context.Context , _  * Runtime ) time.Duration  {
115128		log .Printf ("[clearing screenshots folder]" )
116129		d , err  :=  os .Open (ScreenshotsFolder )
117130		if  err  !=  nil  {
@@ -137,7 +150,7 @@ func ClearScreenshotsFolder() Step {
137150}
138151
139152func  DeleteScreenshot (name  string ) Step  {
140- 	return  func (_  context.Context , _  * app. Controller ,  _   func ( func ()) ) time.Duration  {
153+ 	return  func (_  context.Context , _  * Runtime ) time.Duration  {
141154		filename  :=  filepath .Join (ScreenshotsFolder , name )
142155		err  :=  os .RemoveAll (filename )
143156		if  err  !=  nil  {
@@ -152,7 +165,7 @@ func TriggerScreenshot(filename string) Step {
152165}
153166
154167func  TriggerScreenshotWithDelay (name  string , delay  time.Duration ) Step  {
155- 	return  func (_  context.Context , _  * app. Controller ,  _   func ( func ()) ) time.Duration  {
168+ 	return  func (_  context.Context , _  * Runtime ) time.Duration  {
156169		filename  :=  filepath .Join (ScreenshotsFolder , name + ".png" )
157170		backupFilename  :=  filepath .Join (ScreenshotsFolder , name + ".bak.png" )
158171		_  =  backupFilename 
0 commit comments