Skip to content

Commit

Permalink
--wip-- [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelleduc committed Mar 12, 2024
1 parent f85c3bb commit af1b08d
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -276,23 +276,25 @@ void createAndDeleteUser(TestUtils setup, TestReference testReference)

usersPage = UsersAdministrationSectionPage.gotoPage();

int rowNumber = usersPage.getRowNumberByUsername(userName);

// Verify the user is enabled and can only be edited or disabled
assertFalse(usersPage.isUserDisabled(1));
assertFalse(usersPage.canDeleteUser(1));
assertFalse(usersPage.canEnableUser(1));
assertTrue(usersPage.canDisableUser(1));
assertTrue(usersPage.canEditUser(1));
assertFalse(usersPage.isUserDisabled(rowNumber));
assertFalse(usersPage.canDeleteUser(rowNumber));
assertFalse(usersPage.canEnableUser(rowNumber));
assertTrue(usersPage.canDisableUser(rowNumber));
assertTrue(usersPage.canEditUser(rowNumber));

// Verify that when the user is disabled it can be enabled back, deleted or edited
usersPage = usersPage.disableUser(1);
assertTrue(usersPage.isUserDisabled(1));
assertTrue(usersPage.canDeleteUser(1));
assertTrue(usersPage.canEnableUser(1));
assertFalse(usersPage.canDisableUser(1));
assertTrue(usersPage.canEditUser(1));
usersPage = usersPage.disableUser(rowNumber);
assertTrue(usersPage.isUserDisabled(rowNumber));
assertTrue(usersPage.canDeleteUser(rowNumber));
assertTrue(usersPage.canEnableUser(rowNumber));
assertFalse(usersPage.canDisableUser(rowNumber));
assertTrue(usersPage.canEditUser(rowNumber));

// Delete the newly created user and see if groups are cleaned
ConfirmationModal confirmation = usersPage.clickDeleteUser(1);
ConfirmationModal confirmation = usersPage.clickDeleteUser(rowNumber);
assertTrue(confirmation.getMessage().contains("Are you sure you want to proceed?"));
confirmation.clickOk();
usersPage.getUsersLiveData().getTableLayout().assertRow("User",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ public DeleteUserConfirmationModal clickDeleteUser(int rowNumber)
return new DeleteUserConfirmationModal();
}

public int getRowNumberByUsername(String userName)
{
int rowNumber = getUsersLiveData().getTableLayout().getRowIndexForElement(By.xpath("//a[text()='" + userName + "']"));
return rowNumber;
}

public boolean canDeleteUser(int rowNumber)
{
return getUsersLiveData().getTableLayout().hasAction(rowNumber, "delete");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,24 @@
all the displayer default behavior
-->
<BaseDisplayer
class="displayer-actions"
view-only
:property-id="propertyId"
:entry="entry"
:is-empty="false"
:intercept-touch="false"
class="displayer-actions"
view-only
:property-id="propertyId"
:entry="entry"
:is-empty="false"
:intercept-touch="false"
>

<!-- Provide the Action Viewer widget to the `viewer` slot -->
<template #viewer>
<div class="actions-container">
<a
v-for="action in actions"
:key="action.id"
:class="'action action_' + action.id"
:title="action.description"
:href="sanitizeUrl(entry[action.urlProperty]) || '#'"
@click="handleClick($event, action)"
v-for="action in actions"
:key="action.id"
:class="'action action_' + action.id"
:title="action.description"
:href="sanitizeUrl(entry[action.urlProperty]) || '#'"
@click="handleClick($event, action)"
>
<XWikiIcon :iconDescriptor="action.icon" class="action-icon"/>
<span class="action-name">{{ action.name }}</span>
Expand Down Expand Up @@ -90,9 +90,9 @@ export default {
actions () {
// The list of actions can be overwritten from the displayer configuration.
return (this.config.actions || this.data.meta.actions)
// Show only the actions that are allowed for the current live data entry.
.filter(action => this.logic.isActionAllowed(action, this.entry))
.map(action => this.logic.getActionDescriptor(action));
// Show only the actions that are allowed for the current live data entry.
.filter(action => this.logic.isActionAllowed(action, this.entry))
.map(action => this.logic.getActionDescriptor(action));
},
},
methods: {
Expand Down Expand Up @@ -122,7 +122,7 @@ export default {
if (async.body) {
options.body = async.body;
}

if(async.headers) {
options.headers = async.headers;
}
Expand Down

0 comments on commit af1b08d

Please sign in to comment.