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

WordPress 6.7 Compatibility: Fix the issue that E2E test can't log in to wp-admin #2668

Merged
merged 1 commit into from
Nov 12, 2024

Conversation

eason9487
Copy link
Member

@eason9487 eason9487 commented Nov 11, 2024

Changes proposed in this Pull Request:

With WordPress 6.7-RC3, the E2E test failed to start due to match two elements when trying to click the "Log In" button.

Trying to log-in as admin...
Admin log-in failed, Retrying... 0/5
locator.click: Error: strict mode violation: locator('text=Log In') resolved to 2 elements:
    1) <h1 class="screen-reader-text">Log In</h1> aka getByRole('heading', { name: 'Log In' })
    2) <input type="submit" id="wp-submit" value="Log In" name="wp-submit" class="button button-primary button-large"/> aka getByRole('button', { name: 'Log In' })

This PR ensures that it can locate the "Log In" button.

📌 The failed test case will be handled in a separate RP.

Detailed test instructions:

  1. View the failed run: https://github.com/woocommerce/google-listings-and-ads/actions/runs/11774628750/job/32793771070#step:10:20
  2. View the successful log-in run: https://github.com/woocommerce/google-listings-and-ads/actions/runs/11775116109/job/32794945918#step:10:18

Changelog entry

Dev - WordPress 6.7 Compatibility: Fix the issue that E2E test can't log in to wp-admin.

@eason9487 eason9487 self-assigned this Nov 11, 2024
@github-actions github-actions bot added the changelog: dev Developer-facing only change. label Nov 11, 2024
Copy link

codecov bot commented Nov 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 62.7%. Comparing base (0383264) to head (1f90028).
Report is 6 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           develop   #2668   +/-   ##
=======================================
  Coverage     62.7%   62.7%           
=======================================
  Files          319     319           
  Lines         5074    5074           
  Branches      1231    1231           
=======================================
  Hits          3180    3180           
  Misses        1721    1721           
  Partials       173     173           
Flag Coverage Δ
js-unit-tests 62.7% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

@eason9487 eason9487 requested a review from a team November 11, 2024 09:30
@eason9487 eason9487 marked this pull request as ready for review November 11, 2024 09:30
Copy link
Contributor

@mikkamp mikkamp left a comment

Choose a reason for hiding this comment

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

Thanks for the change, I can confirm that there is another element on the page with the same text:

<h1 class="screen-reader-text">Log In</h1>

With the included fix it selects only the log in button.

The code to login as admin was originally copied over from WooCommerce, but it looks like it was refactored to use a helper utility where they use the same selector as you do here: https://github.com/woocommerce/woocommerce/blob/trunk/plugins/woocommerce/tests/e2e-pw/utils/login.js

Just curious if some of those other tweaks are needed as well, but no reason to fix something that isn't broken. So I'll go ahead and approve the PR.

@eason9487
Copy link
Member Author

Hi @mikkamp, thanks for the review!

Just curious if some of those other tweaks are needed as well, [...]

The current login process looks good. I think we can keep it as it is.

@eason9487 eason9487 merged commit 35619d5 into develop Nov 12, 2024
9 of 10 checks passed
@eason9487 eason9487 deleted the dev/compat-wp-6-7-e2e-test branch November 12, 2024 05:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: dev Developer-facing only change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants