public static void Execute() { //Playback settings Playback.PlaybackSettings.WaitForReadyTimeout = Configurations.SyncTime; Playback.PlaybackSettings.SearchTimeout = Configurations.SyncTime; Playback.PlaybackSettings.WaitForReadyLevel = WaitForReadyLevel.UIThreadOnly; BrowserWindow.CurrentBrowser = Configurations.BrowserName; BrowserWindow TC_002_bw = BrowserWindow.Launch(new Uri(Configurations.MainUrl)); TC_002_bw.Maximized = true; LoginScreen lsobj = new LoginScreen(TC_002_bw); HomePage hpobj = new HomePage(TC_002_bw); RelocationScreen rlsobj = new RelocationScreen(TC_002_bw); try { lsobj.UserName.WaitForControlExist(Configurations.SyncTime); /*lsobj.UserName.Text = LoginCredentials.UserName; * Console.WriteLine("Entered username as " + LoginCredentials.UserName); * lsobj.Password.Text = LoginCredentials.Password; * Console.WriteLine("Entered password"); * Mouse.Click(lsobj.LoginButton); * Console.WriteLine("Clicked on Login button"); */ Login.LoginToApplication(TC_002_bw, LoginCredentials.UserName, LoginCredentials.Password); } catch (Exception) { throw; } try { hpobj.DetaieldSearchLink.WaitForControlExist(Configurations.SyncTime); Console.WriteLine("Detailed Search Link is displayed"); Mouse.Click(hpobj.DetaieldSearchLink); Console.WriteLine("Clicked on Detailed Search Link to expand"); } catch (Exception) { throw; } try { hpobj.PropertyType.WaitForControlExist(Configurations.SyncTime); TestData.M20_Auto_004_005_PropertyPhaseValue = "Relocation"; Mouse.Click(hpobj.PropertyPhase); Playback.Wait(500); Keyboard.SendKeys("{TAB}"); Playback.Wait(500); Keyboard.SendKeys(TestData.M20_Auto_004_005_PropertyPhaseValue); Console.WriteLine("Entered Property Phase as " + TestData.M20_Auto_004_005_PropertyPhaseValue); Mouse.Click(hpobj.SearchButton); Playback.Wait(5000); Console.WriteLine("Clicked on Search Button"); Mouse.Click(hpobj.PropertyPhase); Playback.Wait(500); Keyboard.SendKeys("^{END}"); int RecordCount = Int32.Parse(hpobj.PaginationText.InnerText.Trim().Split('-')[0].Trim()); if (RecordCount == 0) { Assert.Fail("Clicking on Search button did not display any records"); } if (RecordCount == 1) { Console.WriteLine("Clicking on Search button has displayed records"); } } catch (Exception) { throw; } //hpobj.RelocationPhaseCellLink.WaitForControlExist(Configurations.SyncTime); try { var pid = hpobj.PIDTableCell.InnerText.Trim(); Mouse.Click(hpobj.RelocationPhaseCellLink); Console.WriteLine("Clicked on FIrst Relocation link"); Keyboard.SendKeys("^{END}"); rlsobj.RelocationHeader.WaitForControlExist(Configurations.SyncTime); Console.WriteLine("Relocation Page is displayed"); if (rlsobj.RelocationReportLink.Exists) { Console.WriteLine("Relocation Report link is displayed"); } else { Assert.Fail("Relocation Report link is displayed"); } Mouse.Click(rlsobj.RelocationReportLink); Console.WriteLine("Clicked on Relocation Report Link"); //rlrobj.RelocationReportText.WaitForControlExist(Configurations.SyncTime); //Playback.Wait(90000); BrowserWindow bw1 = new BrowserWindow(); RelocationReport rlrobj = new RelocationReport(bw1); Playback.PlaybackSettings.WaitForReadyLevel = WaitForReadyLevel.AllThreads; HtmlDiv RelocationReportText = new HtmlDiv(bw1); RelocationReportText.SearchProperties[HtmlDiv.PropertyNames.InnerText] = "Relocation Report"; Playback.Wait(60000); RelocationReportText.WaitForControlReady(Configurations.SyncTime); Mouse.Click(RelocationReportText); /*if (RelocationReportText.Exists) * { * Console.WriteLine("Relocation Report is displayed"); * } * else * { * Assert.Fail("Relocation Report is not displayed"); * }*/ } catch (Exception) { throw; } }
public static void Execute() { Playback.PlaybackSettings.WaitForReadyTimeout = Configurations.SyncTime; Playback.PlaybackSettings.SearchTimeout = Configurations.SyncTime; BrowserWindow.CurrentBrowser = Configurations.BrowserName; BrowserWindow TC_002_bw = BrowserWindow.Launch(new Uri(Configurations.MainUrl)); TC_002_bw.Maximized = true; LoginScreen lsobj = new LoginScreen(TC_002_bw); HomePage hpobj = new HomePage(TC_002_bw); try { lsobj.UserName.WaitForControlExist(Configurations.SyncTime); /* lsobj.UserName.Text = LoginCredentials.UserName; * Console.WriteLine("Entered username as " + LoginCredentials.UserName); * lsobj.Password.Text = LoginCredentials.Password; * Console.WriteLine("Entered password"); * Mouse.Click(lsobj.LoginButton); * Console.WriteLine("Clicked on Login button"); */ Login.LoginToApplication(TC_002_bw, LoginCredentials.UserName, LoginCredentials.Password); } catch (Exception) { throw; } try { hpobj.PropertySearchLink.WaitForControlExist(Configurations.SyncTime); Console.WriteLine("Property Search Link is displayed"); } catch (Exception) { throw; } try { hpobj.SearchbyAddress.WaitForControlExist(Configurations.SyncTime); Mouse.Click(hpobj.City); Playback.Wait(500); Keyboard.SendKeys("{TAB}"); Playback.Wait(500); Keyboard.SendKeys(TestData.M20_Auto_003_005_CityValue); Console.WriteLine("Entered City as " + TestData.M20_Auto_003_005_CityValue); Mouse.Click(hpobj.State); Playback.Wait(500); Keyboard.SendKeys("{TAB}"); Playback.Wait(500); Keyboard.SendKeys(TestData.M20_Auto_003_005_StateValue); Console.WriteLine("Entered State as " + TestData.M20_Auto_003_005_StateValue); Mouse.Click(hpobj.Zip); Playback.Wait(500); Keyboard.SendKeys("{TAB}"); Playback.Wait(500); Keyboard.SendKeys(TestData.M20_Auto_003_005_ZipValue); Console.WriteLine("Entered Zipcode as " + TestData.M20_Auto_003_005_ZipValue); Mouse.Click(hpobj.County); Playback.Wait(500); Keyboard.SendKeys("{TAB}"); Playback.Wait(500); Keyboard.SendKeys(TestData.M20_Auto_003_005_CountyValue); Console.WriteLine("Entered County as " + TestData.M20_Auto_003_005_CountyValue); Mouse.Click(hpobj.PropertyId); Playback.Wait(500); Keyboard.SendKeys("{TAB}"); Playback.Wait(500); Keyboard.SendKeys(TestData.M20_Auto_003_005_PropertyIdValue); Console.WriteLine("Entered Property ID as " + TestData.M20_Auto_003_005_PropertyIdValue); Mouse.Click(hpobj.SearchButton); Console.WriteLine("Clicked on Search Button"); /*for (int i = 0; i < Configurations.SyncTime; i++) * { * try * { * var documentStatus = TC_002_bw.ExecuteScript("var myState = document.readyState; return myState;"); * if (documentStatus.ToString() == "complete") * { * break; * } * else { Playback.Wait(1000); } * } * catch (Exception) * { * * throw; * } * }*/ Playback.PlaybackSettings.WaitForReadyLevel = WaitForReadyLevel.AllThreads; try { hpobj.PaginationText.WaitForControlExist(Configurations.SyncTime); int RecordCount = Int32.Parse(hpobj.PaginationText.InnerText.Trim().Split('-')[0]); if (RecordCount == 1) { Console.WriteLine("Record is displayed"); } if (RecordCount == 0) { Assert.Fail("Search did not display any records"); } } catch (Exception) { throw; } } catch (Exception) { throw; } try { Mouse.Click(hpobj.ClearSearchButton); Console.WriteLine("Clicked on Clear Search button"); Playback.Wait(2000); int RecordCount = Int32.Parse(hpobj.PaginationText.InnerText.Trim().Split('-')[0]); if (RecordCount == 1) { Assert.Fail("Clicking on Clear Search button did not clear the results"); } if (RecordCount == 0) { Console.WriteLine("Clicking on Clear Search button has cleared the results"); } } catch (Exception) { throw; } }
public static void Execute() { Playback.PlaybackSettings.WaitForReadyTimeout = Configurations.SyncTime; Playback.PlaybackSettings.SearchTimeout = Configurations.SyncTime; BrowserWindow.CurrentBrowser = Configurations.BrowserName; BrowserWindow TC_002_bw = BrowserWindow.Launch(new Uri(Configurations.MainUrl)); TC_002_bw.Maximized = true; LoginScreen lsobj = new LoginScreen(TC_002_bw); HomePage hpobj = new HomePage(TC_002_bw); try { lsobj.UserName.WaitForControlExist(Configurations.SyncTime); /*lsobj.UserName.Text = LoginCredentials.UserName; * Console.WriteLine("Entered username as " + LoginCredentials.UserName); * lsobj.Password.Text = LoginCredentials.Password; * Console.WriteLine("Entered password"); * Mouse.Click(lsobj.LoginButton); * Console.WriteLine("Clicked on Login button"); */ Login.LoginToApplication(TC_002_bw, LoginCredentials.UserName, LoginCredentials.Password); } catch (Exception) { throw; } try { hpobj.DetaieldSearchLink.WaitForControlExist(Configurations.SyncTime); Console.WriteLine("Detailed Search Link is displayed"); Mouse.Click(hpobj.DetaieldSearchLink); Console.WriteLine("Clicked on Detailed Search Link to expand"); } catch (Exception) { throw; } try { hpobj.PropertyType.WaitForControlExist(Configurations.SyncTime); Mouse.Click(hpobj.PropertyType); Playback.Wait(500); Keyboard.SendKeys("{TAB}"); Playback.Wait(500); Keyboard.SendKeys(TestData.M20_Auto_004_005_PropertyTypeValue); Console.WriteLine("Entered Property Type as " + TestData.M20_Auto_004_005_PropertyTypeValue); Mouse.Click(hpobj.PropertyPhase); Playback.Wait(500); Keyboard.SendKeys("{TAB}"); Playback.Wait(500); Keyboard.SendKeys(TestData.M20_Auto_004_005_PropertyPhaseValue); Console.WriteLine("Entered Property Phase as " + TestData.M20_Auto_004_005_PropertyPhaseValue); Mouse.Click(hpobj.PropertyStatus); Playback.Wait(500); Keyboard.SendKeys("{TAB}"); Playback.Wait(500); Keyboard.SendKeys(TestData.M20_Auto_004_005_PropertyStatusValue); Console.WriteLine("Entered Property Status as " + TestData.M20_Auto_004_005_PropertyStatusValue); Mouse.Click(hpobj.AssetType); Playback.Wait(500); Keyboard.SendKeys("{TAB}"); Playback.Wait(500); Keyboard.SendKeys(TestData.M20_Auto_004_005_AssetTypeValue); Console.WriteLine("Entered Asset Type as " + TestData.M20_Auto_004_005_AssetTypeValue); Mouse.Click(hpobj.SearchButton); Playback.Wait(5000); Console.WriteLine("Clicked on Search Button"); Playback.PlaybackSettings.WaitForReadyLevel = WaitForReadyLevel.AllThreads; Mouse.Click(hpobj.PropertyPhase); Playback.Wait(500); Keyboard.SendKeys("^{END}"); int RecordCount = Int32.Parse(hpobj.PaginationText.InnerText.Trim().Split('-')[0].Trim()); if (RecordCount == 0) { Assert.Fail("Clicking on Search button did not display any records"); } if (RecordCount == 1) { Console.WriteLine("Clicking on Search button has displayed records"); } Mouse.Click(hpobj.ExportToExcel); Console.WriteLine("Clicked on Export to Excel option"); Playback.Wait(10000); String filename = "PropertySearch.xlsx"; FileInfo f = new FileInfo(filename); String fullname = f.FullName; if (Directory.Exists(Path.GetDirectoryName(fullname))) { Console.WriteLine("Results are exported to excel file"); } else { Assert.Fail("Results are not exported to excel file"); } } catch (Exception) { throw; } }