示例#1
0
        public static void ExceptionLog(string message)
        {
            string screenName     = ScreenshotHelper.TakeScreenshot();
            string screenShotPath = TestReport.AddScreenCapture(screenName);

            TestReport.Log(LogStatus.Warning, screenShotPath + message);
        }
示例#2
0
 public static void ButtonIsDisabled(By locator)
 {
     try
     {
         Assert.IsNotNull(Driver.GetClickableElement((locator)).GetAttribute("disabled"));
     }
     catch (AssertionException e)
     {
         string screenName     = ScreenshotHelper.TakeScreenshot();
         string scrrenShotPath = TestReport.AddScreenCapture(screenName);
         TestReport.Log(LogStatus.Warning, scrrenShotPath + "Button is not disabled: " + e.Message);
     }
 }
示例#3
0
 public static void IsNotPresent(By locator)
 {
     try
     {
         Assert.IsFalse(ElementPresentBool(locator));
         TestReport.Log(LogStatus.Pass, "Element is not present: " + locator);
     }
     catch (AssertionException e)
     {
         string screenName     = ScreenshotHelper.TakeScreenshot();
         string screenShotPath = TestReport.AddScreenCapture(screenName);
         TestReport.Log(LogStatus.Warning, screenShotPath + "<br> Element is not present: " + e.Message);
     }
 }
示例#4
0
 public static void TitleIsPresent(string title)
 {
     try
     {
         (new WebDriverWait(Driver.Instance, TimeSpan.FromSeconds(10))).Until(ExpectedConditions.TitleContains(title));
         Assert.AreEqual(title, Driver.Instance.Title);
         TestReport.Log(LogStatus.Pass, "Title is present: " + title);
     }
     catch (AssertionException e)
     {
         string screenName     = ScreenshotHelper.TakeScreenshot();
         string scrrenShotPath = TestReport.AddScreenCapture(screenName);
         TestReport.Log(LogStatus.Warning, scrrenShotPath + "Title verification failed: " + e.Message);
     }
 }
示例#5
0
 public static void AreEqual(By locator, string elementName)
 {
     try
     {
         element = Driver.GetVisibleElement(locator);
         Assert.AreEqual(elementName, Driver.Instance.FindElement(locator).Text.Trim());
         TestReport.Log(LogStatus.Pass, "Element '" + elementName + "' is equal to '" + element.Text + "'");
     }
     catch (AssertionException e)
     {
         string screenName     = ScreenshotHelper.TakeScreenshot();
         string screenShotPath = TestReport.AddScreenCapture(screenName);
         TestReport.Log(LogStatus.Warning, screenShotPath + "<br> Element is not equal: " + e.Message);
     }
 }
示例#6
0
 public static void IsPresent(By locator)
 {
     //Driver.Instance.FindElement(locator);
     try
     {
         element = Driver.GetVisibleElement(locator);
         Assert.IsTrue(ElementPresentBool(locator));
         TestReport.Log(LogStatus.Pass, "Element is present: " + locator.ToString());
     }
     catch (AssertionException e)
     {
         string screenName     = ScreenshotHelper.TakeScreenshot();
         string screenShotPath = TestReport.AddScreenCapture(screenName);
         TestReport.Log(LogStatus.Warning, screenShotPath + "<br> Element is not present: " + e.Message);
     }
 }
示例#7
0
        public void DI_Resident_History___Assessments_display_on_Residents_History_Grid()
        {
            Browser.Open();
            LoginPage.SignIn();
            //Step 1  Select Resident History tile
            LandingPage.NavigateToResidentHistoryPage();
            //Step 2  Click SEARCH button
            Driver.ClickOn(SearchResidentsPage.searchButton);
            //Step 3  Select resident tile from the FIRST page
            Driver.ClickOn(SearchResidentsPage.firstResidentTile);
            //Step 4  Click CREATE MDS button
            Driver.ClickOn(ResidentsHistoryPage.createNewMDSBtn);
            SchedulePage.VistALogin();
            //Step 5  Create New MDS Assessment
            Driver.ClickOn(SchedulePage.carePlanReviewDateCalendar);
            Driver.ClickOn(SchedulePage.calendarTodayBtn);
            Driver.ClickOn(SchedulePage.a1600EntryDateCalendar);
            Driver.ClickOn(SchedulePage.calendarTodayBtn);
            Driver.ClickOn(SchedulePage.a01RadioBtn);
            Driver.ClickOn(SchedulePage.b02RadioBtn);
            Driver.ClickOn(SchedulePage.f99RadioBtn);
            Driver.ClickOn(SchedulePage.createNewMDSCreateBtnEnabled);
            VerifyElement.AreEqual(SchedulePage.assessmentHeader, "Assessment Header");
            //Step 6  Click Residents History link
            Driver.WaitForElement(By.XPath("//a[@class='ng-binding ng-scope'][contains(., 'History')]"));
            string aType1 = Driver.Instance.FindElement(By.XPath("(//p[@class='form-control-static ng-binding'])[1]")).Text.ToString();

            Driver.ClickOn(By.XPath("//a[@class='ng-binding ng-scope'][contains(., 'History')]"));
            VerifyElement.AreEqual(ResidentsHistoryPage.pageHeader, "Resident's History");
            string aType2 = Driver.Instance.FindElement(By.XPath("(//span[@class='lead ng-binding ng-scope'])[last()]//preceding-sibling::span")).Text.ToString();
            string aType3 = Driver.Instance.FindElement(By.XPath("(//span[@class='lead ng-binding ng-scope'])[last()]")).Text.ToString();
            //Step 7  Verify that  Assessment Type has display correctly on Residents History Grid
            string aTypeAdded = aType2 + " " + aType3;

            try
            {
                Assert.AreEqual(aType1, aTypeAdded);
                TestReport.Log(LogStatus.Pass, "Assessment type '" + aType1 + "' is equal to '" + aTypeAdded);
            }
            catch (AssertionException e)
            {
                string screenName     = ScreenshotHelper.TakeScreenshot();
                string screenShotPath = TestReport.AddScreenCapture(screenName);
                TestReport.Log(LogStatus.Warning, screenShotPath + "<br> Assessment type is not equal: " + e.Message);
            }
        }
示例#8
0
        public void CN_WIP___Verify_Number_of_assessments__bottom_right()
        {
            Browser.Open();
            LoginPage.SignIn();
            //Step 1  Select Work In Progress tile.
            LandingPage.NavigateToWorkInProgressPage();
            //Step 2  Verify that "Due in" slider bar have 7 days by default
            VerifyElement.IsPresent(By.XPath("//span[@class='ng-binding'][text()='7 days']"));
            //Step 3  Verify Number of assessments (bottom right)
            //Step 4  Verify that pages has 5 assessments per page if  number of assessments (bottom right) more(equal) 5 OR less than 5 assessments in the First page if  number of assessments less than 10.
            int firstPageResidents = Driver.Instance.FindElements(WorkInProgressPage.residentsList).Count;

            Driver.WaitForElement(WorkInProgressPage.residentsList);
            Assert.AreEqual(firstPageResidents, 5);
            //Step 5  Verify that number of assessments from pages equal number of assessments(bottom right)
            if (Driver.IsElementPresent(WorkInProgressPage.nextButton))
            {
                Driver.ClickOn(WorkInProgressPage.nextButton);
                Driver.WaitFor(3);
                int secondPageResidents = Driver.Instance.FindElements(WorkInProgressPage.residentsList).Count;
                if (Driver.IsElementPresent(WorkInProgressPage.nextButton))
                {
                    Driver.ClickOn(WorkInProgressPage.nextButton);
                    Driver.WaitFor(3);
                    int thirdPageResidents = Driver.Instance.FindElements(WorkInProgressPage.residentsList).Count;
                    if (Driver.IsElementPresent(WorkInProgressPage.nextButton))
                    {
                        Driver.ClickOn(WorkInProgressPage.nextButton);
                        Driver.WaitFor(3);
                        int fourthPageResidents = Driver.Instance.FindElements(WorkInProgressPage.residentsList).Count;
                        Driver.ClickOn(WorkInProgressPage.nextButton);
                        Driver.WaitFor(3);
                        string assessments = Driver.Instance.FindElement(WorkInProgressPage.totalAssessments).Text.ToString().Substring(0, 2);
                        try
                        {
                            Assert.AreEqual(firstPageResidents + secondPageResidents + thirdPageResidents + fourthPageResidents, Convert.ToInt32(assessments));
                            TestReport.Log(LogStatus.Pass, "Assessments are equal to: " + assessments);
                        }
                        catch (Exception e)
                        {
                            string screenName     = ScreenshotHelper.TakeScreenshot();
                            string screenShotPath = TestReport.AddScreenCapture(screenName);
                            TestReport.Log(LogStatus.Warning, screenShotPath + "Assessments are not equal to: " + assessments + e.Message);
                        }
                    }
                    else
                    {
                        string assessments = Driver.Instance.FindElement(WorkInProgressPage.totalAssessments).Text.ToString().Substring(0, 2);
                        try
                        {
                            Assert.AreEqual(firstPageResidents + secondPageResidents + thirdPageResidents, Convert.ToInt32(assessments));
                            TestReport.Log(LogStatus.Pass, "Assessments are equal to: " + assessments);
                        }
                        catch (Exception e)
                        {
                            string screenName     = ScreenshotHelper.TakeScreenshot();
                            string screenShotPath = TestReport.AddScreenCapture(screenName);
                            TestReport.Log(LogStatus.Warning, screenShotPath + "Assessments are not equal to: " + assessments + e.Message);
                        }
                    }
                }
                else
                {
                    string assessments = Driver.Instance.FindElement(WorkInProgressPage.totalAssessments).Text.ToString().Substring(0, 2);
                    try
                    {
                        Assert.AreEqual(firstPageResidents + secondPageResidents, Convert.ToInt32(assessments));
                        TestReport.Log(LogStatus.Pass, "Assessments are equal to: " + assessments);
                    }
                    catch (Exception e)
                    {
                        string screenName     = ScreenshotHelper.TakeScreenshot();
                        string screenShotPath = TestReport.AddScreenCapture(screenName);
                        TestReport.Log(LogStatus.Warning, screenShotPath + "Assessments are not equal to: " + assessments + e.Message);
                    }
                }
            }
            else
            {
                string assessments = Driver.Instance.FindElement(WorkInProgressPage.totalAssessments).Text.ToString().Substring(0, 2);
                Assert.AreEqual(firstPageResidents, Convert.ToInt32(assessments));
            }
            //Step 6  Slide slider bar to 1 day
            SchedulePage.MoveSlider(-2);
            Driver.ClickOn(SchedulePage.onePagination);
            Driver.WaitFor(4);
            //Step 7  Verify Number of assessments (bottom right)
            int firstPageResidents2 = Driver.Instance.FindElements(WorkInProgressPage.residentsList).Count;

            Assert.AreEqual(firstPageResidents2, 5);
            //Step 8  Verify that pages has 5 assessments per page if  number of assessments (bottom right) more(equal) 10 OR less than 10 assessments in the First page if  number of assessments less than 10.
            //Step 9  Verify that number of assessments from pages equal number of assessments(bottom right)
            if (Driver.IsElementPresent(WorkInProgressPage.nextButton))
            {
                Driver.ClickOn(WorkInProgressPage.nextButton);
                Driver.WaitFor(3);
                int secondPageResidents = Driver.Instance.FindElements(WorkInProgressPage.residentsList).Count;
                if (Driver.IsElementPresent(WorkInProgressPage.nextButton))
                {
                    Driver.ClickOn(WorkInProgressPage.nextButton);
                    Driver.WaitFor(3);
                    int thirdPageResidents = Driver.Instance.FindElements(WorkInProgressPage.residentsList).Count;
                    if (Driver.IsElementPresent(WorkInProgressPage.nextButton))
                    {
                        Driver.ClickOn(WorkInProgressPage.nextButton);
                        Driver.WaitFor(3);
                        int fourthPageResidents = Driver.Instance.FindElements(WorkInProgressPage.residentsList).Count;
                        Driver.ClickOn(WorkInProgressPage.nextButton);
                        Driver.WaitFor(3);
                        string assessments = Driver.Instance.FindElement(WorkInProgressPage.totalAssessments).Text.ToString().Substring(0, 2);
                        try
                        {
                            Assert.AreEqual(firstPageResidents2 + secondPageResidents + thirdPageResidents + fourthPageResidents, Convert.ToInt32(assessments));
                            TestReport.Log(LogStatus.Pass, "Assessments are equal to: " + assessments);
                        }
                        catch (Exception e)
                        {
                            string screenName     = ScreenshotHelper.TakeScreenshot();
                            string screenShotPath = TestReport.AddScreenCapture(screenName);
                            TestReport.Log(LogStatus.Warning, screenShotPath + "Assessments are not equal to: " + assessments + e.Message);
                        }
                    }
                    else
                    {
                        string assessments = Driver.Instance.FindElement(WorkInProgressPage.totalAssessments).Text.ToString().Substring(0, 2);
                        try
                        {
                            Assert.AreEqual(firstPageResidents2 + secondPageResidents + thirdPageResidents, Convert.ToInt32(assessments));
                            TestReport.Log(LogStatus.Pass, "Assessments are equal to: " + assessments);
                        }
                        catch (Exception e)
                        {
                            string screenName     = ScreenshotHelper.TakeScreenshot();
                            string screenShotPath = TestReport.AddScreenCapture(screenName);
                            TestReport.Log(LogStatus.Warning, screenShotPath + "Assessments are not equal to: " + assessments + e.Message);
                        }
                    }
                }
                else
                {
                    string assessments = Driver.Instance.FindElement(WorkInProgressPage.totalAssessments).Text.ToString().Substring(0, 2);
                    try
                    {
                        Assert.AreEqual(firstPageResidents2 + secondPageResidents, Convert.ToInt32(assessments));
                        TestReport.Log(LogStatus.Pass, "Assessments are equal to: " + assessments);
                    }
                    catch (Exception e)
                    {
                        string screenName     = ScreenshotHelper.TakeScreenshot();
                        string screenShotPath = TestReport.AddScreenCapture(screenName);
                        TestReport.Log(LogStatus.Warning, screenShotPath + "Assessments are not equal to: " + assessments + e.Message);
                    }
                }
            }
            else
            {
                string assessments = Driver.Instance.FindElement(WorkInProgressPage.totalAssessments).Text.ToString().Substring(0, 2);
                Assert.AreEqual(firstPageResidents2, Convert.ToInt32(assessments));
            }
            //Step 10 Slide slider bar to 370 days
            SchedulePage.MoveSlider(120);
            Driver.ClickOn(SchedulePage.onePagination);
            Driver.WaitFor(3);
            //Step 11 Verify Number of assessments (bottom right)
            int firstPageResidents3 = Driver.Instance.FindElements(WorkInProgressPage.residentsList).Count;

            Assert.AreEqual(firstPageResidents3, 5);
            //Step 12 Verify that pages has 5 assessments per page if  number of assessments (bottom right) more(equal) 10 OR less than 10 assessments in the First page if  number of assessments less than 10.
            //Step 13 Verify that number of assessments from pages equal number of assessments(bottom right)
            if (Driver.IsElementPresent(WorkInProgressPage.nextButton))
            {
                Driver.ClickOn(WorkInProgressPage.nextButton);
                Driver.WaitFor(3);
                int secondPageResidents = Driver.Instance.FindElements(WorkInProgressPage.residentsList).Count;
                if (Driver.IsElementPresent(WorkInProgressPage.nextButton))
                {
                    Driver.ClickOn(WorkInProgressPage.nextButton);
                    Driver.WaitFor(3);
                    int thirdPageResidents = Driver.Instance.FindElements(WorkInProgressPage.residentsList).Count;
                    if (Driver.IsElementPresent(WorkInProgressPage.nextButton))
                    {
                        Driver.ClickOn(WorkInProgressPage.nextButton);
                        Driver.WaitFor(3);
                        int fourthPageResidents = Driver.Instance.FindElements(WorkInProgressPage.residentsList).Count;
                        Driver.ClickOn(WorkInProgressPage.nextButton);
                        Driver.WaitFor(3);
                        string assessments = Driver.Instance.FindElement(WorkInProgressPage.totalAssessments).Text.ToString().Substring(0, 2);
                        try
                        {
                            Assert.AreEqual(firstPageResidents3 + secondPageResidents + thirdPageResidents + fourthPageResidents, Convert.ToInt32(assessments));
                            TestReport.Log(LogStatus.Pass, "Assessments are equal to: " + assessments);
                        }
                        catch (Exception e)
                        {
                            string screenName     = ScreenshotHelper.TakeScreenshot();
                            string screenShotPath = TestReport.AddScreenCapture(screenName);
                            TestReport.Log(LogStatus.Warning, screenShotPath + "Assessments are not equal to: " + assessments + e.Message);
                        }
                    }
                    else
                    {
                        string assessments = Driver.Instance.FindElement(WorkInProgressPage.totalAssessments).Text.ToString().Substring(0, 2);
                        try
                        {
                            Assert.AreEqual(firstPageResidents3 + secondPageResidents + thirdPageResidents, Convert.ToInt32(assessments));
                            TestReport.Log(LogStatus.Pass, "Assessments are equal to: " + assessments);
                        }
                        catch (Exception e)
                        {
                            string screenName     = ScreenshotHelper.TakeScreenshot();
                            string screenShotPath = TestReport.AddScreenCapture(screenName);
                            TestReport.Log(LogStatus.Warning, screenShotPath + "Assessments are not equal to: " + assessments + e.Message);
                        }
                    }
                }
                else
                {
                    string assessments = Driver.Instance.FindElement(WorkInProgressPage.totalAssessments).Text.ToString().Substring(0, 2);
                    try
                    {
                        Assert.AreEqual(firstPageResidents3 + secondPageResidents, Convert.ToInt32(assessments));
                        TestReport.Log(LogStatus.Pass, "Assessments are equal to: " + assessments);
                    }
                    catch (Exception e)
                    {
                        string screenName     = ScreenshotHelper.TakeScreenshot();
                        string screenShotPath = TestReport.AddScreenCapture(screenName);
                        TestReport.Log(LogStatus.Warning, screenShotPath + "Assessments are not equal to: " + assessments + e.Message);
                    }
                }
            }
            else
            {
                string assessments = Driver.Instance.FindElement(WorkInProgressPage.totalAssessments).Text.ToString().Substring(0, 2);
                Assert.AreEqual(firstPageResidents3, Convert.ToInt32(assessments));
            }
        }