Exemplo n.º 1
0
        public void Check_SavingDataAutomatically(Dictionary <string, string> setupProduct)
        {
            AdminSiteSwitchAutoSave(() => AdminConfigExtension(), () => AdminCustomA4PosterProduct(setupProduct["ProductName"]));//TODO

            UserSiteLoginStep();

            _userContentStart.NavigateTo();
            var documentBefore = _userContentStart.SearchDocument(setupProduct["ProductName"]);

            Assert.IsTrue(!string.IsNullOrEmpty(documentBefore.Id));

            _userContentStart.SelectDocument(documentBefore.Id);

            CheckAutoSaveForViewDesignOptions();
            CheckAutoSaveForViewTextOptions();
            CheckAutoSaveForViewFooterOptions();

            _userEditFormFilling.ClickToNextStep();
            _userEditPrinting.ClickToNextStep();
            _userEditPrinting.ClickToBypassCompleteRequiredFields();

            _userEditFinish.EnterOrderName(setupProduct["ProductDescription"]);
            _userEditFinish.ClickToGenerateDocument();

            Assert.IsTrue(_oneDesign.GetDesignName().IsEquals(setupProduct["ProductDescription"].EncodeSpecialCharacters()));
        }
Exemplo n.º 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");
        }