public void ChooseService(ServiceToTry serviceToTry) { if (!GraphBrowser.Url.Contains("/quick-start")) { GraphBrowser.Goto(GraphUtility.RemoveRedundantPartsfromExtractBaseAddress() + "/quick-start#try-it-out"); } int serviceIndex = (int)serviceToTry; string serviceSuffix = string.Empty; switch (serviceToTry) { case ServiceToTry.GetContacts: serviceSuffix = "-get-contacts"; break; case ServiceToTry.GetEvents: serviceSuffix = "-get-calendars"; break; case ServiceToTry.GetFiles: serviceSuffix = "-get-files"; break; case ServiceToTry.GetGroups: serviceSuffix = "-get-groups"; break; case ServiceToTry.GetMessages: serviceSuffix = "-get-mails"; break; case ServiceToTry.GetUsers: serviceSuffix = "-get-users"; break; default: break; } //var service = GraphBrowser.Driver.FindElement(By.Id("serviceOption"+serviceIndex)); var service = GraphBrowser.Driver.FindElement(By.Id("serviceOption" + serviceSuffix)); GraphBrowser.Click(service); currentSerivce = serviceToTry; }
public void Comps_S05_TC04_CanTryO365API_GetFiles() { ServiceToTry service = ServiceToTry.GetFiles; Pages.Office365Page.CardTryItOut.ChooseService(service); int currentWidth = 0; int currentHeight = 0; Browser.GetWindowSize(out currentWidth, out currentHeight); if (currentWidth > Utility.MinWidthToShowParam) { foreach (GetFilesValue item in Enum.GetValues(typeof(GetFilesValue))) { Pages.Office365Page.CardTryItOut.ChooseServiceValue(item); Pages.Office365Page.CardTryItOut.ClickTry(); Assert.IsTrue(Pages.Office365Page.CardTryItOut.CanGetResponse(item), string.Format("The service {0} with parameter {1} is not work.", service.ToString(), item.ToString())); Assert.IsTrue(Pages.Office365Page.CardTryItOut.UrlContainsParameterValue(), string.Format("The parameter {0} of service {1} is not contained in the url.", item.ToString(), service.ToString())); } } else { Pages.Office365Page.CardTryItOut.ClickTry(); Assert.IsTrue(Pages.Office365Page.CardTryItOut.CanGetResponse(GetFilesValue.drive_root_children), string.Format("The service {0} with parameter {1} is not work.", service.ToString(), GetFilesValue.drive_root_children.ToString())); Assert.IsTrue(Pages.Office365Page.CardTryItOut.UrlContainsParameterValue(), string.Format("The parameter {0} of service {1} is not contained in the url.", GetFilesValue.drive_root_children.ToString(), service.ToString())); } }
public void Comps_S05_TC06_CanTryO365API_GetContacts() { ServiceToTry service = ServiceToTry.GetContacts; Pages.Office365Page.CardTryItOut.ChooseService(service); Pages.Office365Page.CardTryItOut.ClickTry(); Assert.IsTrue(Pages.Office365Page.CardTryItOut.CanGetResponse(null)); Assert.IsTrue(Pages.Office365Page.CardTryItOut.UrlContainsServiceName(), string.Format("The name of service {0} is not contained in the url.", service.ToString())); }
public void ChooseService(ServiceToTry serviceToTry) { if (!Browser.Url.Contains("/getting-started/office365apis")) { Browser.Goto(Browser.BaseAddress + "/getting-started/office365apis#try-it-out"); } int serviceIndex = (int)serviceToTry; var service = Browser.Driver.FindElement(By.Id("serviceOption" + serviceIndex)); Browser.Click(service); currentSerivce = serviceToTry; }