-
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
docs(blog): introduce Detox Copilot. #4596
base: master
Are you sure you want to change the base?
Conversation
|
||
Detox Copilot leverages advanced Large Language Models (LLMs) to interpret natural language instructions and translate them into Detox actions and assertions. This means you can describe your test scenarios in everyday language, aligning perfectly with **Behavior-Driven Development (BDD)** principles. | ||
|
||
### Why Natural Language Testing? |
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 also need to preset the benefits of the reduced maintenance cost (i.e. thanks to the decoupling from specific test ID's, not to mention xpath, etc). Let's try to come up with some examples? It's too important to be overlooked 🤔
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.
100%
gosha212: | ||
name: Georgy Steshin | ||
title: Detox Core Contributor | ||
url: https://github.com/jonathanmos | ||
image_url: https://github.com/jonathanmos.png | ||
url: https://github.com/gosha212 | ||
image_url: https://github.com/gosha212.png |
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.
😅
|
||
### Seamless Integration with Detox | ||
|
||
Detox Copilot is built into Detox and requires no additional installation. Simply initialize it in your test setup, and you're ready to start writing natural language tests. |
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.
good stuff!
|
||
Initialize Detox Copilot in your test setup by implementing a `PromptHandler` that connects to your LLM service. This abstraction allows Detox Copilot to communicate with any LLM you choose, promoting versatility across different testing frameworks. | ||
|
||
In our [Testing with Copilot guide](https://wix.github.io/Detox/docs/next/guide/testing-with-copilot), you can find implementation examples and more detailed descriptions for this part. |
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.
/next/...
?
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.
yeah, next/
is the most up-to-date docs (on master). I'll try to use the latest published version instead.
**Hybrid Example:** | ||
|
||
```javascript | ||
it('should add an item to the cart', async () => { |
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.
Good example
const pageTitle = await copilot.perform( | ||
'Launch the app', | ||
'Navigate to the "Profile" page', | ||
'Return the text of the page title' |
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.
Woah, can't believe this actually works (!)
); | ||
|
||
// Use the returned value in a hard-coded assertion | ||
jestExpect(pageTitle).toBe('Profile'); |
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.
Hmm isn't this discouraged? I wonder
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.
hmm, yeahhh.. you're right. not the best example for this ability. smells like a bad practice 😄 . I'll try to come with a better one / remove it
|
||
You can also use Copilot for locating the elements and then use them in your hard-coded assertions. | ||
|
||
**Locating Elements Example:** |
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 really cool!
|
||
In our [Testing with Copilot guide](https://wix.github.io/Detox/docs/next/guide/testing-with-copilot), you can find implementation examples and more detailed descriptions for this part. | ||
|
||
### Step 2: Write Tests Using Natural Language |
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.
Shouldn't this be a part of the "Testing with CoPilot" guide?
'Verify that the product is listed in the cart' | ||
); | ||
}); | ||
``` |
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.
BTW, what about attributes inspection (as prompts)?
- Color assertions
- Element size
Value of progress bar / check-box / etc
Maybe this is a 1st in a whole new set of questions we can ask, IDK
No description provided.