|
1 | | -# Test Automation Facade Pattern |
| 1 | +# Test Automation Flow Model Pattern |
2 | 2 |
|
3 | | -Este projeto é uma suíte de testes automatizados utilizando [Playwright](https://playwright.dev/) para validar fluxos de autenticação e cadastro em uma aplicação web. O projeto adota o **Facade Pattern** para organizar e simplificar a interação com as páginas, tornando os testes mais legíveis, reutilizáveis e de fácil manutenção. |
| 3 | +This project is an automated test suite using [Playwright](https://playwright.dev/) to validate authentication and registration flows in a web application. The project adopts the **Flow Model Pattern** to organize and simplify page interactions, making tests more readable, reusable, and easy to maintain. |
4 | 4 |
|
5 | | -## Contexto |
| 5 | +## Context |
6 | 6 |
|
7 | | -O objetivo deste repositório é demonstrar como estruturar testes automatizados de ponta a ponta (E2E) utilizando o padrão de projeto **Facade**. Esse padrão encapsula operações complexas de páginas em classes de fachada, expondo métodos de alto nível para os testes, sem que eles precisem conhecer detalhes de implementação dos elementos da interface. |
| 7 | +The purpose of this repository is to demonstrate how to structure end-to-end (E2E) automated tests using the **Flow Model Pattern**. This pattern encapsulates complex page operations in flow classes, exposing high-level methods for tests without requiring them to know implementation details of the UI elements. |
8 | 8 |
|
9 | | -## Sobre o Facade Pattern |
| 9 | +## About the Flow Model Pattern |
10 | 10 |
|
11 | | -O **Facade Pattern** (Padrão Fachada) é utilizado para fornecer uma interface simplificada para um conjunto de interfaces em um subsistema. No contexto deste projeto, cada fluxo de negócio (ex: autenticação, cadastro) possui uma fachada (`AuthFacade`, `RegisterFacade`) que abstrai as interações com os elementos da página, facilitando a escrita e manutenção dos testes. |
| 11 | +The **Flow Model Pattern** is used to provide a simplified interface for a set of operations in a subsystem. In the context of this project, each business flow (e.g., authentication, registration) has a flow model (`AuthFlow`, `RegisterFlow`) that abstracts interactions with page elements, making test writing and maintenance easier. |
12 | 12 |
|
13 | | -**Exemplo:** |
| 13 | +**Example:** |
14 | 14 | ```typescript |
15 | | -const register = new RegisterFacade(page); |
16 | | -await register.registerAs("email@teste.com", "Nome", "senha", "senha"); |
| 15 | +const register = new RegisterFlow(page); |
| 16 | +await register.registerAs("email@test.com", "Name", "password", "password"); |
17 | 17 | ``` |
18 | 18 |
|
19 | | -## Estrutura do Projeto |
| 19 | +## Project Structure |
20 | 20 |
|
21 | | -- `ui/pages/`: Page Objects com os elementos e ações de cada página. |
22 | | -- `ui/facade/`: Facades que encapsulam fluxos completos de negócio. |
23 | | -- `tests/`: Arquivos de teste automatizados. |
24 | | -- `playwright.config.ts`: Configuração do Playwright (incluindo baseURL). |
| 21 | +- `ui/pages/`: Page Objects with elements and actions for each page. |
| 22 | +- `ui/flows/`: Flow models that encapsulate complete business flows. |
| 23 | +- `tests/`: Automated test files. |
| 24 | +- `playwright.config.ts`: Playwright configuration (including baseURL). |
25 | 25 |
|
26 | | -## Comandos Essenciais |
| 26 | +## Essential Commands |
27 | 27 |
|
28 | | -- **Executar todos os testes:** |
| 28 | +- **Run all tests:** |
29 | 29 | ``` |
30 | 30 | npx playwright test |
31 | 31 | ``` |
32 | 32 |
|
33 | | -- **Executar testes em modo UI interativo:** |
| 33 | +- **Run tests in interactive UI mode:** |
34 | 34 | ``` |
35 | 35 | npx playwright test --ui |
36 | 36 | ``` |
37 | 37 |
|
38 | | -- **Executar testes em um navegador específico:** |
| 38 | +- **Run tests in a specific browser:** |
39 | 39 | ``` |
40 | 40 | npx playwright test --project=chromium |
41 | 41 | ``` |
42 | 42 |
|
43 | | -- **Executar um arquivo de teste específico:** |
| 43 | +- **Run a specific test file:** |
44 | 44 | ``` |
45 | 45 | npx playwright test tests/login.test.ts |
46 | 46 | ``` |
47 | 47 |
|
48 | | -- **Executar em modo debug:** |
| 48 | +- **Run in debug mode:** |
49 | 49 | ``` |
50 | 50 | npx playwright test --debug |
51 | 51 | ``` |
52 | 52 |
|
53 | | -- **Gerar testes automaticamente com Codegen:** |
| 53 | +- **Generate tests automatically with Codegen:** |
54 | 54 | ``` |
55 | 55 | npx playwright codegen |
56 | 56 | ``` |
57 | 57 |
|
58 | | -## Requisitos |
| 58 | +## Requirements |
59 | 59 |
|
60 | | -- Node.js instalado |
61 | | -- Dependências instaladas com: |
| 60 | +- Node.js installed |
| 61 | +- Dependencies installed with: |
62 | 62 | ``` |
63 | 63 | npm install |
64 | 64 | ``` |
65 | 65 |
|
66 | | -## Observações |
| 66 | +## Notes |
67 | 67 |
|
68 | | -- O projeto utiliza `baseURL` configurado no `playwright.config.ts`, permitindo o uso de caminhos relativos nos testes. |
69 | | -- Como a aplicação de exemplo não possui banco de dados persistente, os dados criados existem apenas durante a sessão. |
| 68 | +- The project uses `baseURL` configured in `playwright.config.ts`, allowing the use of relative paths in tests. |
| 69 | +- As the sample application does not have a persistent database, created data exists only during the session. |
0 commit comments