> For the complete documentation index, see [llms.txt](https://docs.decentraland.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.decentraland.org/contributor/contributor-pt/guias-do-contribuidor/testing-standards/testing-e2e.md).

# Testar E2E

{% hint style="info" %}
Esta seção está atualmente em andamento (WIP).
{% endhint %}

Esta seção descreve como os desenvolvedores irão testar a base de código relacionada aos testes e2e.

## Stack de testes

Todos os nossos testes de UI DEVEM ser feitos usando [Cypress](https://www.cypress.io/) como os principais frameworks de teste com [Synpress](https://github.com/Synthetixio/synpress) para suporte a carteiras. O código dos testes DEVE ser escrito usando [Typescript](https://www.typescriptlang.org/) e executado usando [ts-jest](https://github.com/kulshekhar/ts-jest) para ter suporte à verificação de tipos.

## Estrutura de diretórios

Novos testes DEVEM ser colocados em um `tests/e2e` diretório, no caminho raiz. Os arquivos serão nomeados como o fluxo que irão testar, ou seja, se o arquivo de testes e2e for testar o `Collection Publication` fluxo, o nome do arquivo DEVE ser `collection-publication.spec.cy.ts`.

## Com que frequência serão executados

Agendados via GitHub Actions. Frequência a definir.

## O que testar

* Interações de usuário mais relevantes nos dApps (Publicações de Itens, Compras de NFTs, etc.)

## Como testar

Todos os nossos testes DEVEM seguir o estilo semi-estruturado de **Given-When-Then** (GWT).

O exemplo a seguir:

1. **Given** um usuário visita `https://example.cypress.io`
2. **When** ele clica no link rotulado `type`
3. E ele digita "<fake@email.com>" no `[data-testid="action-email"]` input
4. **Em seguida** a URL deve incluir `/commands/actions`
5. E o `[data-testid="action-email"]` input tem "<fake@email.com>" como seu valor

Deve ser escrito como:

```jsx
describe('Given a user visits https://example.cypress.io', () => {
  beforeEach(() => {
    cy.visit('https://example.cypress.io')
  })

  describe('when clicks the link labeled type', () => {
    beforeEach(() => {
      cy.contains('type').click()
    })

    describe('and type an email into the action-email input', () => {
      beforeEach(() => {
        // Get an input, type into it
        cy.get('.action-email').type('fake@email.com')
      })

      it('Then the url should include /commands/actions', () => {
        // Should be on a new URL which
        // includes '/commands/actions'
        cy.url().should('include', '/commands/actions')
      })

      it('and the action-email input value should contain the typed email', () => {
        //  Verify that the value has been updated
        cy.get('.action-email').should('have.value', 'fake@email.com')
      })
    })
  })
})
```

## Testando contratos

Para testar smart contracts, consulte a documentação Solidity Standards.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.decentraland.org/contributor/contributor-pt/guias-do-contribuidor/testing-standards/testing-e2e.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
