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-16216: Allow users to rebind the shortcuts from their user profile UI #2981

Draft
wants to merge 57 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
1d33e79
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Feb 23, 2024
e540a4e
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Feb 23, 2024
36df3bf
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Feb 27, 2024
48d8e87
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Feb 28, 2024
c6de222
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Mar 1, 2024
84e0582
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Mar 1, 2024
32ec4c0
Merge branch 'xwiki:master' into XWIKI-16216
Sereza7 Mar 1, 2024
37ab413
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Mar 1, 2024
147e445
Merge branch 'xwiki:master' into XWIKI-16216
Sereza7 Mar 11, 2024
8c358d7
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Mar 11, 2024
204252e
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Mar 11, 2024
b2ba4c6
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Mar 11, 2024
3e97dd9
Merge branch 'xwiki:master' into XWIKI-16216
Sereza7 Mar 12, 2024
d395e5d
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Mar 12, 2024
bacc686
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Mar 13, 2024
124df66
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Mar 13, 2024
a04cfbf
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Mar 13, 2024
84a9a1d
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Apr 16, 2024
9396c6c
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Apr 16, 2024
72af963
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Apr 22, 2024
c894b16
Merge branch 'master' into XWIKI-16216
Sereza7 Apr 22, 2024
9ee324b
Merge branch 'xwiki:master' into XWIKI-16216
Sereza7 Jun 7, 2024
8be9ead
Merge branch 'xwiki:master' into XWIKI-16216
Sereza7 Jun 18, 2024
d7fa7e1
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Jun 18, 2024
83be0b8
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Jun 18, 2024
3e0960c
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Jun 18, 2024
09c3e7d
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Jun 25, 2024
1b1aac7
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Jul 10, 2024
835b4c7
Merge branch 'xwiki:master' into XWIKI-16216
Sereza7 Jul 26, 2024
ca85cc5
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Jul 31, 2024
1228086
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Oct 1, 2024
101d891
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Oct 1, 2024
ef8513a
Merge branch 'xwiki:master' into XWIKI-16216
Sereza7 Oct 1, 2024
091679c
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Oct 1, 2024
6e3a355
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Oct 1, 2024
74ffe8e
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Oct 1, 2024
fa9d562
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Oct 2, 2024
bc3af80
Update xwiki-platform-core/xwiki-platform-user/xwiki-platform-user-pr…
Sereza7 Oct 2, 2024
6bb5cf7
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Oct 2, 2024
754813c
Merge branch 'xwiki:master' into XWIKI-16216
Sereza7 Oct 4, 2024
74f90d2
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Oct 4, 2024
67e337c
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Oct 4, 2024
45dcafa
XWIKI-22280: Object editor dropdowns are not keyboard accessible
Sereza7 Oct 7, 2024
2d2757c
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Oct 8, 2024
26dfb55
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Oct 8, 2024
b67ddc1
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Oct 8, 2024
bbc63a0
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Oct 23, 2024
fbcd0f6
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Oct 23, 2024
031d727
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Oct 23, 2024
2b2ac2e
Merge branch 'xwiki:master' into XWIKI-16216
Sereza7 Oct 29, 2024
150f1e6
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Oct 29, 2024
72e7f89
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Oct 29, 2024
90f8096
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Oct 29, 2024
ac1e5f6
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Nov 8, 2024
9b4344c
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Nov 8, 2024
53b57b4
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Nov 8, 2024
3edd13a
XWIKI-16216: Allow users to rebind the shortcuts from their user prof…
Sereza7 Nov 14, 2024
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 @@ -155,8 +155,11 @@
## Override keyboard shortcut (if any)
##
#if ($keyboardShortcutsEnabled && "$!extraShortcut" != "")
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this condition still correct? It isn't possible to set a shortcut value if $extraShortcut is empty?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I updated this in ac1e5f6 👍
Thank you for noticing, the logic here was off.

shortcut.remove("$extraShortcut");
shortcut.add("$extraShortcut", function() { XWiki.displayDocExtra("${extraAnchor}", "${extraTemplate}", true); }, { 'disable_in_input':true });
#set ($userPreferenceName = "shortcut_view_${extraName}")
#set ($shortcut_view_extra = $!{xwiki.getUserPreference($userPreferenceName)})
#set ($extraShortcutWithUserPreferences = "#if($shortcut_view_extra!='')$shortcut_view_extra#{else}$extraShortcut#end")
shortcut.remove("$extraShortcutWithUserPreferences");
shortcut.add("$extraShortcutWithUserPreferences", function() { XWiki.displayDocExtra("${extraAnchor}", "${extraTemplate}", true); }, { 'disable_in_input':true });
Sereza7 marked this conversation as resolved.
Show resolved Hide resolved
#end
#end
document.observe("dom:loaded", extraInit, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,12 @@
* @param class The class to use.
*#
#macro(editActionButton $action $resourceIdentifier $class)
#submitButton("action_${action}", $services.localization.render("core.shortcuts.edit.${resourceIdentifier}"), $services.localization.render($resourceIdentifier), $class)
#if($!xwiki.getUserPreference("shortcut_edit_${resourceIdentifier}") != '')
#set ($shortcut = $xwiki.getUserPreference("shortcut_edit_${resourceIdentifier}"))
#else
#set ($shortcut = $services.localization.render("core.shortcuts.edit.${resourceIdentifier}"))
#end
#submitButton("action_${action}", $shortcut, $services.localization.render($resourceIdentifier), $class)
Sereza7 marked this conversation as resolved.
Show resolved Hide resolved
<input type="hidden" name="xaction" value="$escapetool.xml($action)" />
#end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,9 @@
<script>
//<![CDATA[
#if ($hasEdit && !$isReadOnly)
shortcut.add("$services.localization.render('core.shortcuts.view.edit')", function() {
#set ($shortcut_view_edit = $!xwiki.getUserPreference('shortcut_view_edit'))
shortcut.add("#if($shortcut_view_edit!='')$shortcut_view_edit#{else}" +
"$services.localization.render('core.shortcuts.view.edit')#end", function() {
var editLink = $('tmEdit').down('a');
// Make sure the shortcut doesn't work when the edit link is disabled.
if (editLink && !editLink.classList.contains('disabled')) {
Expand All @@ -482,22 +484,31 @@
}
}, {'disable_in_input': true});
#if($isAdvancedUser)
shortcut.add("$services.localization.render('core.shortcuts.view.wiki')",function() { location.href=$('tmEditWiki').href; }, { 'disable_in_input':true });
shortcut.add("$services.localization.render('core.shortcuts.view.wysiwyg')",function() { location.href=$('tmEditWysiwyg').href; }, { 'disable_in_input':true });
shortcut.add("$services.localization.render('core.shortcuts.view.inline')",function() { location.href=$('tmEditInline').href; }, { 'disable_in_input':true });
shortcut.add("$services.localization.render('core.shortcuts.view.rights')",function() { var editRights = $('tmEditRights'); location.href= editRights ? editRights.href : "$xwiki.getURL($spacePreferencesDocumentReference, 'admin', 'category=1')";}, { 'disable_in_input':true });
shortcut.add("$services.localization.render('core.shortcuts.view.objects')",function() { location.href=$('tmEditObject').href; }, { 'disable_in_input':true });
#set ($shortcut_view_wiki = $!xwiki.getUserPreference('shortcut_view_wiki'))
shortcut.add("#if($shortcut_view_wiki!='')$shortcut_view_wiki#{else}$services.localization.render('core.shortcuts.view.wiki')#end",function() { location.href=$('tmEditWiki').href; }, { 'disable_in_input':true });
#set ($shortcut_view_wysiwyg = $!xwiki.getUserPreference('shortcut_view_wysiwyg'))
shortcut.add("#if($shortcut_view_wysiwyg!='')$shortcut_view_wysiwyg#{else}$services.localization.render('core.shortcuts.view.wysiwyg')#end",function() { location.href=$('tmEditWysiwyg').href; }, { 'disable_in_input':true });
#set ($shortcut_view_inline = $!xwiki.getUserPreference('shortcut_view_inline'))
shortcut.add("#if($shortcut_view_inline!='')$shortcut_view_inline#{else}$services.localization.render('core.shortcuts.view.inline')#end",function() { location.href=$('tmEditInline').href; }, { 'disable_in_input':true });
#set ($shortcut_view_rights = $!xwiki.getUserPreference('shortcut_view_rights'))
shortcut.add("#if($shortcut_view_rights!='')$shortcut_view_rights#{else}$services.localization.render('core.shortcuts.view.rights')#end",function() { var editRights = $('tmEditRights'); location.href= editRights ? editRights.href : "$xwiki.getURL($spacePreferencesDocumentReference, 'admin', 'category=1')";}, { 'disable_in_input':true });
#set ($shortcut_view_objects = $!xwiki.getUserPreference('shortcut_view_objects'))
shortcut.add("#if($shortcut_view_objects!='')$shortcut_view_objects#{else}$services.localization.render('core.shortcuts.view.objects')#end",function() { location.href=$('tmEditObject').href; }, { 'disable_in_input':true });
#if($hasAdmin)
shortcut.add("$services.localization.render('core.shortcuts.view.class')",function() { location.href=$('tmEditClass').href; }, { 'disable_in_input':true });
#set ($shortcut_view_class = $!xwiki.getUserPreference('shortcut_view_class'))
shortcut.add("#if($shortcut_view_class!='')$shortcut_view_class#{else}$services.localization.render('core.shortcuts.view.class')#end",function() { location.href=$('tmEditClass').href; }, { 'disable_in_input':true });
#end
#end
#end
#if ($canDelete && $displayAdminMenu)
shortcut.add("$services.localization.render('core.shortcuts.view.delete')",function() { location.href=$('tmActionDelete').href; }, { 'disable_in_input':true });
shortcut.add("$services.localization.render('core.shortcuts.view.rename')",function() { location.href=$('tmActionRename').href; }, { 'disable_in_input':true });
#set ($shortcut_view_delete = $!xwiki.getUserPreference('shortcut_view_delete'))
shortcut.add("#if($shortcut_view_delete!='')$shortcut_view_delete#{else}$services.localization.render('core.shortcuts.view.delete')#end",function() { location.href=$('tmActionDelete').href; }, { 'disable_in_input':true });
#set ($shortcut_view_rename = $!xwiki.getUserPreference('shortcut_view_rename'))
shortcut.add("#if($shortcut_view_rename!='')$shortcut_view_rename#{else}$services.localization.render('core.shortcuts.view.rename')#end",function() { location.href=$('tmActionRename').href; }, { 'disable_in_input':true });
#end
#if ($canView && $displayMoreActionsMenu)
shortcut.add("$services.localization.render('core.shortcuts.view.code')", function() { location.href = $('tmViewSource').href; }, { 'disable_in_input': true });
#set ($shortcut_view_code = $!xwiki.getUserPreference('shortcut_view_code'))
shortcut.add("#if($shortcut_view_code!='')$shortcut_view_code#{else}$services.localization.render('core.shortcuts.view.code')#end", function() { location.href = $('tmViewSource').href; }, { 'disable_in_input': true });
#end
//]]>
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,16 @@
req.send(null);
};

// Append developer shortcuts for toggeling userType and hiddenDocuments in the current user profile
shortcut.add("$services.localization.render('core.shortcuts.developer.user.type')", function() {
// Append developer shortcuts for toggling userType and hiddenDocuments in the current user profile
shortcut.add("#if($!{xwiki.getUserPreference('shortcut_developer_usertype')}!='')$!{xwiki.getUserPreference('shortcut_developer_usertype')}#{else}$services.localization.render('core.shortcuts.developer.user.type')#end", function() {
developerShortcutsRestCall("${request.contextPath}/rest/currentuser/properties/usertype/next",
"$escapetool.javascript($services.localization.render('core.shortcuts.developer.user.type.error'))");
}, {'type': shortcut.type.SEQUENCE, 'disable_in_input': true });
}, {'type': #if($!xwiki.getUserPreference('shortcut_developer_usertype')!='')shortcut.type.SIMPLE#{else}shortcut.type.SEQUENCE#end, 'disable_in_input': true });

shortcut.add("$services.localization.render('core.shortcuts.developer.user.displayHiddenDocs')", function () {
shortcut.add("#if($!{xwiki.getUserPreference('shortcut_developer_display_hidden_docs')}!='')$!{xwiki.getUserPreference('shortcut_developer_display_hidden_docs')}#{else}$services.localization.render('core.shortcuts.developer.user.displayHiddenDocs')#end", function () {
developerShortcutsRestCall("${request.contextPath}/rest/currentuser/properties/displayHiddenDocuments/next",
"$escapetool.javascript($services.localization.render('core.shortcuts.developer.user.displayHiddenDocs.error'))");
}, {'type': shortcut.type.SEQUENCE, 'disable_in_input': true });
}, {'type': #if($!xwiki.getUserPreference('shortcut_developer_usertype')!='')shortcut.type.SIMPLE#{else}shortcut.type.SEQUENCE#end, 'disable_in_input': true });
//]]>
#end
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,36 @@ protected void createClass(BaseClass xclass)

xclass.addBooleanField("extensionConflictSetup", "Enable extension conflict setup", "yesno");
xclass.addBooleanField("email_checked", "Email address verified");

// Shortcut preferences (22) added in 16.2.0-rc1
// Edit modes (7)
xclass.addTextField("shortcut_view_edit", "Shortcut for default edit mode", 30);
xclass.addTextField("shortcut_view_wiki", "Shortcut for wiki edit mode", 30);
xclass.addTextField("shortcut_view_wysiwyg", "Shortcut for wysiwyg edit mode", 30);
xclass.addTextField("shortcut_view_inline", "Shortcut for inline edit mode", 30);
xclass.addTextField("shortcut_view_rights", "Shortcut for rights edit mode", 30);
xclass.addTextField("shortcut_view_objects", "Shortcut for object edit mode", 30);
xclass.addTextField("shortcut_view_class", "Shortcut for class edit mode", 30);
// Extra info views (5)
xclass.addTextField("shortcut_view_comments", "Shortcut to view page comments", 30);
xclass.addTextField("shortcut_view_annotations", "Shortcut to view page annotations", 30);
xclass.addTextField("shortcut_view_attachments", "Shortcut to view page attachments", 30);
xclass.addTextField("shortcut_view_history", "Shortcut to view page history", 30);
xclass.addTextField("shortcut_view_information", "Shortcut to view page information", 30);
// Alternative views (1)
xclass.addTextField("shortcut_view_code", "Shortcut to view page code", 30);
// Page actions (2)
xclass.addTextField("shortcut_view_delete", "Shortcut to delete the page", 30);
xclass.addTextField("shortcut_view_rename", "Shortcut to rename the page", 30);
// Editor actions (5)
xclass.addTextField("shortcut_edit_preview", "Shortcut to see preview from the editor", 30);
xclass.addTextField("shortcut_edit_backtoedit", "Shortcut to go back to the editor from preview", 30);
xclass.addTextField("shortcut_edit_cancel", "Shortcut to cancel edition", 30);
xclass.addTextField("shortcut_edit_save", "Shortcut to save and continue in the editor", 30);
xclass.addTextField("shortcut_edit_saveandview", "Shortcut to save and view from the editor", 30);
// Developer shortcuts (2)
xclass.addTextField("shortcut_developer_usertype", "Shortcut to switch the current user type", 30);
xclass.addTextField("shortcut_developer_display_hidden_docs", "Shortcut to switch display of hidden documents", 30);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
import org.xwiki.test.docker.junit5.TestReference;
import org.xwiki.test.docker.junit5.UITest;
import org.xwiki.test.ui.TestUtils;
import org.xwiki.test.ui.po.CommentsTab;
import org.xwiki.test.ui.po.HistoryPane;
import org.xwiki.test.ui.po.InformationPane;
import org.xwiki.test.ui.po.ViewPage;
import org.xwiki.test.ui.po.editor.EditPage;
import org.xwiki.user.test.po.ChangeAvatarPage;
Expand Down Expand Up @@ -97,6 +99,8 @@ class UserProfileIT

private static final String TEXT_EDITOR = "Text";

private static final String NEW_SHORTCUT_VALUE = "B";

private static final String DEFAULT_EDITOR = "Text (Default)";

private static final String SIMPLE_USER = "Simple";
Expand All @@ -116,6 +120,7 @@ public void setUp(TestUtils setup, TestReference testReference)
this.userName = testReference.getLastSpaceReference().getName();
setup.loginAsSuperAdmin();
setup.rest().deletePage("XWiki", this.userName);
// We make sure the user is in advanced mode so that they can use view mode shortcuts
setup.createUserAndLogin(this.userName, DEFAULT_PASSWORD);

// At first edition the Dashboard is saving the doc to insert a new object, so we need to be sure
Expand Down Expand Up @@ -251,12 +256,54 @@ void changeDefaultEditor()
assertEquals(DEFAULT_EDITOR, preferencesPage.getDefaultEditor());
}

/** Functionality check: changing the shortcut for the default edit mode. */
@Test
@Order(5)
void changeShortcutViewEdit(TestUtils setup)
{
ProfileUserProfilePage userProfilePage = ProfileUserProfilePage.gotoPage(this.userName);
PreferencesUserProfilePage preferencesPage = userProfilePage.switchToPreferences();


// Setting to Advanced user, so that the view shortcuts are enabled
PreferencesEditPage preferencesEditPage = preferencesPage.editPreferences();
preferencesEditPage.setAdvancedUserType();
preferencesEditPage.clickSaveAndView();

// Overriding the default shortcut value (E)
userProfilePage = ProfileUserProfilePage.gotoPage(this.userName);
preferencesPage = userProfilePage.switchToPreferences();
preferencesEditPage = preferencesPage.editPreferences();
preferencesEditPage.setShortcutViewEdit(NEW_SHORTCUT_VALUE);
preferencesEditPage.clickSaveAndView();

userProfilePage = ProfileUserProfilePage.gotoPage(this.userName);
preferencesPage = userProfilePage.switchToPreferences();
assertEquals(NEW_SHORTCUT_VALUE, preferencesPage.getViewEditShortcut());

// Testing that the updated shortcut preference works as intended
setup.getDriver().addPageNotYetReloadedMarker();
setup.getDriver().createActions().sendKeys(NEW_SHORTCUT_VALUE).perform();
setup.getDriver().waitUntilPageIsReloaded();
// The edit shortcut sends us to the profile section, whatever the section we were in was.
ProfileEditPage profileEditPage = new ProfileEditPage();
// We make sure we can find a field on this page (aka we didn't cast this erroneously)
assertEquals("", profileEditPage.getUserFirstName());

userProfilePage = ProfileUserProfilePage.gotoPage(this.userName);
preferencesPage = userProfilePage.switchToPreferences();
preferencesEditPage = preferencesPage.editPreferences();
// Reset the preference
preferencesEditPage.setShortcutViewEdit("");
preferencesEditPage.clickSaveAndView();
}

/**
* Check that the content of the first comment isn't used as the "About" information in the user profile. See
* XAADMINISTRATION-157.
*/
@Test
@Order(5)
@Order(6)
void commentDoesntOverrideAboutInformation(TestUtils setup)
{
ProfileUserProfilePage userProfilePage = ProfileUserProfilePage.gotoPage(this.userName);
Expand All @@ -273,7 +320,7 @@ void commentDoesntOverrideAboutInformation(TestUtils setup)
}

@Test
@Order(6)
@Order(7)
void ensureDashboardUIAddAnObjectAtFirstEdit()
{
ProfileUserProfilePage userProfilePage = ProfileUserProfilePage.gotoPage(this.userName);
Expand All @@ -283,7 +330,7 @@ void ensureDashboardUIAddAnObjectAtFirstEdit()
}

@Test
@Order(7)
@Order(8)
void verifyGroupTab(TestUtils setup)
{
GroupsUserProfilePage preferencesPage = GroupsUserProfilePage.gotoPage(this.userName);
Expand All @@ -297,7 +344,7 @@ void verifyGroupTab(TestUtils setup)
}

@Test
@Order(8)
@Order(9)
void toggleEnableDisable(TestUtils setup)
{
ProfileUserProfilePage userProfilePage = ProfileUserProfilePage.gotoPage(this.userName);
Expand Down Expand Up @@ -332,7 +379,7 @@ void toggleEnableDisable(TestUtils setup)
}

@Test
@Order(9)
@Order(10)
void disabledUserTest(TestUtils setup, TestReference testReference)
{
setup.loginAsSuperAdmin();
Expand All @@ -353,4 +400,50 @@ void disabledUserTest(TestUtils setup, TestReference testReference)
assertFalse(viewPage.exists());
assertTrue(gotException);
}

@Test
@Order(11)
void changeShortcutInformation(TestUtils setup, TestReference testReference)
{
ProfileUserProfilePage userProfilePage = ProfileUserProfilePage.gotoPage(this.userName);
PreferencesUserProfilePage preferencesPage = userProfilePage.switchToPreferences();

// Setting to Advanced user, so that the view shortcuts are enabled
PreferencesEditPage preferencesEditPage = preferencesPage.editPreferences();
preferencesEditPage.setAdvancedUserType();
preferencesEditPage.clickSaveAndView();

// Overriding the default shortcut value (I)
userProfilePage = ProfileUserProfilePage.gotoPage(this.userName);
preferencesPage = userProfilePage.switchToPreferences();
preferencesEditPage = preferencesPage.editPreferences();
preferencesEditPage.setShortcutInformation(NEW_SHORTCUT_VALUE);
preferencesEditPage.clickSaveAndView();

ViewPage viewPage = setup.createPage(testReference, "one **two** three", "");
InformationPane infoPane = viewPage.openInformationDocExtraPane();
CommentsTab commentsPane = viewPage.openCommentsDocExtraPane();
assertTrue(commentsPane.isOpened());
assertFalse(infoPane.isOpened());
// We try using the default shortcut. We expect it to not work, that is, to still have the commentsTab opened.
setup.getDriver().createActions().sendKeys("i").perform();
assertTrue(commentsPane.isOpened());
assertFalse(infoPane.isOpened());
// We now use the user preference defined shortcut to open it instead.
setup.getDriver().createActions().sendKeys(NEW_SHORTCUT_VALUE).perform();
viewPage.waitForDocExtraPaneActive("information");
assertFalse(commentsPane.isOpened());
assertTrue(infoPane.isOpened());
// We try using the default shortcut to get back to the comments tab. We expect this one to work without change.
viewPage.useShortcutKeyForCommentPane();
assertTrue(commentsPane.isOpened());
assertFalse(infoPane.isOpened());

// Reset the preference
userProfilePage = ProfileUserProfilePage.gotoPage(this.userName);
preferencesPage = userProfilePage.switchToPreferences();
preferencesEditPage = preferencesPage.editPreferences();
preferencesEditPage.setShortcutInformation("");
preferencesEditPage.clickSaveAndView();
}
}
Loading