Repository navigation
test(sample): make the first test people read show the locator API - #1
Merged
Merged
Conversation
SampleTest is the file a newcomer opens first, and it was two identical copies of
getDriver().get("https://google.com");
assertEquals(getDriver().getTitle(), "Google");
plus a block of commented-out dead code. It ignored baseUrl and open(), navigated
off the demo app to a site that blocks automation, and demonstrated nothing the
framework does. The shop window showed the opposite of the pitch — while
LocatorApiDemoTest and SemanticLocatorDemoTest, which do show it, sit deeper in
the tree where nobody looks first.
Now: two tests against the demo app using getByLabel, getByRole, getByTestId and
web-first assertions, with a class comment stating exactly what is absent (driver
setup, WebDriverWait, CSS/XPath) and pointing at LocatorApiDemoTest for the rest.
Verified: 2/2 green against panjatan.netlify.app in real Chrome via xvfb, and the
surrounding suite stayed green (11/11 in the same run).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem
SampleTestis the file a newcomer opens first. It was two identical copies of:plus a block of commented-out dead code.
It ignored
baseUrlandopen(), navigated off the demo app to a site that blocks automation, and demonstrated nothing the framework does. The shop window showed the opposite of the pitch — whileLocatorApiDemoTestandSemanticLocatorDemoTest, which do show it, sit deeper in the tree where nobody looks first.The change
Two tests against the demo app using
getByLabel,getByRole,getByTestIdand web-first assertions, with a class comment stating exactly what is absent — driver setup,WebDriverWait, CSS selectors, XPath — and pointing atLocatorApiDemoTestfor the full surface.Raw Selenium is still not hidden; the comment says so and
getDriver()remains available.Verification
2/2 green against
panjatan.netlify.appin real Chrome underxvfb, and the surrounding suite stayed green in the same run (11/11).Locators were chosen from the demo app's actual markup —
<label for="username">Username:</label>,<button aria-label="Login">,data-testid="login-submit-btn"anddata-testid="remember-checkbox"— not guessed.Pairs with
seleniumboot/selenium-boot#40, which fixes the same gap in the README quickstart.