Exemplo n.º 1
0
        public void CheckCreateStyle(StyleHeaderData data)
        {
            SeleniumGetMethod.WaitForPageLoad(driver);
            // Go To Style Folder
            var pageStyle = _pages.GetPage <PageObjectStyle>();

            _reportingTasks.Log(Status.Info, "UserAuto go to Style Folder " + "<br>" + driver.Url + "</br>");
            pageStyle.OpenStyle();

            //Go to Style New
            var pageNew = _pages.GetPage <PageObjectStyle>().ClickNewStyle();

            //Check page New Header
            pageNew.Createpage(data);
            driver.SwitchTo().Window(pageNew.WindowHandle).Close();
        }
        public void Createpage(StyleHeaderData data)
        {
            var textHeaderNew = driver.Title;

            Assert.AreEqual("New Style", textHeaderNew, "Text not found!!!");
            PropertiesCollection._reportingTasks.Log(Status.Info, "UserAuto go to Page " + textHeaderNew + "<br>" + driver.Url + "</br>");

            if (!string.IsNullOrWhiteSpace(data.Division))
            {
                new SelectElement(drlDivisionID).SelectByText(data.Division);
            }
            if (!string.IsNullOrWhiteSpace(data.StyleType))
            {
                new SelectElement(drlStyleType).SelectByText(data.StyleType);
            }
            if (!string.IsNullOrWhiteSpace(data.WorkflowType))
            {
                new SelectElement(drlWorkflowType).SelectByText(data.WorkflowType);
            }

            if (!string.IsNullOrWhiteSpace(data.IntroSeasonYear))
            {
                new SelectElement(isyDropDown).SelectByText(data.IntroSeasonYear);
            }
            else
            {
                SeleniumSetMethods.SelectDropDown(isyDropDown, 2);
            }
            if (!string.IsNullOrWhiteSpace(data.Calendar))
            {
                new SelectElement(drlCalendar).SelectByText(data.Calendar);
            }
            btnNext.Click();
            SeleniumGetMethod.WaitForPageLoad(driver);

            if (!string.IsNullOrWhiteSpace(data.StyleNo))
            {
                new SelectElement(noStyles).SelectByText(data.StyleNo);
            }
            if (!string.IsNullOrWhiteSpace(data.StyleSet))
            {
                new SelectElement(drlStyleSet).SelectByText(data.StyleSet);
            }
            if (!string.IsNullOrWhiteSpace(data.StyleCategory))
            {
                new SelectElement(syleCategoryDropDown).SelectByText(data.StyleCategory);
            }
            else
            {
                SeleniumSetMethods.SelectDropDown(syleCategoryDropDown, 2);
                new WebDriverWait(driver, TimeSpan.FromSeconds(500)).Until(ExpectedConditions.ElementIsVisible((By.Id("btnSaveStyle"))));
            }
            if (!string.IsNullOrWhiteSpace(data.SizeClass))
            {
                SeleniumGetMethod.WaitForPageLoad(driver);
                new SelectElement(drlSizeClassId).SelectByText(data.SizeClass);
            }
            if (!string.IsNullOrWhiteSpace(data.SizeRange))
            {
                SeleniumGetMethod.WaitForPageLoad(driver);
                new SelectElement(drlSizeRangeId).SelectByText(data.SizeRange);
            }
            if (!string.IsNullOrWhiteSpace(data.Description))
            {
                SeleniumGetMethod.WaitForPageLoad(driver);
                txtDescription.SendKeys(data.Description);
            }
            if (!string.IsNullOrWhiteSpace(data.Active))
            {
                SeleniumGetMethod.WaitForPageLoad(driver);
                new SelectElement(drlActive).SelectByText(data.Active);
            }

            SeleniumGetMethod.WaitForPageLoad(driver);
            btnSaveStyle.Click();
            Thread.Sleep(5000);
            Assert.AreNotEqual(driver.Title, "New Style");
        }