|
1 | | -# vaadin-playwright-junit |
| 1 | +# Pruebas E2E en Vaadin con Playwright y JUnit 5 |
2 | 2 |
|
3 | | -This project can be used as a starting point to create your own Vaadin application with Spring Boot. |
4 | | -It contains all the necessary configuration and some placeholder files to get you started. |
| 3 | +Este proyecto es un ejemplo y punto de partida para configurar pruebas End-to-End (E2E) en una aplicación Vaadin, |
| 4 | +utilizando Playwright como motor de automatización y JUnit 5 como framework de pruebas. |
5 | 5 |
|
6 | | -## Running the application |
| 6 | +El objetivo es demostrar cómo |
| 7 | +integrar pruebas de UI automatizadas en un flujo de desarrollo y de Integración Continua (CI) a través de GitHub |
| 8 | +Actions. |
7 | 9 |
|
8 | | -Open the project in an IDE. You can download the [IntelliJ community edition](https://www.jetbrains.com/idea/download) if you do not have a suitable IDE already. |
9 | | -Once opened in the IDE, locate the `Application` class and run the main method using "Debug". |
| 10 | +## Flujo de Trabajo del Proyecto |
10 | 11 |
|
11 | | -For more information on installing in various IDEs, see [how to import Vaadin projects to different IDEs](https://vaadin.com/docs/latest/getting-started/import). |
| 12 | +El flujo principal de este repositorio se centra en tres áreas clave: |
12 | 13 |
|
13 | | -If you install the Vaadin plugin for IntelliJ, you should instead launch the `Application` class using "Debug using HotswapAgent" to see updates in the Java code immediately reflected in the browser. |
| 14 | +1. **La Aplicación Vaadin:** Una aplicación web simple |
| 15 | + que sirve como sujeto de prueba. |
| 16 | +2. **Las Pruebas E2E:** Scripts de prueba que simulan la interacción de un usuario con la |
| 17 | + aplicación. |
| 18 | +3. **La Integración Continua (CI):** Un pipeline automatizado que ejecuta las pruebas en cada cambio para |
| 19 | + garantizar la calidad del código. |
14 | 20 |
|
15 | | -## Deploying to Production |
| 21 | +## Ejecución de las Pruebas |
16 | 22 |
|
17 | | -The project is a standard Maven project. To create a production build, call |
| 23 | +### 1. Ejecución en Local |
18 | 24 |
|
19 | | -``` |
20 | | -./mvnw clean package -Pproduction |
| 25 | +Para ejecutar las pruebas en tu máquina, el proyecto utiliza Maven. El siguiente comando compilará la aplicación, la |
| 26 | +iniciará, ejecutará las pruebas de Playwright contra ella y finalmente la detendrá. |
| 27 | + |
| 28 | +```shell |
| 29 | +./mvnw verify |
21 | 30 | ``` |
22 | 31 |
|
23 | | -If you have Maven globally installed, you can replace `./mvnw` with `mvn`. |
| 32 | +Si tienes Maven instalado globalmente, puedes usar `mvn verify`. Las pruebas se encuentran en el directorio |
| 33 | +`src/test/java`. |
24 | 34 |
|
25 | | -This will build a JAR file with all the dependencies and front-end resources,ready to be run. The file can be found in the `target` folder after the build completes. |
26 | | -You then launch the application using |
27 | | -``` |
28 | | -java -jar target/vaadin-playwright-junit-1.0-SNAPSHOT.jar |
| 35 | +### 2. Integración Continua con GitHub Actions |
| 36 | + |
| 37 | +El repositorio incluye un flujo de trabajo preconfigurado en `.github/workflows/playwright-java.yml`. Este workflow se |
| 38 | +activa |
| 39 | +automáticamente con cada `push` o `pull request` al repositorio y realiza los siguientes pasos: |
| 40 | + |
| 41 | +* Configura el entorno de Java. |
| 42 | +* Construye el proyecto. |
| 43 | +* Ejecuta el comando `./mvnw verify` para lanzar las pruebas E2E. |
| 44 | + |
| 45 | +Esto asegura que ninguna nueva contribución rompa la funcionalidad existente de la interfaz de usuario. |
| 46 | + |
| 47 | +### 3. Probar GitHub Actions Localmente con `act` |
| 48 | + |
| 49 | +Para validar los cambios en el workflow de GitHub Actions sin necesidad de hacer un `push` al repositorio, puedes usar |
| 50 | +`act`. Esta herramienta te permite ejecutar tus workflows de GitHub Actions localmente. |
| 51 | + |
| 52 | +**Pasos para usar act:** |
| 53 | + |
| 54 | +1. **Instala `act`**: Sigue las instrucciones de instalación oficiales. |
| 55 | +2. **Ejecuta el workflow**: Desde la raíz del proyecto, simplemente ejecuta el comando: |
| 56 | + |
| 57 | +```shell |
| 58 | + act |
29 | 59 | ``` |
30 | 60 |
|
31 | | -## Project structure |
32 | | - |
33 | | -- `MainLayout.java` in `src/main/java` contains the navigation setup (i.e., the |
34 | | - side/top bar and the main menu). This setup uses |
35 | | - [App Layout](https://vaadin.com/docs/components/app-layout). |
36 | | -- `views` package in `src/main/java` contains the server-side Java views of your application. |
37 | | -- `views` folder in `src/main/frontend` contains the client-side JavaScript views of your application. |
38 | | -- `themes` folder in `src/main/frontend` contains the custom CSS styles. |
39 | | - |
40 | | -## Useful links |
41 | | - |
42 | | -- Read the documentation at [vaadin.com/docs](https://vaadin.com/docs). |
43 | | -- Follow the tutorial at [vaadin.com/docs/latest/tutorial/overview](https://vaadin.com/docs/latest/tutorial/overview). |
44 | | -- Create new projects at [start.vaadin.com](https://start.vaadin.com/). |
45 | | -- Search UI components and their usage examples at [vaadin.com/docs/latest/components](https://vaadin.com/docs/latest/components). |
46 | | -- View use case applications that demonstrate Vaadin capabilities at [vaadin.com/examples-and-demos](https://vaadin.com/examples-and-demos). |
47 | | -- Build any UI without custom CSS by discovering Vaadin's set of [CSS utility classes](https://vaadin.com/docs/styling/lumo/utility-classes). |
48 | | -- Find a collection of solutions to common use cases at [cookbook.vaadin.com](https://cookbook.vaadin.com/). |
49 | | -- Find add-ons at [vaadin.com/directory](https://vaadin.com/directory). |
50 | | -- Ask questions on [Stack Overflow](https://stackoverflow.com/questions/tagged/vaadin) or join our [Forum](https://vaadin.com/forum). |
51 | | -- Report issues, create pull requests in [GitHub](https://github.com/vaadin). |
| 61 | +`act` leerá el archivo `.github/workflows/playwright-java.yml` y ejecutará los jobs definidos, dándote feedback |
| 62 | +inmediato sobre el |
| 63 | +funcionamiento de tu pipeline de CI. |
| 64 | + |
| 65 | +## Estructura del Proyecto |
| 66 | + |
| 67 | +* `src/main/java`: Contiene el código fuente de la aplicación Vaadin que se va a probar. |
| 68 | +* `src/test/java`: Contiene las clases de prueba escritas con JUnit 5 y Playwright. |
| 69 | +* `.github/workflows/playwright-java.yml`: Define el pipeline de Integración Continua. |
| 70 | +* `pom.xml`: Gestiona las dependencias del proyecto, incluyendo Vaadin, Playwright, JUnit y los plugins de Maven |
| 71 | + necesarios. |
0 commit comments