Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XWIKI-22121: Improve the registration experience #3633

Merged
merged 2 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,13 @@ void registerWikiSyntaxName(boolean isModal, boolean closedWiki, boolean withReg
+ "wiki: %s withRegistrationConfig: %s", isModal, closedWiki, withRegistrationConfig));
// TODO: looks like a pretty strange behavior, there might be a message box title missing somewhere
String messagePrefix = closedWiki ? "" : "Information ";

assertEquals(String.format("%s%s %s (%s): Registration successful.", messagePrefix, firstName, lastName,
AbstractRegistrationPage.JOHN_SMITH_USERNAME),
messagePrefix = !closedWiki&&withRegistrationConfig ? "Welcome ": messagePrefix;
// TODO: clean up this test with a better final assertion.
// As of now, the string retrieved changes a lot depending on the test parameters
// The assertion should be less strong so that we can clearly show these differences.
assertEquals(String.format("%s%s %s (%s)%s", messagePrefix, firstName, lastName,
AbstractRegistrationPage.JOHN_SMITH_USERNAME,
!closedWiki&&withRegistrationConfig ? "" : ": Registration successful."),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That feels weird, you're sure it's expected to not have "Registration successful" in close wiki?

Copy link
Contributor Author

@Sereza7 Sereza7 Nov 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@surli
Tbh this is more or less hardcoded to fit the results.

This set of conditions is the only one where the template defined in Registration.xml is used. I did update this template in the rework, the Registration successful string is in a separate element. I did not update the other templates, so for the moment the templates are not consistent with one another.


My guess is that if the wiki is closed the guest does not have access to this template and we rely on a public template somewhere else. This template is the default value when we set the registrationConfig, so I guess it's not used if the withRegistrationConfig is false.

((RegistrationPage) registrationPage).getRegistrationSuccessMessage().orElseThrow());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,8 @@
#end
## Display a "registration successful" message
## Define some strings which may be used by the welcome message
#set($firstName = $escapetool.xml($!request.get('register_first_name')))
#set($lastName = $escapetool.xml($!request.get('register_last_name')))
#set($firstName = $!request.get('register_first_name'))
#set($lastName = $!request.get('register_last_name'))
#evaluate($registrationConfig.registrationSuccessMessage)

## Empty line prevents message from being forced into a <p> block.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ public WebElement getErrorMessage(String message)
public boolean validationFailureMessagesInclude(String message)
{
return !getDriver().findElementsWithoutWaiting(
By.xpath("//dd/span[contains(@class,'LV_validation_message LV_invalid') and . = '" + message + "']"))
By.xpath("//dd/span[contains(@class, 'LV_validation_message') and " +
"contains(@class, 'LV_invalid') and " +
"contains(., '" + message + "')]"))
.isEmpty();
}

Expand Down
Loading