예제 #1
0
        /// <summary>
        /// Add pattern to the brand.
        /// </summary>
        /// <param name="patternName">
        /// The pattern name.
        /// </param>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public bool AddPattern(string patternName)
        {
            var retVal = WebAdapter.ButtonClickById("addPattern");

            if (!retVal)
            {
                return(false);
            }

            retVal = WebAdapter.TextboxSetTextById("inNameNewElement", patternName);

            if (!retVal)
            {
                return(false);
            }

            retVal = WebAdapter.ButtonClickById("create");

            if (!retVal)
            {
                return(false);
            }

            retVal = WebAdapter.ButtonClickById("Done");

            // gotta wait for the WT to process the add...
            WebAdapter.WaitForComplete(1);

            return(retVal);
        }
예제 #2
0
        /// <summary>
        /// The learn more.
        /// </summary>
        /// <returns>
        /// Indication of success
        /// </returns>
        /// <summary>
        /// The login.
        /// </summary>
        /// <param name="userName">
        /// The user name.
        /// </param>
        /// <param name="password">
        /// The password.
        /// </param>
        public bool Login(string userName = null, string password = null)
        {
            // Handle defaults for username password
            userName = HandleDefault(userName, BtoWebConfiguration.UserName);
            password = HandleDefault(password, BtoWebConfiguration.Password);

            // CLick the login
            if (!WebAdapter.Click(By.XPath("//a[@href='/Account/Login']")))
            {
                StfLogger.LogError("Couldn't press login");
                return(false);
            }

            // fill in credentials
            WebAdapter.TextboxSetTextById("Email", userName);
            WebAdapter.TextboxSetTextById("password", password);

            // Click tab page Login
            WebAdapter.ButtonClickByXpath("//button[text()='Log in']");

            // Remember the last logged in user
            CurrentLoggedInUser = userName;

            return(true);
        }
예제 #3
0
        /// <summary>
        /// Pass on the wrap to user 'username' (only possible for owner of wrap)
        /// </summary>
        /// <param name="username">
        /// The username.
        /// </param>
        /// <param name="ownershipStart">
        /// The ownership Start.
        /// If not set, default date is used
        /// </param>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public bool PassOn(string username, string ownershipStart = null)
        {
            // click the Pass On Button in the menu
            if (!WebAdapter.ButtonClickByXpath("//button[@id='but_passon']"))
            {
                StfLogger.LogDebug("Couldn't press PassOn button");
                return(false);
            }

            if (!WebAdapter.TextboxSetTextById("inputBrugerSoeg", username, true))
            {
                StfLogger.LogDebug("Couldn't set brugerSoeg text");
                return(false);
            }

            // click the select user button
            if (!WebAdapter.ButtonClickById("but_selUser"))
            {
                StfLogger.LogDebug("Couldn't press SelectUser button");
                return(false);
            }

            // Choose a date for ownership-start
            if (ownershipStart != null)
            {
                WebAdapter.WaitForComplete(TimeSpan.FromSeconds(1));

                if (!WebAdapter.TextboxSetTextById("inp_datePassOn", ownershipStart))
                {
                    StfLogger.LogInfo("Date for ownership not changed");
                    return(false);
                }
            }

            // answer the R U sure
            if (!WebAdapter.ButtonClickById("but_goPassOn"))
            {
                StfLogger.LogDebug("Couldn't press R-U-Sure button");
                return(false);
            }

            return(true);
        }
        /// <summary>
        /// The learn more.
        /// </summary>
        /// <returns>
        /// Indication of success
        /// </returns>
        /// <summary>
        /// The login.
        /// </summary>
        /// <param name="userName">
        /// The user name.
        /// </param>
        /// <param name="password">
        /// The password.
        /// </param>
        public bool Login(string userName = null, string password = null)
        {
            // Handle defaults for username password
            userName = HandleDefault(userName, WtConfiguration.UserName);
            password = HandleDefault(password, WtConfiguration.Password);

            // Click tab page Login
            WebAdapter.ButtonClickById("nav_login");

            // fill in creds
            WebAdapter.TextboxSetTextById("input_username", userName);
            WebAdapter.TextboxSetTextById("input_pw", password);

            // Click tab page Login
            WebAdapter.ButtonClickById("nav_");

            // Remember the last logged in user
            CurrentLoggedInUser = userName;

            return(true);
        }
        /// <summary>
        /// The sign up.
        /// </summary>
        /// <param name="newUserName">
        /// The new user name.
        /// </param>
        /// <param name="password">
        /// The password.
        /// </param>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public bool SignUp(string newUserName, string password)
        {
            WebAdapter.ButtonClickById("nav_login");
            WebAdapter.TextboxSetTextById("input_newuser", newUserName);
            WebAdapter.TextboxSetTextById("input_newPW", password);
            WebAdapter.TextboxSetTextById("input_email", newUserName + "@mitsite.org");
            WebAdapter.CheckBoxSetValueById("check_cond", true);
            WebAdapter.ButtonClickById("OpretProfilKnap");

            // when debugging, we probably want to get to the signed up user
            StfLogger.LogKeyValue("SignUpUserName", newUserName, "SignUpUserName");
            StfLogger.LogKeyValue("SignUpPassword", password, "SignUpPassword");

            // Check If still on LOGIN page <h1>Login</h1> - if so then the signup failed
            var loginHeader = WebAdapter.FindElement(By.XPath("//h1[text='Login']"), 2);
            var retVal      = loginHeader == null || CheckSignUpValidationMessages();

            ChooseEnglish();

            return(retVal);
        }
예제 #6
0
        /// <summary>
        /// The send away temporarily.
        /// </summary>
        /// <param name="sendAwayReason">
        /// The send away reason.
        /// </param>
        /// <param name="recipient">
        /// The recipient.
        /// </param>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public bool SendAwayTemporarily(SendAwayReason sendAwayReason, string recipient)
        {
            string inputValue;

            // click the SendAwayTemp button
            WebAdapter.ButtonClickById("but_sendonholiday");

            switch (sendAwayReason)
            {
            case SendAwayReason.Holiday:
                inputValue = "ferie";
                break;

            case SendAwayReason.Tester:
                inputValue = "test";
                break;

            case SendAwayReason.Rent:
                inputValue = "udlejning";
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(sendAwayReason), sendAwayReason, null);
            }

            var xPath = $"//input[@value='{inputValue}']";

            WebAdapter.ButtonClickByXpath(xPath);

            // now chose the recipient
            WebAdapter.TextboxSetTextById("inputBrugerSoeg_ferievikle", recipient, true);
            WebAdapter.ButtonClickById("but_chooseUser");

            // press ok
            var retVal = WebAdapter.ButtonClickById("but_ok1_vaelg");

            return(retVal);
        }