/** * Verifies Alias input as follows Stores current alias for future Checks error message for more * than 20 characters Alias Checks error message for special characters Alias Checks confirm * button disabled for blank/current alias Reverts alias to previous value * * @param validationMessage */ public void verifyAliasInputFieldValidations(HashMap<String, String> validationMessage) { clickChangeAliasButton(); // Store the current Alias String currentAlias = OldAliasInput.getAttribute("value"); // Enter a new alias String NewAlias = Helper.generateRandomAlphabetsString(6); Element.enterData(testConfig, NewAliasInput, NewAlias, "New Alias Input"); Element.click(testConfig, uploadAndProcess, "Submit Alias Changes"); verifyNotificationText(validationMessage.get("AliasChangeSuccessful")); clickChangeAliasButton(); // Verify alias was changed Helper.compareEquals( testConfig, "Old Alias Value", NewAlias, OldAliasInput.getAttribute("value")); // More than 20 characters Element.enterData( testConfig, NewAliasInput, Helper.generateRandomAlphaNumericString(30), "New Alias Input"); Element.click(testConfig, uploadAndProcess, "Submit Alias Changes"); Element.waitForElementDisplay(testConfig, ErrorMessageOnPopUp); Helper.compareEquals( testConfig, "Error Message", validationMessage.get("LongAliasErrorMessage"), ErrorMessageOnPopUp.getText()); // Special Characters Element.enterData(testConfig, NewAliasInput, "!@##$$$$", "New Alias Input"); Element.click(testConfig, uploadAndProcess, "Submit Alias Changes"); Helper.compareEquals( testConfig, "Error Message", validationMessage.get("SpecialCharacterInAliasErrorMessage"), ErrorMessageOnPopUp.getText()); // Existing Alias String ExistingAlias = OldAliasInput.getAttribute("value"); Element.enterData(testConfig, NewAliasInput, ExistingAlias, "New Alias Input"); Helper.compareTrue(testConfig, "Confirm button is disabled", (!uploadAndProcess.isEnabled())); // Blank Value Element.enterData(testConfig, NewAliasInput, "", "New Alias Input"); Helper.compareTrue(testConfig, "Confirm button is disabled", (!uploadAndProcess.isEnabled())); // Enter Older value of alias and save changes Element.enterData(testConfig, NewAliasInput, currentAlias, "New Alias Input"); Element.click(testConfig, uploadAndProcess, "Submit Alias Changes"); verifyNotificationText(validationMessage.get("AliasChangeSuccessful")); }
/** Clicks on Change alias button and waits for pop up to appear */ public void clickChangeAliasButton() { Element.click(testConfig, ChangeAliasButton, "Change Alias Button"); Element.waitForElementDisplay(testConfig, OldAliasInput); }