public void AreaTypeSelect(Testbase test) { iIndex = test.para.aKey.IndexOf("ByAreaPage_Index"); sValue = (string)test.para.aValue[iIndex]; test.FF.WaitUntilContainsText(sValue); Assert.IsTrue(test.FF.ContainsText(sValue)); iIndex = test.para.aKey.IndexOf("SelectAreaType"); sAdd = (string)test.para.aAddress[iIndex]; string sAdd2 = sAdd; // Select an area path test.FF.RadioButton(Find.ById(sAdd)).Checked = true; iIndex = test.para.aKey.IndexOf("Next2"); sAdd = (string)test.para.aAddress[iIndex]; test.FF.Span(Find.ByText(sAdd)).Click(); // Input areas in different area pages switch (sAdd2) { case "geo_type_zip": SelectAreaByZip(test); break; case "geo_type_city": SelectAreabyCity(test); break; case "geo_type_county": SelectAreabyCounty(test); break; case "geo_type_state": SelectAreabyState(test); break; case "geo_type_radius": SelectAreabyAddRadius(test); break; case "geo_type_zipradius": SelectAreabyZipRadius(test); break; case "geo_type_scf": SelectAreabySCF(test); break; case "geo_type_entireusa": SelectAreabyUS(test); break; case "geo_type_closex": SelectAreabyClosestRecords(test); break; } }
public void UserLogin(Testbase test) { ArrayList aAddress = test.para.aAddress; ArrayList aKey = test.para.aKey; ArrayList aValue = test.para.aValue; int iIndex; iIndex = aKey.IndexOf("Account"); test.FF.TextField(Find.ById((string)aAddress[iIndex])).TypeText((string)aValue[iIndex]); iIndex = aKey.IndexOf("Password"); test.FF.TextField(Find.ById((string)aAddress[iIndex])).TypeText((string)aValue[iIndex]); iIndex = aKey.IndexOf("Submit Button"); test.FF.Button(Find.ById((string)aAddress[iIndex])).Click(); }
//Selected by Address and Radius private void SelectAreabyAddRadius(Testbase test) { // Wait for the page to appear iIndex = test.para.aKey.IndexOf("ByRadiusPage_Index"); sValue = (string)test.para.aValue[iIndex]; test.FF.WaitUntilContainsText(sValue); Assert.IsTrue(test.FF.ContainsText(sValue)); Thread.Sleep(5000); iIndex = test.para.aKey.IndexOf("Fill_Address"); sAdd = (string)test.para.aAddress[iIndex]; sValue = (string)test.para.aValue[iIndex]; test.FF.TextField(Find.ById(sAdd)).Select(); int iCount = 0; while((iCount <60000) & (test.FF.TextField(Find.ById(sAdd)).Text != sValue)) { test.FF.TextField(Find.ById(sAdd)).TypeText(sValue); iCount++; Thread.Sleep(500); } iIndex = test.para.aKey.IndexOf("Fill_Radius"); sAdd = (string)test.para.aAddress[iIndex]; sValue = (string)test.para.aValue[iIndex]; test.FF.TextField(Find.ById(sAdd)).Select(); while ((iCount < 60000) & (test.FF.TextField(Find.ById(sAdd)).Text != sValue)) { test.FF.TextField(Find.ById(sAdd)).TypeText(sValue); iCount++; Thread.Sleep(500); } Thread.Sleep(1000); // Click "Search" button iIndex = test.para.aKey.IndexOf("Search"); sAdd = (string)test.para.aAddress[iIndex]; test.FF.Span(Find.ByText(sAdd)).Click(); Thread.Sleep(2000); // Click "Next" button iIndex = test.para.aKey.IndexOf("Next3"); sAdd = (string)test.para.aAddress[iIndex]; test.FF.Span(Find.ByText(sAdd)).Click(); }
public void SelectDataSource(Testbase test) { int iIndex = test.para.aKey.IndexOf("DatasourcePage_Index"); string sValue = (string)test.para.aValue[iIndex]; string sAddress; test.FF.WaitUntilContainsText(sValue); Assert.IsTrue(test.FF.ContainsText(sValue)); // Get Datasource lead iIndex = test.para.aKey.IndexOf("Datasource"); sAddress = (string)test.para.aAddress[iIndex]; test.para.sDatasource = sAddress; test.FF.RadioButton(sAddress).Checked = true; // Get ID of Next button iIndex = test.para.aKey.IndexOf("Next1"); sValue = (string)test.para.aValue[iIndex]; test.FF.Span(Find.ByText(sValue)).Click(); }
public void AudienceSelect(Testbase test) { iIndex = test.para.aKey.IndexOf("ByAudiencePage_Index"); sValue = (string)test.para.aValue[iIndex]; test.FF.WaitUntilContainsText(sValue); Assert.IsTrue(test.FF.ContainsText(sValue)); if (test.para.sDatasource == "ctl00_ctl00_uxContent_uxContent_rbListType_2") { Occ_SelectDemo(test); return; } iIndex = test.para.aKey.IndexOf("Select All?"); sAdd = (string)test.para.aAddress[iIndex]; sValue = (string)test.para.aValue[iIndex]; if (sValue == "True") { test.FF.CheckBox(Find.ById(sAdd)).Click(); } else if(sValue == "False") { // Different datasources switch (test.para.sDatasource) { case "ctl00_ctl00_uxContent_uxContent_rbListType_0": Consumer_SelectDemo(test); break; case "ctl00_ctl00_uxContent_uxContent_rbListType_1": Business_SelectDemo(test); break; case "ctl00_ctl00_uxContent_uxContent_rbListType_2": Occ_SelectDemo(test); break; case "ctl00_ctl00_uxContent_uxContent_rbListType_3": HomeList_SelectDemo(test); break; case "ctl00_ctl00_uxContent_uxContent_rbListType_4": Mover_SelectDemo(test); break; } } else { //error } // Include phone number? iIndex = test.para.aKey.IndexOf("Include phone number?"); sAdd = (string)test.para.aAddress[iIndex]; test.FF.RadioButton(Find.ById(sAdd)).Checked = true; // Suppression // Waiting Thread.Sleep(1000); // Click "Next" button iIndex = test.para.aKey.IndexOf("Next4"); sAdd = (string)test.para.aAddress[iIndex]; test.FF.Span(Find.ByText(sAdd)).Click(); }
private void Occ_SelectDemo(Testbase test) { iIndex = test.para.aKey.IndexOf("Targeting Options"); sAdd = (string)test.para.aAddress[iIndex]; test.FF.CheckBox(Find.ById(sAdd)).Checked = false; iIndex = test.para.aKey.IndexOf("Route Options"); sAdd = (string)test.para.aAddress[iIndex]; test.FF.CheckBox(Find.ById(sAdd)).Checked = false; // Click "Next" button iIndex = test.para.aKey.IndexOf("Next4"); sAdd = (string)test.para.aAddress[iIndex]; test.FF.Span(Find.ByText(sAdd)).Click(); }
private void Consumer_SelectDemo(Testbase test) { // Demo iIndex = test.para.aKey.IndexOf("Select Demo1"); sAdd = (string)test.para.aAddress[iIndex]; test.FF.Link(Find.ByText(sAdd)).Click(); iIndex = test.para.aKey.IndexOf("Demo_Category1"); sAdd = (string)test.para.aAddress[iIndex]; sValue = (string)test.para.aValue[iIndex]; test.FF.SelectList(Find.ById(sAdd)).Option(Find.ByValue(sValue)).Select(); iIndex = test.para.aKey.IndexOf("Demo_Variable1"); sAdd = (string)test.para.aAddress[iIndex]; sValue = (string)test.para.aValue[iIndex]; test.FF.SelectList(Find.ById(sAdd)).Option(Find.ByValue(sValue)).Select(); test.FF.SelectList(Find.ById(sAdd)).Option(Find.ByValue(sValue)).DoubleClick(); // LifeStyle iIndex = test.para.aKey.IndexOf("Select Demo2"); sAdd = (string)test.para.aAddress[iIndex]; // the sAdd is "Lifestyle, Hobby & Purchase Options", but Find.ByText() cannot find it. test.FF.Link(Find.ByText("Lifestyle, Hobby & Purchase Options")).Click(); iIndex = test.para.aKey.IndexOf("Demo_Category2"); sAdd = (string)test.para.aAddress[iIndex]; sValue = (string)test.para.aValue[iIndex]; test.FF.SelectList(Find.ById(sAdd)).Option(Find.ByValue(sValue)).Select(); iIndex = test.para.aKey.IndexOf("Demo_Variable2"); sAdd = (string)test.para.aAddress[iIndex]; sValue = (string)test.para.aValue[iIndex]; test.FF.SelectList(Find.ById(sAdd)).Option(Find.ByValue(sValue)).Select(); test.FF.SelectList(Find.ById(sAdd)).Option(Find.ByValue(sValue)).DoubleClick(); }
// Selected by Zip codes private void SelectAreaByZip(Testbase test) { // Wait for the page to appear iIndex = test.para.aKey.IndexOf("ByZipPage_Index"); sValue = (string)test.para.aValue[iIndex]; test.FF.WaitUntilContainsText(sValue); Assert.IsTrue(test.FF.ContainsText(sValue)); // Input three zip codes for (int i = 1; i < 4; i++) { iIndex = test.para.aKey.IndexOf("Zipcode" + i.ToString()); sAdd = (string)test.para.aAddress[iIndex]; sValue = (string)test.para.aValue[iIndex]; test.FF.TextField(Find.ById(sAdd)).TypeText(sValue); } // Click "Next" button iIndex = test.para.aKey.IndexOf("Next3"); sAdd = (string)test.para.aAddress[iIndex]; test.FF.Span(Find.ByText(sAdd)).Click(); }
//Selected the entire US private void SelectAreabyUS(Testbase test) { // }
// Check whether or not the order has been finished. private void JudgeOrderComplete(Testbase test) { iIndex = test.para.aKey.IndexOf("OrderCompletePage_Index"); sValue = (string)test.para.aAddress[iIndex]; test.FF.WaitUntilContainsText(sValue); Assert.IsTrue(test.FF.ContainsText(sValue)); }
// When count is less than 100, warn information should be shown to remind users private void CountLessThanLimitation(Testbase test) { test.FF.WaitUntilContainsText("The quantity that you desired is less than the minimum quantity of 100."); Assert.IsTrue(test.FF.ContainsText("The quantity that you desired is less than the minimum quantity of 100.")); }
//Selected by SCF private void SelectAreabySCF(Testbase test) { // Wait for the page to appear iIndex = test.para.aKey.IndexOf("BySCFPage_Index"); sValue = (string)test.para.aValue[iIndex]; test.FF.WaitUntilContainsText(sValue); Assert.IsTrue(test.FF.ContainsText(sValue)); // Input a zip code iIndex = test.para.aKey.IndexOf("SCF"); sAdd = (string)test.para.aAddress[iIndex]; sValue = (string)test.para.aValue[iIndex]; test.FF.TextField(Find.ById(sAdd)).TypeText(sValue); // Click "Next" button iIndex = test.para.aKey.IndexOf("Next3"); sAdd = (string)test.para.aAddress[iIndex]; test.FF.Span(Find.ByText(sAdd)).Click(); }
//Selected by County private void SelectAreabyCounty(Testbase test) { // Wait for the page to appear iIndex = test.para.aKey.IndexOf("ByCountyPage_Index"); sValue = (string)test.para.aValue[iIndex]; test.FF.WaitUntilContainsText(sValue); Assert.IsTrue(test.FF.ContainsText(sValue)); // Input three Cities for (int i = 1; i < 4; i++) { iIndex = test.para.aKey.IndexOf("County_State" + i.ToString()); sAdd = (string)test.para.aAddress[iIndex]; sValue = (string)test.para.aValue[iIndex]; test.FF.SelectList(Find.ById(sAdd)).Option(Find.ByValue(sValue)).Select(); iIndex = test.para.aKey.IndexOf("County" + i.ToString()); sAdd = (string)test.para.aAddress[iIndex]; sValue = (string)test.para.aValue[iIndex]; test.FF.SelectList(Find.ById(sAdd)).Option(Find.ByValue(sValue)).Select(); test.FF.SelectList(Find.ById(sAdd)).Option(Find.ByValue(sValue)).DoubleClick(); } // Click "Next" button iIndex = test.para.aKey.IndexOf("Next3"); sAdd = (string)test.para.aAddress[iIndex]; test.FF.Span(Find.ByText(sAdd)).Click(); }
// Click "Save Count" button private void SaveCount(Testbase test) { // Wait until the page appears iIndex = test.para.aKey.IndexOf("SaveCountDialog_Index"); sValue = (string)test.para.aValue[iIndex]; test.FF.WaitUntilContainsText(sValue); Assert.IsTrue(test.FF.ContainsText(sValue)); // Fill save information iIndex = test.para.aKey.IndexOf("Save_Firstname"); sAdd = (string)test.para.aAddress[iIndex]; sValue = (string)test.para.aValue[iIndex]; test.FF.TextField(Find.ById(sAdd)).TypeText(sValue); iIndex = test.para.aKey.IndexOf("Save_Lastname"); sAdd = (string)test.para.aAddress[iIndex]; sValue = (string)test.para.aValue[iIndex]; test.FF.TextField(Find.ById(sAdd)).TypeText(sValue); iIndex = test.para.aKey.IndexOf("Save_Email"); sAdd = (string)test.para.aAddress[iIndex]; sValue = (string)test.para.aValue[iIndex]; test.FF.TextField(Find.ById(sAdd)).TypeText(sValue); iIndex = test.para.aKey.IndexOf("Save_Ordername"); sAdd = (string)test.para.aAddress[iIndex]; sValue = (string)test.para.aValue[iIndex]; test.FF.TextField(Find.ById(sAdd)).TypeText(sValue); iIndex = test.para.aKey.IndexOf("SaveCount button"); sAdd = (string)test.para.aAddress[iIndex]; test.FF.Span(Find.ByText(sAdd)).Click(); JudgeSaveCountComplete(test); }
public void JudgeCounting(Testbase test) { // Wait until the page appears iIndex = test.para.aKey.IndexOf("CountAndQuotePage_Index"); sAdd = (string)test.para.aAddress[iIndex]; int iCount1 = 0; int iCount2 = 0; Thread.Sleep(10000); while ((iCount1 == 0) & iCount2 < 200000) { if (test.FF.Span(Find.ByText(sAdd)).Exists) { iCount1 = 1; } iCount2++; } Thread.Sleep(20000); if (test.para.sDatasource == "ctl00_ctl00_uxContent_uxContent_rbListType_2") { Occ_PlaceOrder(test); return; //Datasource occ's counting page is different, I have to make a different function. } // Judge the number of count.If it's less than 100, placing order is forbidden. iIndex = test.para.aKey.IndexOf("Count Judgement"); sAdd = (string)test.para.aAddress[iIndex]; sValue = (string)test.para.aValue[iIndex]; iIndex = test.para.aKey.IndexOf("SelectAreaType"); string sByAreas = (string)test.para.aAddress[iIndex]; int iTotal; if (sByAreas == "geo_type_radius") { iTotal = Convert.ToInt32(test.FF.Table(sAdd).OwnTableRows[test.FF.Table(sAdd).OwnTableRows.Count - 1].TextFields[0].Value); } else { iTotal = Convert.ToInt32(test.FF.Table(sAdd).TextFields[test.FF.Table(sAdd).TextFields.Count - 1].Value); } int iSetTotalNumber = Convert.ToInt32(sValue); iIndex = test.para.aKey.IndexOf("Select: Save Count(T) or Next(F)"); string sSaveCount = (string)test.para.aValue[iIndex]; if(sSaveCount == "False") // Click "Next" { if(iTotal < 100) // Warning information shown, and not goto next page. { iIndex = test.para.aKey.IndexOf("Address of Save Count or Next"); sValue = (string)test.para.aValue[iIndex]; test.FF.Span(Find.ByText(sValue)).Click(); CountLessThanLimitation(test); } else // Goto Filling Payment Information page { // Set a total number if (iTotal > iSetTotalNumber) { iIndex = test.para.aKey.IndexOf("Count Judgement"); sAdd = (string)test.para.aAddress[iIndex]; test.FF.Table(sAdd).TextFields[test.FF.Table(sAdd).TextFields.Count - 1].TypeText(Convert.ToString(iSetTotalNumber)); } Thread.Sleep(2000); // Using the list for single time or multiple times? iIndex = test.para.aKey.IndexOf("Using this list multiple times?"); sAdd = (string)test.para.aAddress[iIndex]; test.FF.RadioButton(Find.ById(sAdd)).Checked = true; // Using mailing lables? iIndex = test.para.aKey.IndexOf("Using mailing labels?"); sAdd = (string)test.para.aAddress[iIndex]; test.FF.RadioButton(Find.ById(sAdd)).Checked = true; iIndex = test.para.aKey.IndexOf("Address of Save Count or Next"); sValue = (string)test.para.aValue[iIndex]; test.FF.Span(Find.ByText(sValue)).Click(); // File payment information FillInformation(test); } } else if (sSaveCount == "True") // Clck "Save Count" { iIndex = test.para.aKey.IndexOf("Address of Save Count or Next"); sValue = (string)test.para.aValue[iIndex]; test.FF.Span(Find.ByText(sValue)).Click(); SaveCount(test); } }
// The Count & Quote page of Occ lead is diffrent from those of other datasources private void Occ_PlaceOrder(Testbase test) { iIndex = test.para.aKey.IndexOf("Count Judgement"); sAdd = (string)test.para.aAddress[iIndex]; sValue = (string)test.para.aValue[iIndex]; int iTotal; int iTableCellCount = test.FF.Table(Find.ByClass(sAdd)).TableRows[2].TableCells.Count; iTotal = Convert.ToInt32(test.FF.Table(Find.ByClass(sAdd)).Span(Find.ById(sValue)).Text); iIndex = test.para.aKey.IndexOf("Select: Save Count(T) or Next(F)"); string sSaveCount = (string)test.para.aValue[iIndex]; if (sSaveCount == "False") // Click "Next" { if (iTotal < 100) // Warning information shown, and not goto next page. { iIndex = test.para.aKey.IndexOf("Address of Save Count or Next"); sValue = (string)test.para.aValue[iIndex]; test.FF.Span(Find.ByText(sValue)).Click(); CountLessThanLimitation(test); } else // Goto Filling Payment Information page { // Using the list for single time or multiple times? iIndex = test.para.aKey.IndexOf("Using this list multiple times?"); sAdd = (string)test.para.aAddress[iIndex]; test.FF.RadioButton(Find.ById(sAdd)).Checked = true; // Using mailing lables? iIndex = test.para.aKey.IndexOf("Using mailing labels?"); sAdd = (string)test.para.aAddress[iIndex]; test.FF.RadioButton(Find.ById(sAdd)).Checked = true; iIndex = test.para.aKey.IndexOf("Address of Save Count or Next"); sValue = (string)test.para.aValue[iIndex]; test.FF.Span(Find.ByText(sValue)).Click(); // File payment information FillInformation(test); } } else if (sSaveCount == "True") // Clck "Save Count" { iIndex = test.para.aKey.IndexOf("Address of Save Count or Next"); sValue = (string)test.para.aValue[iIndex]; test.FF.Span(Find.ByText(sValue)).Click(); SaveCount(test); } }
// Check whether or not the order has been finished. private void JudgeSaveCountComplete(Testbase test) { iIndex = test.para.aKey.IndexOf("AfterSave"); sValue = (string)test.para.aAddress[iIndex]; test.FF.WaitUntilContainsText(sValue); Assert.IsTrue(test.FF.ContainsText(sValue)); }
private void Business_SelectDemo(Testbase test) { // Demo iIndex = test.para.aKey.IndexOf("Select Demo1"); sAdd = (string)test.para.aAddress[iIndex]; test.FF.Link(Find.ByText(sAdd)).Click(); iIndex = test.para.aKey.IndexOf("Demo_Category1"); sAdd = (string)test.para.aAddress[iIndex]; sValue = (string)test.para.aValue[iIndex]; test.FF.SelectList(Find.ById(sAdd)).Option(Find.ByValue(sValue)).Select(); iIndex = test.para.aKey.IndexOf("Demo_Variable1"); sAdd = (string)test.para.aAddress[iIndex]; sValue = (string)test.para.aValue[iIndex]; test.FF.SelectList(Find.ById(sAdd)).Option(Find.ByValue(sValue)).Select(); test.FF.SelectList(Find.ById(sAdd)).Option(Find.ByValue(sValue)).DoubleClick(); }
//Selected by State private void SelectAreabyState(Testbase test) { // Wait for the page to appear iIndex = test.para.aKey.IndexOf("ByStatePage_Index"); sValue = (string)test.para.aValue[iIndex]; test.FF.WaitUntilContainsText(sValue); Assert.IsTrue(test.FF.ContainsText(sValue)); // Input a state iIndex = test.para.aKey.IndexOf("State"); sAdd = (string)test.para.aAddress[iIndex]; sValue = (string)test.para.aValue[iIndex]; test.FF.SelectList(Find.ById(sAdd)).Option(Find.ByValue(sValue)).Select(); test.FF.SelectList(Find.ById(sAdd)).Option(Find.ByValue(sValue)).DoubleClick(); // Click "Next" button iIndex = test.para.aKey.IndexOf("Next3"); sAdd = (string)test.para.aAddress[iIndex]; test.FF.Span(Find.ByText(sAdd)).Click(); }
// Click "Next" Button private void FillInformation(Testbase test) { // Wait until the page appears iIndex = test.para.aKey.IndexOf("PaymentInformationPage_Index"); sValue = (string)test.para.aAddress[iIndex]; test.FF.WaitUntilContainsText(sValue); Assert.IsTrue(test.FF.ContainsText(sValue)); // Fill information iIndex = test.para.aKey.IndexOf("Information_Firstname"); sAdd = (string)test.para.aAddress[iIndex]; sValue = (string)test.para.aValue[iIndex]; test.FF.TextField(Find.ById(sAdd)).TypeText(sValue); iIndex = test.para.aKey.IndexOf("Information_Lastname"); sAdd = (string)test.para.aAddress[iIndex]; sValue = (string)test.para.aValue[iIndex]; test.FF.TextField(Find.ById(sAdd)).TypeText(sValue); iIndex = test.para.aKey.IndexOf("Information_Address"); sAdd = (string)test.para.aAddress[iIndex]; sValue = (string)test.para.aValue[iIndex]; test.FF.TextField(Find.ById(sAdd)).TypeText(sValue); iIndex = test.para.aKey.IndexOf("Information_City"); sAdd = (string)test.para.aAddress[iIndex]; sValue = (string)test.para.aValue[iIndex]; test.FF.TextField(Find.ById(sAdd)).TypeText(sValue); iIndex = test.para.aKey.IndexOf("Information_State"); sAdd = (string)test.para.aAddress[iIndex]; sValue = (string)test.para.aValue[iIndex]; test.FF.SelectList(Find.ById(sAdd)).Option(Find.ByValue(sValue)).Select(); iIndex = test.para.aKey.IndexOf("Information_Zip"); sAdd = (string)test.para.aAddress[iIndex]; sValue = (string)test.para.aValue[iIndex]; test.FF.TextField(Find.ById(sAdd)).TypeText(sValue); iIndex = test.para.aKey.IndexOf("Information_Email"); sAdd = (string)test.para.aAddress[iIndex]; sValue = (string)test.para.aValue[iIndex]; test.FF.TextField(Find.ById(sAdd)).TypeText(sValue); iIndex = test.para.aKey.IndexOf("Information_Ordername"); sAdd = (string)test.para.aAddress[iIndex]; sValue = (string)test.para.aValue[iIndex]; test.FF.TextField(Find.ById(sAdd)).TypeText(sValue); iIndex = test.para.aKey.IndexOf("Information_SameAsContact"); sAdd = (string)test.para.aAddress[iIndex]; test.FF.CheckBox(Find.ById(sAdd)).Checked = true; iIndex = test.para.aKey.IndexOf("Information_PaymentAgreement"); sAdd = (string)test.para.aAddress[iIndex]; test.FF.CheckBox(Find.ById(sAdd)).Checked = true; iIndex = test.para.aKey.IndexOf("Information_CardNumber"); sAdd = (string)test.para.aAddress[iIndex]; sValue = (string)test.para.aValue[iIndex]; test.FF.TextField(Find.ById(sAdd)).TypeText(sValue); iIndex = test.para.aKey.IndexOf("Information_SecurityCode"); sAdd = (string)test.para.aAddress[iIndex]; sValue = (string)test.para.aValue[iIndex]; test.FF.TextField(Find.ById(sAdd)).TypeText(sValue); iIndex = test.para.aKey.IndexOf("Place Order"); sValue = (string)test.para.aValue[iIndex]; test.FF.Span(Find.ByText(sValue)).Click(); JudgeOrderComplete(test); }