An open API service indexing awesome lists of open source software.

https://github.com/alisson-t-bucchi/cc360-selenium-java

CC360 onmichannel Cisco plataform automation with Selenium and Java.
https://github.com/alisson-t-bucchi/cc360-selenium-java

e2e-tests java11-spring-boot junit4 maven personal-project pom selenium-webdriver slf4j surefire-reporting

Last synced: 7 months ago
JSON representation

CC360 onmichannel Cisco plataform automation with Selenium and Java.

Awesome Lists containing this project

README

          

# Test Automation with Selenium and JUnit

Welcome to the repository for **Selenium WebDriver Tests**. This repository contains a set of automated tests written in **Java** using **Selenium WebDriver** and **JUnit**. The tests interact with a web application to ensure the functionality of various forms and dropdowns. This project has POM.XML configuration to produce detailed error reports with **Surefire Reports** and insert in **DevOps methodology to be integrated in CD/CI pipeline** with **Jenkins** and **Docker**.

---

## Prerequisites

Before running the tests, ensure you have the following installed:

- **JDK 11 or higher**: Required for compiling and running Java code.
- **Maven** or **Gradle**: To manage dependencies (choose one based on your preference).
- **Selenium WebDriver**: To perform browser automation.
- **WebDriverManager**: To automatically manage browser drivers.
- **JUnit 4**: Testing framework used to organize and execute tests.
- **ChromeDriver**: The WebDriver used for testing with Google Chrome.

---

## Dependencies

You can use **Maven** or **Gradle** to manage the dependencies.

### Maven (`pom.xml`):

```xml


org.seleniumhq.selenium
selenium-java
4.0.0


io.github.bonigarcia
webdrivermanager
5.2.0


org.junit.jupiter
junit-jupiter-api
5.7.2
test


org.junit.jupiter
junit-jupiter-engine
5.7.2
test


commons-io
commons-io
2.8.0

```

## Running the tests

To run the testm follow the steps below:

### Step 1: Set Up the Project

1. Clone the repository to you local machine:
git clone https://bitbucket.org/your-username/your-repository.git

2. Install Mave or Gradle:
Maven Installation Guide - https://maven.apache.org/install.html
Gradle Installation Guide - https://gradle.org/install/

3. Install dependencies:
- with Maven:
mvn clean install

- with Gradle:
gradle build

### Step 2: Run the tests

To execute the testm you can use the following commands:
- with Maven:
mvn test

- with Gradle
gradle test

Alternatively, you can run the tests directly from your IDE (like IntelliJ or Eclipse) by selecting the test class and clicking Run.

---

## Test Details:

setUp()
Purpose: Prepares the WebDriver and navigates to the application’s URL.
Actions:
Sets the WebDriver system property to use the jdk-http-client.
Uses WebDriverManager to set up the ChromeDriver.
Maximizes the browser window.
Waits until the URL contains the string search360.

Test1()
Purpose: Tests filling out a form.
Actions:
Fills in the form fields:
refInterna: test.refInterna
agente: test.agente
emailCliente: test.emailCliente
telefone: test.telefone
Takes a screenshot and saves it to C:\Screenshots\search_images2.png.

Test2()
Purpose: Tests selecting options in various dropdown menus.
Actions:
Selects the Linha de Atendimento dropdown (e.g., WhatsApp).
Selects the Categoria dropdown.
Selects the Sub-Categoria dropdown.
Selects the Motivo dropdown.
Selects the Estado dropdown.
Each dropdown selection is made after waiting for the corresponding option to become clickable.

tearDown()
Purpose: Cleans up after the test.
Actions:
Closes the browser window after each test.

---

### Screenshot Capture

- The tests automatically capture a screenshot after completing Test1(). The screenshot is saved to the local directory C:\\CC360-selenium-java\\src\\test\\java\\screenshots
- You can modify this file path to save the screenshot to another location if needed.

---

### Additional Information

- WebDriver: The tests are configured to use Google Chrome. To use another browser (e.g., Firefox), modify the driver = new ChromeDrive (); line in the code.

- WebDriverManager: Automatically manages the browser driver, ensuring compatibility between the Selenium version and the browser's driver.

- JUnit: Tests are organized using JUnit 4, and execution order is based on method names (due to the @FixMethodOrder(MethodSorters.NAME_ASCENDING) annotation).

---

### Contributing

- If you would like to contribute to this project, follow these steps:
1. Fork the repository.
2. Create a new branch for your feature or fix.
3. Make your changes and commit them.
4. Push your changes to your fork.
5. Submit a pull request.

We welcome contributions and are happy to review your changes!

---

### License

- This project is licensed under the MIT License.