private void CheckAutoSaveForViewTextOptions()
        {
            _userEditFormFilling.ClickToViewTextOptions();

            var fields             = new List <AutoSaveField>();
            var displayedTextareas = _userEditFormFilling.GetAllDisplayedTextareas();

            Assert.IsTrue(displayedTextareas.Any());

            foreach (var item in displayedTextareas)
            {
                var textValue = TestUtil.RandomName(10);

                item.Clear();
                item.SendKeys(textValue);
                item.SendKeys(Keys.Tab);

                Assert.IsTrue(_action.GetNotifyMessage);

                fields.Add(new AutoSaveField
                {
                    Id    = item.GetAttribute("id"),
                    Value = textValue
                });
            }
        }
Beispiel #2
0
        private void CreateDocumentStep(string name, bool checkInvalidDescription = false)
        {
            Assert.IsTrue(_browser.CurrentPageIs("designs"), "User is navigated to My Designs page after logged in");

            _action.CreateMopinionCookie();

            _myDesign.CreateDesign();

            Assert.IsTrue(_browser.CurrentPageIs("usercontentstart"), "User should be able to access to User Content Start page when click to Create design button");

            if (_isShowPolicyAgreementModal)
            {
                _userContentStart.AgreeWithPrivacy();

                _isShowPolicyAgreementModal = false;
            }

            _userContentStart.ClickToCreateDesign(name);

            var displayedTextareas = _userEditFormFilling.GetAllInputFields();

            if (displayedTextareas == null)
            {
                _userEditFormFilling.ClickToViewTextOptions();

                displayedTextareas = _userEditFormFilling.GetAllInputFields();
            }

            foreach (var item in displayedTextareas)
            {
                var textValue = TestUtil.RandomName(10);

                item.Clear();
                item.SendKeys(textValue);
                item.SendKeys(Keys.Tab);
            }

            _userEditFormFilling.ClickToNextStep();

            _userEditPrinting.ClickToNextStep();

            var designName = $"{name}_{_designNamePrefix}";

            if (checkInvalidDescription)
            {
                void verifyInvalidDescription(string description, string validationMessage)
                {
                    _userEditFinish.EnterOrderName(description);

                    var errorMessage = _userEditFinish.GetErrorMessage();

                    Assert.IsTrue(errorMessage.IsEquals(validationMessage), $"The error message should be {validationMessage}; but actual is {errorMessage}");
                }

                verifyInvalidDescription(designName, "This name is being used by another design");

                var maxLength = 200;

                var longDesignNameToFail = $"{designName}{TestUtil.RandomName(maxLength)}";

                verifyInvalidDescription(longDesignNameToFail, $"Design name should not exceed {maxLength} characters");

                //valid description

                designName = $"[RENAME]{name}_{_designNamePrefix}";
            }

            _userEditFinish.ClickToGenerateDocument(designName);

            Assert.IsTrue(_browser.CurrentPageIs("onedesign"), "User is navigated to One design page once process finished");
        }