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

fix: rickroll selector is broken for captcha test #3207

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

joel-krueger
Copy link

Description

Fixes the npm run test:captcha test.
The wikipedia has apparently changed the image class, such that img.thumbimage no longer selects anything on the page.

Testing

If you run the test it throws a timeout exception as it is today.

My testing consisted of inspecting the rick roll element, clicking copy selector, and pasting it to replace img.thumbimage, and then running the test.

I'm not a node expert, or a selector expert, so feel free to decline this and change it to something more efficient / less likely to break as this is a very specific selector replacement.

New dependencies

N/A

@joel-krueger joel-krueger requested a review from jef as a code owner January 31, 2025 03:47
test/util.ts Outdated
@@ -39,7 +39,7 @@ export function getTestStore(): Store {
text: ['Rickrolling'],
},
captchaHandler: {
challenge: 'img.thumbimage',
challenge: '#mw-content-text > div.mw-content-ltr.mw-parser-output > figure:nth-child(3) > a > img',
Copy link
Owner

Choose a reason for hiding this comment

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

This type of selector can be inconsistent, but thank you for updating and bringing it to my attention.

Try to aim for a specific selector (like the previous one) to avoid unintended interactions with other elements on the page.

Suggested change
challenge: '#mw-content-text > div.mw-content-ltr.mw-parser-output > figure:nth-child(3) > a > img',
challenge: '.mw-file-element',

@joel-krueger
Copy link
Author

That suggestion unfortunately does let the test pass, but it just sends a small image of a lock.
Screenshot 2025-01-31 131430

I tried this less precise, but still successful, selector.

@joel-krueger
Copy link
Author

#3213 was opened for this issue

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

Successfully merging this pull request may close these issues.

2 participants