-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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 update language test #11333
add update language test #11333
Conversation
Hi there @jemayn, thank you for this contribution! 👍 While we wait for one of the Core Collaborators team to have a look at your work, we wanted to let you know about that we have a checklist for some of the things we will consider during review:
Don't worry if you got something wrong. We like to think of a pull request as the start of a conversation, we're happy to provide guidance on improving your contribution. If you realize that you might want to make some changes then you can do that by adding new commits to the branch you created for this work and pushing new commits. They should then automatically show up as updates to this pull request. Thanks, from your friendly Umbraco GitHub bot 🤖 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found a few things that needs updating, but stellar job on all of the cypress tests 💪
Cypress.Commands.add('umbracoCreateLanguage', (culture, isMandatory = false, fallbackLanguageId = 1) => { | ||
|
||
var langData = | ||
{ | ||
"culture": culture, | ||
"isMandatory": isMandatory, | ||
"fallbackLanguageId": fallbackLanguageId | ||
}; | ||
|
||
// Create language through API | ||
cy.getCookie('UMB-XSRF-TOKEN', { log: false }).then((token) => { | ||
cy.request({ | ||
method: 'POST', | ||
url: '/umbraco/backoffice/umbracoapi/language/SaveLanguage', | ||
followRedirect: true, | ||
headers: { | ||
Accept: 'application/json', | ||
'X-UMB-XSRF-TOKEN': token.value, | ||
}, | ||
body: langData, | ||
log: false, | ||
}).then((response) => { | ||
return; | ||
}); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cypress.Commands.add('umbracoCreateLanguage', (culture, isMandatory = false, fallbackLanguageId = 1) => { | |
var langData = | |
{ | |
"culture": culture, | |
"isMandatory": isMandatory, | |
"fallbackLanguageId": fallbackLanguageId | |
}; | |
// Create language through API | |
cy.getCookie('UMB-XSRF-TOKEN', { log: false }).then((token) => { | |
cy.request({ | |
method: 'POST', | |
url: '/umbraco/backoffice/umbracoapi/language/SaveLanguage', | |
followRedirect: true, | |
headers: { | |
Accept: 'application/json', | |
'X-UMB-XSRF-TOKEN': token.value, | |
}, | |
body: langData, | |
log: false, | |
}).then((response) => { | |
return; | |
}); | |
}); | |
}); | |
Cypress.Commands.add('umbracoCreateLanguage', (culture, isMandatory = false, fallbackLanguageId = 1) => { | |
var langData = | |
{ | |
"culture": culture, | |
"isMandatory": isMandatory, | |
"fallbackLanguageId": fallbackLanguageId | |
}; | |
// Create language through API | |
let url = '/umbraco/backoffice/umbracoapi/language/SaveLanguage'; | |
cy.umbracoApiRequest(url, 'POST', langData); | |
}); |
Should probably use cy.umbracoApiRequest instead of manually calling the API
} | ||
}); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have already have a helper function that does this! its called umbracoEnsureLanguageNameNotExists (i just make that a few weeks ago for my system information tests 🙈 )
Just FYI: The just merged PR #11527 moves the languages.ts to the |
I will update this PR after #11546 has gone through review - few questions in that one about where to place custom commands and their TS definitions, which will also be relevant in this one 🙂 Will make sure to update the path to the new location. |
Hey @jemayn if you have time to come back to this one and make the changes, I'll happily merge it 😄 |
@nathanwoulfe Sorry had forgotten all about this again! Will write a reminder for when I have a spare evening to get it finished! 🙂 |
All good @jemayn, I'm happy to push the buttons when it's ready to go |
We've since moved away from cypress to playwright so this never came to fruition. I am not sure if these tests are now in playwright but maybe you'd like to try again for playwright? 😁 Thanks again! |
Prerequisites
If there's an existing issue for this PR then this fixes
Description
I have the same question as I wrote in #11307, what am I supposed to do if I need new cypress commands that aren't in the package? It makes sense to me to just add them to the commands file and you can then transfer the ones in the into the package whenever you want to make a new release of it?
I also wrote some ts definitions of the 2 methods, but the chainable.ts file seems to be gitignored so not sure of the procedure there?
Leaving them here to remember:
Anyways, this test does the following: