# E2E testing best practices

## Organizing Tests

### **Writing Tests**:&#x20;

It is a good practice to group test based from its feature/purpose. \
\&#xNAN;*Example*: In an web application, there are level of user access on the page. And since the two are distinct to one another, then it is best to separate its Feature files. One directory that contains not logged in are name **Guest**. And the other one **Member**.  \
&#x20;

![](https://2808248181-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8eU2eqBm5NpK3wHDjfNO%2Fuploads%2FZ3JFv2LEG17IkjpNzvgu%2Fimage.png?alt=media\&token=a14b1acc-8f52-47a0-8e5a-1d5717d507f1)

### Logging In:&#x20;

What is needed?

* `Abstraction`
* `Reusable`
* `Decouple`

The best approach to Login was to use a custom commands since it can be used multiples time as long as the login call is declared. And since custom commands are loaded before any test files are evaluated via an import statement, it is way more faster than having a method inside a test or using page objects.\
\
Login without a relying on the UI. These is possible with the used of POST request authentication.&#x20;

\
References:

{% embed url="<https://docs.cypress.io/guides/references/best-practices>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hov-qa.gitbook.io/hov-qa-engineers/agile-testing/e2e-testing-best-practices.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
