Esempio n. 1
0
        public void SS_t_2_Clearing_Answers()
        {
            //Step #1: Log in Tester and open questionnaire
            pn_SignIn sign = new pn_SignIn (app);
            sign._SignIn ();
            pn_Dashboard dash = new pn_Dashboard (app);
            pn_InDetails in_det = dash.Open_Questionnaire (questionnaire, first_question);

            //Step #2: Verify that question is enabled
            AppResult[] question_is_enabled = app.Query(First_Answer(first_answer));
            Assert.IsTrue(question_is_enabled.Any(), "Step #2: Fail. Option can't be found");

            //Step #3: Answer the question and verify counters displaying
            in_det.AnswerSingle(first_question,first_answer);
            pn_Complete compl = in_det.Complete();
            if (!compl.IsAnsweredEqualsTo("1")) Assert.Fail ("Step #3.1: Expected: 1 Answered");
            if (!compl.IsUnansweredEqualsTo("No")) Assert.Fail ("Step #3.2: Expected: No Unanswered");
            if (!compl.IsErrorsEqualsTo("No")) Assert.Fail ("Step #3.3: Expected: No Errors");

            //Step #4: Remove answer
            in_det.Show_Side_Pane();
            in_det.TapElement (Section_Name (section_name));
            in_det.Wait_For_Element_Display (first_question, "Step #4: Fail. Back to section");
            in_det.TapElement (ClearAnswer);

            //Step #5: Verify counters displaying
            pn_Complete compl_unanswered = in_det.Complete();
            if (!compl_unanswered.IsAnsweredEqualsTo("No")) Assert.Fail ("Step #5.1: Expected: No Answered");
            if (!compl_unanswered.IsUnansweredEqualsTo("1")) Assert.Fail ("Step #5.2: Expected: 1 Unanswered");
            if (!compl_unanswered.IsErrorsEqualsTo("No")) Assert.Fail ("Step #5.3: Expected: No Errors");

            //Step #6: Answer with invalid option
            in_det.Show_Side_Pane();
            in_det.TapElement (Section_Name(section_name));
            in_det.Wait_For_Element_Display (first_question, "Step #6: Fail. Back to section");
            in_det.AnswerSingle (first_question, second_answer);

            //Step #7: Verify counters displaying
            pn_Complete compl_invalid = in_det.Complete();
            if (!compl_invalid.IsAnsweredEqualsTo("1")) Assert.Fail ("Step #7.1: Expected: 1 Answered");
            if (!compl_invalid.IsUnansweredEqualsTo("1")) Assert.Fail ("Step #7.2: Expected: 1 Unanswered");
            if (!compl_invalid.IsErrorsEqualsTo("1")) Assert.Fail ("Step #7.3: Expected: 1 Errors");

            //Step #8: Remove answer
            in_det.Show_Side_Pane();
            in_det.TapElement (Section_Name (section_name));
            in_det.Wait_For_Element_Display (first_question, "Step #8: Fail. Back to section");
            in_det.TapElement (ClearAnswer); //clear answer

            //Step #9: Verify counters displaying
            pn_Complete compl_removed = in_det.Complete();
            if (!compl_removed.IsAnsweredEqualsTo("No")) Assert.Fail ("Step #9.1: Expected: No Answered");
            if (!compl_removed.IsUnansweredEqualsTo("1")) Assert.Fail ("Step #9.2: Expected: 1 Unanswered");
            if (!compl_removed.IsErrorsEqualsTo("No")) Assert.Fail ("Step #9.3: Expected: No Errors");
        }
Esempio n. 2
0
        public void SS_t_3_Soft_Validation()
        {
            //Step #1: Log in Tester and open questionnaire
            pn_SignIn sign = new pn_SignIn (app);
            sign._SignIn ();
            pn_Dashboard dash = new pn_Dashboard (app);
            pn_InDetails in_det = dash.Open_Questionnaire (questionnaire, first_question);

            //Step #2: Verify that question is enabled
            AppResult[] question_is_enabled = app.Query(First_Answer(first_answer));
            Assert.IsTrue(question_is_enabled.Any(), "Step #2: Fail. Option can't be found");

            //Step #3: Check validation when question unanswered
            AppResult[] headerBeforeValidation = app.Query(c => c.Text("Answer is invalid"));
            if (headerBeforeValidation.Count()!=0) Assert.Fail ("Step #3: Fail. Error message is displayed but it shouldn't");

            //Step #4: Check validation when question valid answered
            in_det.AnswerSingle(first_question,first_answer);
            AppResult[] headerWhenValidAnswer = app.Query(c => c.Text("Answer is invalid"));
            if (headerWhenValidAnswer.Count()!=0) Assert.Fail ("Step #4: Fail. Error message is displayed but it shouldn't");

            //Step #5: Check validation when question invalid answered
            in_det.AnswerSingle (first_question, second_answer);
            in_det.Wait_For_Element_Display ("Answer is invalid", "Step #5: Fail. Validation is not applied");

            //Step #5.1: Verify header
            AppResult[] messageHeader = app.Query(c => c.Text("Answer is invalid"));
            Assert.IsTrue(messageHeader.Any(), "Step #5.1: Fail. Error Header is not displayed");

            //Step #5.2: Verify message
            AppResult[] message = app.Query(c => c.Text("validation error / answer [1]"));
            Assert.IsTrue(message.Any(), "Step #5.2: Fail. Message is not displayed or changed");

            //Step #6: Check Complete Errors counter
            pn_Complete complete = in_det.Complete();
            if (!complete.IsErrorsEqualsTo("1")) Assert.Fail ("Step #6: Expected: 1 Errors");

            //Step #7: Check that validation message is still displayed after switching panes
            in_det.Show_Side_Pane();
            in_det.TapElement (Section_Name(section_name));
            in_det.Wait_For_Element_Display (first_question, "Step #7: Fail. Back to section");

            //Step #7.1: Verify header
            AppResult[] messageHeader_1 = app.Query(c => c.Text("Answer is invalid"));
            Assert.IsTrue(messageHeader_1.Any(), "Step #7.1: Fail. Error Header is not displayed");

            //Step #7.2: Verify message
            AppResult[] message_1 = app.Query(c => c.Text("validation error / answer [1]"));
            Assert.IsTrue(message_1.Any(), "Step #7.2: Fail. Message is not displayed");
        }