-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
test: add more E2E test suites for Detox Copilot #4623
Conversation
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('should assert an element is visible', async () => { | ||
await copilot.perform( | ||
'Find an element with ID "main-text" in the Assertions', | ||
'Verify that the text of this element is "i contain some text"', | ||
); | ||
}); |
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 think we need to assert this in one step (Verify there's an element with the text "..."..)
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.
we need to have such test for each kind of assertion (there's an element with the text / id / label / type [e.g. "check-box"])
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.
+ test that expects failures for invalid assertions (rejects.toThrowError()
) for each of the matching types
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.
do you have more ideas for assertions?
we're not limited to the "old" types of matchers, let's include more types of assertions that is reasonable to perform with Copilot
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.
Currently, there are tests for the following:
- Assertion with id + expects failures for invalid value
- Assertion with text + expects failures for invalid value
- Assertion by label + expects failures for invalid value
- Assertion by type + expects failures for invalid value
More options that may be relevant:
- Assert that elements are in a specific order
- Assert that an animation occurs within a specific timeframe
- Assert that an image loads correctly and has the expected source
- Assert that an element is in a specific color
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 that elements are in a specific order - 👍🏼
Assert that an animation occurs within a specific timeframe - 👎🏼
Assert that an image loads correctly 👍🏼 and has the expected source 👎🏼
Assert that an element is in a specific color 👍🏼
Perhaps assertion on element position? (e.g. bottom -right)
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.
The assertions were added. They exposed a problem of the copilot to understand the order and locations of elements, mostly when expecting a test to fail. An issue was added.
|
||
it('should not assert an element that does not exist (by label)', async () => { | ||
await jestExpect(async () => | ||
await copilot.perform('Find an element with label "Does not exist" in the Assertions') |
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.
Does not exist
is too explicit for the copilot, try something with "Banana Split" or "I contain lots of text" that resembles a text that actually exists
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.
Changed to: "I am full of text" and "I exist in the screen"
it('shouldn`t assert an element that does not exist (by type)', async () => { | ||
await jestExpect(async () => | ||
await copilot.perform('Find a Check-box type element in the Assertions') |
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.
add a test with another element type: perhaps text-field
?
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.
With text-field the test passed.
The checkbox test is skipped for now with a note that describes the doubts we have.
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.
const DUMMY_COORDINATE1_LONGITUDE = '66.5'; | ||
const DUMMY_COORDINATE1_LATITUDE = '-80.125'; | ||
const DUMMY_COORDINATE2_LONGITUDE = '-80.125'; | ||
const DUMMY_COORDINATE2_LATITUDE = '66.5'; |
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.
perfect
Including assertions screen changes
test: Change the launching app date to constant date Instead of generating the current date and time. For more stable testing, and for the copilot cache. including changes in the date picker screen
The cache file was modified as a result of incorporating four new test suites: assertions, location, datepicker and visibility.
02b1e55
to
6834970
Compare
Added new E2E test suites for Detox Copilot, made several improvements to the Copilot driver.
Resolves #4612