Exemple #1
0
        public void splashPage_logIn()
        {
            var agent     = ConfigurationManager.AppSettings["Browser"];
            var cbtapi    = new CBTApi();
            var sessionId = ((RemoteWebDriver)Driver.Instance).SessionId.ToString();
            var caps      = new DesiredCapabilities();

            if (agent == "Remote_CBT")
            {
                try
                {
                    caps.SetCapability("name", "Club Automation Test: splashPage_logIn");
                    caps.SetCapability("build", "TestCase #");

                    SplashPage.GoTo();
                    SplashPage.AssertPageTitle();
                    SplashPage.EnterUsername();
                    SplashPage.EnterPassword();
                    cbtapi.takeSnapshot(sessionId);
                    SplashPage.ClickLoginBtn();
                    LocationSelector.SelectLocation();
                    LocationSelector.SelectPos();
                    LocationSelector.ClickSelect();
                    DashboardPage.AssertLoggedUserName();
                    cbtapi.takeSnapshot(sessionId);
                    log.InfoFormat($"{TestContext.TestName} - Test Passed");
                    cbtapi.setScore(sessionId, "Pass");
                }
                catch (Exception e)
                {
                    var snapshotHash = cbtapi.takeSnapshot(sessionId);
                    cbtapi.setDescription(sessionId, snapshotHash, e.ToString());
                    cbtapi.setScore(sessionId, "Fail");
                    log.ErrorFormat($"{TestContext.TestName} - Test Failed", e.Message, e.StackTrace);
                    throw;
                }
            }
            else
            {
                try
                {
                    SplashPage.GoTo();
                    SplashPage.AssertPageTitle();
                    SplashPage.EnterUsername();
                    SplashPage.EnterPassword();
                    SplashPage.ClickLoginBtn();
                    LocationSelector.SelectLocation();
                    LocationSelector.SelectPos();
                    LocationSelector.ClickSelect();
                    DashboardPage.AssertLoggedUserName();
                    log.InfoFormat($"{TestContext.TestName} - Test Passed");
                }
                catch (Exception e)
                {
                    log.ErrorFormat($"{TestContext.TestName} - Test Failed", e.Message, e.StackTrace);
                    throw;
                }
            }
        }
Exemple #2
0
        public void splashPage_logIn_empty()
        {
            var agent     = ConfigurationManager.AppSettings["Browser"];
            var cbtapi    = new CBTApi();
            var sessionId = ((RemoteWebDriver)Driver.Instance).SessionId.ToString();
            var caps      = new DesiredCapabilities();

            if (agent == "Remote_CBT")
            {
                try
                {
                    caps.SetCapability("name", "Club Automation Test: splashPage_logIn_empty");
                    caps.SetCapability("build", "TestCase #");

                    SplashPage.GoTo();
                    SplashPage.AssertPageTitle();
                    SplashPage.ClickLoginBtn();
                    SplashPage.EmptyLoginErrorMessage();
                    cbtapi.takeSnapshot(sessionId);
                    SplashPage.UsernameRedBorder();
                    SplashPage.PasswordRedBorder();
                    cbtapi.setScore(sessionId, "Pass");
                }
                catch (Exception e)
                {
                    var snapshotHash = cbtapi.takeSnapshot(sessionId);
                    cbtapi.setDescription(sessionId, snapshotHash, e.ToString());
                    cbtapi.setScore(sessionId, "Fail");
                }
            }
            else
            {
                SplashPage.GoTo();
                SplashPage.AssertPageTitle();
                SplashPage.ClickLoginBtn();
                SplashPage.EmptyLoginErrorMessage();
                SplashPage.UsernameRedBorder();
                SplashPage.PasswordRedBorder();
            }
        }