Here is something I have noticed about my projects and using Copilot lately. When I add a new NPM dependency, I also update the Copilot instructions file to include examples of how I want to use that dependency in my tests.
For example, let's say I need to test if item prices on the inventory page are sorted.

We can use cypress-map queries to create a retry-able chain of commands.
1 | import { LoginPage } from '@support/pages/login.page' |
🎓 This example comes from my online courses Testing The Swag Store and Write Cypress Tests Using GitHub Copilot.
How do we write the last assertion following the // confirm the numbers are sorted in ascending order comment? We can ask Copilot or wait for it to suggest the code completion. Here is one possible suggestion:
1 | .then((prices) => { |

The test runs and shows an anonymous deeply equal assertion inside the .then(callback) function:

Nothing wrong with this suggestion (except it is not retry-able), but I prefer using chai-sorted plugin instead. The assertions are easier to read and much shorter. Let's install the plugin:
1 | $ npm i -D chai-sorted |
Then we update the cypress/support/e2e.js file to include the plugin:
1 | // https://www.chaijs.com/plugins/chai-sorted/ |
Now we need to tell Copilot to use the newly installed plugin. We can update the Copilot instruction file
1 | This is a project that uses Cypress for end-to-end testing, and follows best practices. |
Now let's return the test and see what Copilot suggests for the last assertion:

Much shorter and easier to read, and it even includes helpful text, unlike .then(callback) we had before! This is exactly what we wanted. Here is the passing test

Perfect.