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

Cypress: Updated isPseudoLocalized() to correctly process multiple elements #9385

Merged

Conversation

dtaylor113
Copy link
Contributor

@dtaylor113 dtaylor113 commented Jun 30, 2021

Previously a call such as:
cy.byTestID('nav').isPseudoLocalized();
would incorrectly result in one call to isPseudoLocalized() which would test a single combined text string consisting of all of the text of matching elements! In this example "[Ḥṓṓṃḛḛ] [ṎṎṽḛḛṛṽḭḭḛḛẁ] [Ṕṛṓṓĵḛḛͼţṡ]...[ṎṎṗḛḛṛααţṓṓṛṡ] [Ḉṓṓṃṗṵṵţḛḛ]..." -instead of testing each element text individually. So, isPseudoLocalized() would pass as long as first and last elements were translated.

Updated isPseudoLocalized() to correctly process multiple elements, as well as:

  • updated pseudolocalization.spec.ts to correctly test masthead Help menu items and Overview dashboard 'Cluster utilization' card.
  • added translations for 'Report Bug to Red Hat' Help menu items
  • added data-test ids

@openshift-ci openshift-ci bot requested review from andybraren and kyoto June 30, 2021 19:28
@openshift-ci openshift-ci bot added component/core Related to console core functionality component/dashboard Related to dashboard component/shared Related to console-shared kind/cypress Related to Cypress e2e integration testing kind/i18n Indicates issue or PR relates to internationalization or has content that needs to be translated labels Jun 30, 2021
Comment on lines +51 to +56
cy.wrap(subject).each(($el) => {
const text = $el.text();
if (text.length > 0) {
expect(text).to.match(/\[[^a-zA-Z]+\]/);
}
});
Copy link
Contributor

@yapei yapei Jul 1, 2021

Choose a reason for hiding this comment

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

tested this change locally, nice!

Copy link
Contributor

@yapei yapei left a comment

Choose a reason for hiding this comment

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

looks good to me!

Copy link
Contributor

@rebeccaalpert rebeccaalpert left a comment

Choose a reason for hiding this comment

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

This looks great! Just one comment about passing the TFunction around since it's something Sam dinged me for a lot. :)

frontend/public/module/k8s/cluster-settings.ts Outdated Show resolved Hide resolved
cy.byTestID('application-launcher-item').isPseudoLocalized();
// wait for both console help menu items and additionalHelpActions items to load
// additionalHelpActions come from ConsoleLinks 'HelpMenu' yaml and are not translated
cy.get('.pf-c-app-launcher__group').should('have.length', 2);
Copy link
Member

Choose a reason for hiding this comment

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

We should open a Bugzilla for the menu items not translated. I think it would be better to move this into console so they can be translated instead of leaving them as ConsoleLink resources, although it will require some operator changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

@rebeccaalpert rebeccaalpert left a comment

Choose a reason for hiding this comment

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

I added some examples here based on what we've done elsewhere. If you remove the t argument and adjust those lines of code, this should be all set.

frontend/public/module/k8s/cluster-settings.ts Outdated Show resolved Hide resolved
frontend/public/module/k8s/cluster-settings.ts Outdated Show resolved Hide resolved
frontend/public/module/k8s/cluster-settings.ts Outdated Show resolved Hide resolved
frontend/public/module/k8s/cluster-settings.ts Outdated Show resolved Hide resolved
@dtaylor113
Copy link
Contributor Author

apologies @rebeccaalpert, looks like I didn't push the fixes :-) Should be updated now.

Copy link
Contributor

@rebeccaalpert rebeccaalpert left a comment

Choose a reason for hiding this comment

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

Looks good to me! Thank you.

@rebeccaalpert rebeccaalpert added the lgtm Indicates that a PR is ready to be merged. label Jul 8, 2021
@rhamilto
Copy link
Member

rhamilto commented Jul 8, 2021

/approve

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 8, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dtaylor113, rebeccaalpert, rhamilto

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 8, 2021
@openshift-merge-robot openshift-merge-robot merged commit 27b9c94 into openshift:master Jul 8, 2021
@spadgett spadgett added this to the v4.9 milestone Jul 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. component/core Related to console core functionality component/dashboard Related to dashboard component/shared Related to console-shared kind/cypress Related to Cypress e2e integration testing kind/i18n Indicates issue or PR relates to internationalization or has content that needs to be translated lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants