-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add getByTitle in the browser module #4910
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
Conversation
2b664ad
to
bc19851
Compare
c373455
to
360ac31
Compare
bc19851
to
9629a7a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ankur22 I don't see any concurrency primitive. Is this API synchronous?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity, is there a specific reason why we use static
instead of the idiomatic testdata
folder?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No idea, it's been like that from the beginning as far as I can tell. Are there any advantages to working with testData
over static
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From go help
:
Directory and file names that begin with "." or "_" are ignored by the go tool, as are directories named "testdata".
AFAIK, this means static
folder might be included in the built binary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will add this to the catch all issue to explore once the getBy*
PRs are all merged in 👍
|
||
l := p.GetByTitle(tt.title, tt.opts) | ||
c, err := l.Count() | ||
assert.NoError(t, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert.NoError(t, err) | |
require.NoError(t, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this to force the test to stop if the assert
fails?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is, I don't see the reason to continue running tests if they fail in a place where we don't expect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will review all the assert
s and make sure they are require
where needed in the new tests. I have added an action point in the catch all issue to work on after all the getBy*
APIs have been merged in.
That's correct, it is a synchronous method. When we call However, when we call a method on the locator object (e.g. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
bdf1492
to
c2e8497
Compare
The base branch was changed.
What?
This adds a convenience method on
page
to be able to select on elements with thetitle
attribute.Why?
This is part of the story of adding
getBy*
, which makes working with selectors a little easier. We used to have to work with thepage.locator
API providing either aCSS
selector or aXPath
selector if we wanted to get the element by thetitle
attribute on an element:Now we can use:
Working with
getBy*
in general is an industry standard in the frontend testing world.Checklist
make check
) and all pass.Checklist: Documentation (only for k6 maintainers and if relevant)
Please do not merge this PR until the following items are filled out.
Related PR(s)/Issue(s)
#4793, #4248