Ejemplo n.º 1
0
        public void CreateACourse()
        {
            //Arrange
            var loginPage = new LoginPage(_driver);  // >>>>>>>Loginto Admnin portal
            AdminNewCoursePage                adminNewCourse = new AdminNewCoursePage(_driver);
            AdminCoachingNormalAdultPage      normalAdult    = new AdminCoachingNormalAdultPage(_driver);
            AdminAddCoursePage                adminAddCourse = new AdminAddCoursePage(_driver);
            AdminCoachingNormalAdultTablePage courseUI       = new AdminCoachingNormalAdultTablePage(_driver);

            // Act
            loginPage.Login();
            adminNewCourse.SelectCoaching();
            adminNewCourse.ClickViewCourse();
            adminNewCourse.ClickProgrammes();
            normalAdult.ClickAddNewCourse();
            normalAdult.SelectShortCourse();

            //Generate a course name --> this will be passed as name to create the new course
            var courseName = "Automation_ " + RandomGenerator.RandomString(3, false);

            Console.WriteLine(courseName);
            string courseCreatedMessage = adminAddCourse.addNewCourse(courseName, "100");

            // Assert
            Assert.AreEqual(courseCreatedMessage, "COURSE SUCCESSFULLY CREATED", "The names match");

            // Go back to the active courses
            adminNewCourse.SelectCoaching();
            adminNewCourse.ClickViewCourse();
            adminNewCourse.ClickProgrammes();

            //Search the UI for the verifying that the course is present
            courseUI.SearchCourseUI(courseName);
            //Click the course direct link
            courseUI.ClickDirectLink();
            //Switch to the new tab when the course direct link has launched
            courseUI.SwitchToDirectLinkPage();

            // Assert that the course name on the direct link matches with the name that was used to create the course.
            string courseNameFromDirectLinkPage = courseUI.GetCourseNameFromDirectLinkPage();

            Assert.AreEqual(courseName, courseNameFromDirectLinkPage, "The names match");
        }
Ejemplo n.º 2
0
        public void RefundACourseBooking()
        {
            //Arrange
            var loginPage = new LoginPage(_driver);  // >>>>>>>Login to Admnin portal
            AdminNewCoursePage                adminNewCourse = new AdminNewCoursePage(_driver);
            AdminCoachingNormalAdultPage      normalAdult    = new AdminCoachingNormalAdultPage(_driver);
            AdminAddCoursePage                adminAddCourse = new AdminAddCoursePage(_driver);
            AdminCoachingNormalAdultTablePage courseUI       = new AdminCoachingNormalAdultTablePage(_driver);
            AdminLogOutPage       adminLogout           = new AdminLogOutPage(_driver);
            CreateNewMemberPage   createNewMember       = new CreateNewMemberPage(_driver);
            MemberHomePage        memberHomePage        = new MemberHomePage(_driver);
            MemberCoachingTabPage memberCoachingTabPage = new MemberCoachingTabPage(_driver);
            MemberBookingPage     memberBookingPage     = new MemberBookingPage(_driver);
            MemberCoachingBookingConfirmationPage bookingConfirmation = new MemberCoachingBookingConfirmationPage(_driver);
            MemberLogoutPage memberLogout = new MemberLogoutPage(_driver);
            AdminCoachingSearchCoursePage       searchCourse            = new AdminCoachingSearchCoursePage(_driver);
            AdminCoachingAttendeesListPage      selectAttendee          = new AdminCoachingAttendeesListPage(_driver);
            AdminCoachingIndividualAttendeePage selectAttendeeForRefund = new AdminCoachingIndividualAttendeePage(_driver);
            // stripe details
            StripeLogInPage         logIn        = new StripeLogInPage(_driver);
            StripePaymentRefundPage stripeRefund = new StripePaymentRefundPage(_driver);


            // Act
            loginPage.Login();
            adminNewCourse.SelectCoaching();
            adminNewCourse.ClickViewCourse();
            adminNewCourse.ClickProgrammes();
            normalAdult.ClickAddNewCourse();
            normalAdult.SelectShortCourse();

            //Generate a course name --> this will be passed as name to create the new course
            var courseName = "Automation_1" + RandomGenerator.RandomString(3, false);

            Console.WriteLine(courseName);
            string courseCreatedMessage = adminAddCourse.addNewCourse(courseName, "100");

            _driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(15);
            // Assert
            Assert.AreEqual(courseCreatedMessage, "COURSE SUCCESSFULLY CREATED", "The names match");
            adminLogout.LogoutOfAdmin();

            // Below to generate random email
            string emailid = GenerateEmailId.GenerateRandomEmailId();

            // create a new user and join the course created above
            createNewMember.RegisterUser("Mary", "Lin", emailid, emailid);

            string newMember = createNewMember.getMemberText();

            Console.WriteLine("The new member created is :" + newMember);

            //Assert   --> Verify the new member created
            Assert.AreEqual(createNewMember.getMemberText(), "Mary Lin", "The names should match");

            //Act
            memberHomePage.SelectCoachingTab();
            memberCoachingTabPage.JoinACourse(courseName);
            memberBookingPage.SelectCourseBooking();
            memberBookingPage.EnterStripeAccount();
            string bookingConfirmText = bookingConfirmation.BookingConfirmationText();

            //Assert
            Assert.AreEqual(bookingConfirmText, "Thank you for booking", "The names should match");
            memberLogout.SignOut();

            //Act
            // Sign into admin account and search for the course enrolled by the member
            loginPage.Login();
            memberHomePage.SelectCoachingTab();
            adminNewCourse.ClickViewCourse();
            adminNewCourse.ClickProgrammes();
            searchCourse.SearchCourseForCancellation(courseName);
            selectAttendee.SelectAttendee();
            string emailIdFromRefund = selectAttendeeForRefund.ReadEmailID();

            Console.WriteLine(emailIdFromRefund);

            //Assert
            Assert.AreEqual(emailIdFromRefund, emailid, "The names should match");

            // Act
            //  Start the refunding process
            selectAttendeeForRefund.ClickRefund();
            _driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
            selectAttendeeForRefund.SelectConfirmCheckbox();
            selectAttendeeForRefund.ClickYes();
            Thread.Sleep(10000);//--> this is used as a jquery call updates the payment status. Webdriver Implicit and explicit is not working
            string status = selectAttendeeForRefund.RefundStatus();

            Console.WriteLine(status);
            Assert.AreEqual(status, "REFUNDED", "The names should match");
            adminLogout.LogoutOfAdmin();

            // Act
            // Verify in stripe for refund
            logIn.LogInToStripe("*****@*****.**", "Sp0rtlabs123");
            stripeRefund.CLickOnRefunded();
            stripeRefund.SearchEmailId(emailid);
            string refundStatus = stripeRefund.RefundStatus();

            Console.WriteLine(refundStatus);

            //Assert
            Assert.AreEqual(refundStatus, "Refunded", "The names should match");
        }