Understanding Locators in Vitest
Understanding Locators in Vitest
I am doing really well. I am doing things a lot more independently. It is going really well. I am writing some tests write now. I am struggling to grasp get by role. One of my mentors sent me the vitest docs.
I have a new rule about documentation from another mentor:
"When I encounter something new, the first port of call should be how the docs describe it and summarise it."
One more time:
"When I encounter something new, the first port of call should be how the docs describe it and summarise it."
So I am being a good mentee.
So what on earth is a locator?
A locator is "a representation of an element or a number of elements."
"Every locator is defined by a string called a selector." What? Huh? Huh? Huh?
"Vitest abstracts this selector by providing convenient methods that generate them behind the scenes."
I understand almost nothing
getByRole
Right this is the one I want so let's focus on that one for today
I of course do not understand the example
edit: I have since this morning written a ton of tests using getByRole
I guess I no longer need this doc
.png)
Comments
Post a Comment