Skip to content

e2e-tests: fix Google device code regex capturing label instead of code - #1720

Draft
adombeck wants to merge 1 commit into
mainfrom
1719-e2e-tests-google-login-sometim
Draft

e2e-tests: fix Google device code regex capturing label instead of code#1720
adombeck wants to merge 1 commit into
mainfrom
1719-e2e-tests-google-login-sometim

Conversation

@adombeck

@adombeck adombeck commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

When GDM renders the qrcode layout it displays the 'Login code:' label and the actual code as separate UI widgets, so they appear on separate lines in the GDM dialog. When OCR of the GDM screen also drops the colon (a common OCR failure), the alternation in DEVICE_URL_REGEX falls through to the \s* branch, and the capture group — which included a literal space — greedily matched the two-word label 'Login code', producing 'LOGINCODE' instead of the real code.

Two changes close the gap:

  1. Make the colon optional (:?) and allow a newline (\n?) between the label and the code, so 'Login code\nWXYZ-ABCD' is handled correctly.
  2. Remove the space from the capture group ([A-Za-z-]+ instead of [A-Za-z- ]+), so that even if the \s* fallback is taken the multi-word label cannot be swallowed as the device code.

Closes #1719
UDENG-10984

@adombeck adombeck added the e2e-tests This issue is related to end-to-end tests / Run end-to-end tests on this pull request label Jul 9, 2026
@adombeck
adombeck requested a review from Copilot July 9, 2026 15:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Google broker device-code extraction regex used by the e2e test suite to avoid OCR occasionally capturing the “Login code” label instead of the actual device code during GDM-driven device-code login flows.

Changes:

  • Adjust Google DEVICE_URL_REGEX to make the colon optional and tolerate the code appearing on the next line.
  • Tighten the captured code character class to prevent swallowing multi-word labels when OCR drops punctuation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread e2e-tests/resources/broker_vars.py Outdated
@adombeck
adombeck force-pushed the 1719-e2e-tests-google-login-sometim branch from 10afc4d to 9fdc626 Compare July 13, 2026 10:10
@adombeck

Copy link
Copy Markdown
Contributor Author

Waiting for CI before marking as ready for review

@adombeck

Copy link
Copy Markdown
Contributor Author

CI is failing because of #1730. Waiting until that's fixed.

@adombeck
adombeck force-pushed the 1719-e2e-tests-google-login-sometim branch from 9fdc626 to 3b409d4 Compare July 13, 2026 22:25
@adombeck

Copy link
Copy Markdown
Contributor Author

CI is failing because of #1730. Waiting until that's fixed.

Actually, #1730 only affects the authd-msentraid tests and this change only affects the authd-google tests, so we don't have to wait.

Looking at the test results, the regex change from 9fdc626 was not good, it included other GDM UI text in the match. Copilot came up with an even more convoluted regex to avoid that. It's not pretty but IMO if it works reliably then it's fine.

@adombeck
adombeck force-pushed the 1719-e2e-tests-google-login-sometim branch 4 times, most recently from 221ab31 to 8fd8ecd Compare July 14, 2026 14:01
GDM may separate the device-code label from its value, while OCR can
omit the label colon and introduce whitespace between code characters.
Accept two or more three- or four-letter segments without allowing
adjacent dialog text to be entered into the browser.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@adombeck
adombeck force-pushed the 1719-e2e-tests-google-login-sometim branch from 8fd8ecd to caa2b68 Compare July 20, 2026 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

e2e-tests This issue is related to end-to-end tests / Run end-to-end tests on this pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

e2e-tests: Google login sometimes types "LOGINCODE" instead of the actual device code

2 participants