I have test that got repeatable steps which is depending of result of one step.
Test flow as following:
1. Open designer
2. Run design
3a. If warning dialog for validation errors appeared and yes button is disabled:
- click OK button
resolve validation errors
repeat step 2
4. finish design
Right now I inherited the following code for step 3:
Code:
public static void doDesignValidationRoutine(string strModule, string strName) { string buttonBasePath="/form[@title>'{0}']/?/?/?/?/?/button[@text='{1}' and @visible='True']"; try { string strYesButton = string.Format(buttonBasePath,"Design validation","&Yes"); Element menuItem = Host.Local.FindSingle(strYesButton,10000); if(menuItem.Enabled) { Mouse.Click(menuItem); //disabled button, go rerun the buttonBasePath="/form[@title>'{0}']/?/?/?/?/?/button[@text='{1}' and @visible='True']"; string strNoButton = string.Format(buttonBasePath,"Design validation","&Yes"); if(Host.Local.TryFindSingle(strNoButton, 10000, out menuItem)) { Mouse.Click(menuItem); } } else { //disabled button, go rerun the buttonBasePath="/form[@title>'{0}']/?/?/?/?/?/button[@text='{1}' and @visible='True']"; string strNoButton = string.Format(buttonBasePath,"Design validation","&No"); menuItem = Host.Local.FindSingle(strNoButton,10000); Mouse.Click(menuItem); clickShowLowPriorityValidations(strLayoutModule, strJobName); tickWarningValidations(strLayoutModule, strJobName); //recursive, so good luck doDesignValidationRoutine(strLayoutModule, strJobName); } } catch { } } codeI don't like idea of using recursive function.
Could someone give me better idea how I should handle this.
All ideas are highly appreciated.
Thanks,
Felix.