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

Cy create language #11546

Merged
merged 6 commits into from
Nov 14, 2021
Merged

Cy create language #11546

merged 6 commits into from
Nov 14, 2021

Conversation

jemayn
Copy link
Contributor

@jemayn jemayn commented Oct 29, 2021

Remaking #11307 to get around a GH bug that showed way more changes.

@madsrasmussen If I add the TS definitions like they are in tests/Umbraco.Tests.AcceptanceTest/cypress/typings.d.ts I get intellisense and it all works 🙂

We could use that alongside adding the commands to the commands.js file we get typed custom commands, which can then once in a while be pulled into @bergmania 's package.

@jemayn jemayn mentioned this pull request Oct 29, 2021
7 tasks
@umbrabot
Copy link

umbrabot commented Oct 29, 2021

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:

  • It's clear what problem this is solving, there's a connected issue or a description of what the changes do and how to test them
  • The automated tests all pass (see "Checks" tab on this PR)
  • The level of security for this contribution is the same or improved
  • The level of performance for this contribution is the same or improved
  • Avoids creating breaking changes; note that behavioral changes might also be perceived as breaking
  • If this is a new feature, Umbraco HQ provided guidance on the implementation beforehand
  • The contribution looks original and the contributor is presumably allowed to share it

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 🤖 🙂

Copy link
Member

@Zeegaan Zeegaan left a 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 changing 👍

// Setup
const language = 'Danish';
const culture = 'da';
cy.umbracoEnsureLanguageNotExists(culture);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
cy.umbracoEnsureLanguageNotExists(culture);
cy.umbracoEnsureLanguageNameNotExists(culture);

Use the already existing language method

Comment on lines 55 to 56
cy.umbracoEnsureLanguageNotExists(language1);
cy.umbracoEnsureLanguageNotExists(language2);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
cy.umbracoEnsureLanguageNotExists(language1);
cy.umbracoEnsureLanguageNotExists(language2);
cy.umbracoEnsureLanguageNameNotExists(language1);
cy.umbracoEnsureLanguageNameNotExists(language2);

Comment on lines 11 to 19
namespace Cypress {
interface Chainable<Subject> {
/**
* Checks to see if the language with specified name does not exist
* If it does it will automatically delete it
* @param {string} name Name of language to delete
* @example cy.umbracoEnsureLanguageNotExists('Danish');
*/
umbracoEnsureLanguageNotExists: (name: string) => Chainable<void>;
Copy link
Member

Choose a reason for hiding this comment

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

As mentioned in your other PR we already have a method called cy.umbracoEnsureLanguageNameNotExists(name)

Suggested change
namespace Cypress {
interface Chainable<Subject> {
/**
* Checks to see if the language with specified name does not exist
* If it does it will automatically delete it
* @param {string} name Name of language to delete
* @example cy.umbracoEnsureLanguageNotExists('Danish');
*/
umbracoEnsureLanguageNotExists: (name: string) => Chainable<void>;
namespace Cypress {
interface Chainable<Subject> {

@jemayn
Copy link
Contributor Author

jemayn commented Nov 3, 2021

@Zeegaan

The existing command matches on the language name, not the culture like this one. I've updated the method on this PR to make it clearer that it's on culture 🙂

@elit0451
Copy link
Member

elit0451 commented Nov 4, 2021

Just FYI: The just merged PR #11527 already moved the languages.ts to the tests folder, instead of src. 🙂
So make sure to get the latest changes from umbraco:v9/contrib.

@jemayn jemayn mentioned this pull request Nov 4, 2021
1 task
@mikecp
Copy link
Contributor

mikecp commented Nov 12, 2021

Hello @jemayn ,

Thanks for this PR, it's a nice addition to the acceptance tests suite 😉👍

It all works good, but before merging, I wanted to check with you, in the line of @Zeegaan 's remarks earlier, if there was a specific reason why you needed to add the method umbracoEnsureLanguageCultureNotExists and could not use the existing one umbracoEnsureLanguageNameNotExists.

I just want to make sure that we do not create what seems to be an "almost duplicate" method if there is no specific reason, but maybe I am overseeing something. 😁

Thanks in advance for your feedback!

@jemayn
Copy link
Contributor Author

jemayn commented Nov 13, 2021

Hello @jemayn ,

Thanks for this PR, it's a nice addition to the acceptance tests suite 😉👍

It all works good, but before merging, I wanted to check with you, in the line of @Zeegaan 's remarks earlier, if there was a specific reason why you needed to add the method umbracoEnsureLanguageCultureNotExists and could not use the existing one umbracoEnsureLanguageNameNotExists.

I just want to make sure that we do not create what seems to be an "almost duplicate" method if there is no specific reason, but maybe I am overseeing something. 😁

Thanks in advance for your feedback!

Hey @mikecp !

I can amend the PR to use the existing method if you want, but I felt this was a better method than the existing one - the existing one relies on the language names which can be anything, this method uses the culture which is still just a string - but feels a bit safer to use..

@mikecp
Copy link
Contributor

mikecp commented Nov 14, 2021

Hi @jemayn ,

Thanks for clearing the difference out, looking on a culture name seems indeed safer, so let's keep that method in there 😉!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants