For the complete documentation index, see llms.txt. This page is also available as Markdown.
Testar E2E
Esta seção está atualmente em andamento (WIP).
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 como os principais frameworks de teste com Synpress para suporte a carteiras. O código dos testes DEVE ser escrito usando Typescript e executado usando 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:
Given um usuário visita https://example.cypress.io
When ele clica no link rotulado type
E ele digita "[email protected]" no [data-testid="action-email"] input
Em seguida a URL deve incluir /commands/actions
E o [data-testid="action-email"] input tem "[email protected]" como seu valor
Deve ser escrito como:
Testando contratos
Para testar smart contracts, consulte a documentação Solidity Standards.
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('[email protected]')
})
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', '[email protected]')
})
})
})
})