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

Add test to update user #11270

Merged
merged 1 commit into from
Oct 6, 2021
Merged
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 @@ -32,4 +32,57 @@ context('Users', () => {

});

});
it('Update user', () => {
// Set userdata
const name = "Alice Bobson";
const email = "[email protected]";
const startContentIds = [];
const startMediaIds = [];
const userGroups = ["admin"];

var userData =
{
"id": -1,
"parentId": -1,
"name": name,
"username": email,
"culture": "en-US",
"email": email,
"startContentIds": startContentIds,
"startMediaIds": startMediaIds,
"userGroups": userGroups,
"message": ""
};

// Ensure user doesn't exist
cy.umbracoEnsureUserEmailNotExists(email);

// Create user through API
cy.getCookie('UMB-XSRF-TOKEN', { log: false }).then((token) => {
cy.request({
method: 'POST',
url: '/umbraco/backoffice/umbracoapi/users/PostCreateUser',
followRedirect: true,
headers: {
Accept: 'application/json',
'X-UMB-XSRF-TOKEN': token.value,
},
body: userData,
log: false,
}).then((response) => {
return;
});
});

// Go to the user and edit their name
cy.umbracoSection('users');
cy.get('.umb-user-card__name').contains(name).click();
cy.get('#headerName').type('{movetoend}son');
cy.umbracoButtonByLabelKey('buttons_save').click();

// assert save succeeds
cy.umbracoSuccessNotification().should('be.visible');
cy.umbracoEnsureUserEmailNotExists(email);
})

});