generated from upex-galaxy/seleniumjava-template-gx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from upex-galaxy/Test/GX248/SwagLabsPDP
Test/gx248/swag labs pdp
- Loading branch information
Showing
14 changed files
with
585 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: 🤖CI run Test Suite Execution🧪 | ||
run-name: ${{github.actor}}👨🏻🔬 ran SanityTest in ${{github.ref_name}} | ||
|
||
on: # This Run is a template. The correct "Run On" should be: Any except QA and Main | ||
push: | ||
branches: ['Test/GX248/SwagLabsPDP'] | ||
|
||
jobs: | ||
SanityTest: | ||
name: Sanity Test | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: 💻Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: 💿Set up JAVA 20 with Maven | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '20' | ||
distribution: 'temurin' | ||
cache: maven | ||
|
||
- name: 🧬Install All Dependencies with Maven | ||
run: mvn -B package --file pom.xml | ||
|
||
- name: 🧪Run Selenium tests | ||
run: mvn clean verify -Dit.test=EriProductDetailsTest -Dheadless=true | ||
|
||
- name: ✅Import Test Results to Xray | ||
if: always() | ||
uses: mikepenz/xray-action@v2 | ||
with: #todo: OPCIONES PARA IMPORTAR LOS RESULTADOS DE PRUEBA A JIRA XRAY: | ||
username: ${{secrets.XRAY_CLIENT_ID}} | ||
password: ${{secrets.XRAY_CLIENT_SECRET}} | ||
testFormat: 'junit' #OPCIONES PARA CAMBIAR: 'junit' (para xml) o 'cucumber' (para json) | ||
testPaths: 'target/failsafe-reports/TEST-*.xml' | ||
testExecKey: 'GX3-252' #? EDITAR AQUÍ EL TEST EXECUTION A IMPORTAR LAS PRUEBAS. | ||
projectKey: 'GX3' #? EDITAR EN CASO DE TRABAJAR CON OTRO PROYECTO. | ||
|
||
- name: 🔔Slack Notification of Done | ||
if: always() | ||
uses: rtCamp/action-slack-notify@v2.2.0 | ||
env: | ||
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | ||
SLACK_USERNAME: Ari✨ | ||
SLACK_MESSAGE: ':test_tube: SELENIUM-JAVA (SwagLabs): Test Execution is Done and updated in Jira :rocket:' | ||
SLACK_COLOR: ${{ job.status }} | ||
SLACK_ICON: https://i.imgur.com/q9kvQCp_d.webp?maxwidth=760&fidelity=grand |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
allure-results/bda2be8f-a03b-4ae6-9a50-b74eafd5365e-result.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"uuid":"bda2be8f-a03b-4ae6-9a50-b74eafd5365e","historyId":"8eac1955075f90e1ad4932486935d222","testCaseId":"[engine:junit-jupiter]/[class:e2e.steps.ShoppingCart.Nati.NatiRemoveProductTest]/[method:removeItemSucessfully()]","testCaseName":"GX3-296 | TC1: Validar que remueve un producto del carrito","fullName":"e2e.steps.ShoppingCart.Nati.NatiRemoveProductTest.removeItemSucessfully","labels":[{"name":"junit.platform.uniqueid","value":"[engine:junit-jupiter]/[class:e2e.steps.ShoppingCart.Nati.NatiRemoveProductTest]/[method:removeItemSucessfully()]"},{"name":"host","value":"TRJ-G69HHS3"},{"name":"thread","value":"27428@TRJ-G69HHS3.main(1)"},{"name":"framework","value":"junit-platform"},{"name":"language","value":"java"},{"name":"package","value":"e2e.steps.ShoppingCart.Nati.NatiRemoveProductTest"},{"name":"testClass","value":"e2e.steps.ShoppingCart.Nati.NatiRemoveProductTest"},{"name":"testMethod","value":"removeItemSucessfully"},{"name":"suite","value":"e2e.steps.ShoppingCart.Nati.NatiRemoveProductTest"}],"links":[],"name":"GX3-296 | TC1: Validar que remueve un producto del carrito","status":"passed","stage":"finished","description":"","steps":[],"attachments":[],"parameters":[],"start":1700024280384,"stop":1700024289097} |
1 change: 1 addition & 0 deletions
1
allure-results/c90e80fc-730b-4a5d-ab8f-22d276c58f6b-container.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"uuid":"c90e80fc-730b-4a5d-ab8f-22d276c58f6b","name":"GX3-296 | TC1: Validar que remueve un producto del carrito","children":["bda2be8f-a03b-4ae6-9a50-b74eafd5365e"],"befores":[],"afters":[],"start":1700024280320,"stop":1700024289161} |
1 change: 1 addition & 0 deletions
1
allure-results/f669a26f-0b42-42eb-909b-05ae1df8a905-container.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"uuid":"f669a26f-0b42-42eb-909b-05ae1df8a905","name":"NatiRemoveProductTest","children":["bda2be8f-a03b-4ae6-9a50-b74eafd5365e"],"befores":[],"afters":[],"start":1700024280304,"stop":1700024289177} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#[Automation] SwagLabs | PDP | Visualizar Detalles del Item (Producto) | ||
|
||
COMO Usuario de la página Web. Swag Labs | ||
|
||
QUIERO Visualizar en el PDP: | ||
|
||
Visualizar etiqueta con nombre del producto. | ||
|
||
Visualizar descripción del producto. | ||
|
||
Visualizar imagen del producto. | ||
|
||
Indicar precio del producto. | ||
|
||
Visualizar el Botón para Agregar el Producto al SCP o Removerlo | ||
|
||
Visualizar el Botón “Back to Products” para regresar | ||
|
||
PARA Conocer mas sobre el producto. | ||
|
||
```feature | ||
✅ACCEPTANCE CRITERIA | ||
Feature: Product Detail Page | ||
Background: Given: el usuario esta LOGEADO. And: se situa en el PLP. | ||
Scenario: usuario ingresa en los Detalles de un producto sin añadir. When: usuario seleciona cualquier producto (click en la imagen o nombre). Then: | ||
se visualiza: la etiqueta con nombre del producto. la descripción del producto. la imagen del producto. el precio del producto. el Botón "Back to | ||
Products" el Botón "Add to Cart" // Para más información, ver el MOCKUP | ||
Scenario: usuario ingresa en los Detalles de un producto añadido al SCP. Given: el producto debe haber sido añadido al SCP (de cualquier modo) When: | ||
usuario seleciona cualquier producto (click en la imagen o nombre). Then: se visualiza: la etiqueta con nombre del producto. la descripción del | ||
producto. la imagen del producto. el precio del producto. el Botón "Back to Products" el Botón "Remove" | ||
BUSINESS RULES SPEC | ||
CONDICIONES: Estar Logeado: | ||
Accepted usernames are: Password for all users: standard_user locked_out_user problem_user performance_glitch_user | ||
secret_sauce | ||
IF: | ||
El usuario se encuentra logeado: | ||
Se encuentra en cualquier PDP | ||
THEN: | ||
Visualiza etiqueta con nombre del producto | ||
Visualiza descripción del producto | ||
Visualiza imagen del producto | ||
Visualiza el precio del producto | ||
``` |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# ⚡️\[Automation\] SwagLabs | SCP | Agregar producto al carrito de compras desde el PLP o PDP | ||
|
||
[GX3-321](https://upexgalaxy26.atlassian.net/browse/GX3-321) Created: 7/11/23 Updated: 7/11/23 | ||
|
||
**COMO** usuario de la pagina Web [https://www.saucedemo.com/](https://www.saucedemo.com/ 'smart-link') | ||
|
||
**QUIERO** agregar productos de la tienda al carrito de compras | ||
|
||
**PARA** luego realizar el Checkout | ||
|
||
```feature | ||
Feature: Add To Cart | ||
Background: | ||
Given: el usuario ha iniciado sesión. | ||
And: el producto NO ha sido añadido al SCP aún | ||
Scenario: Usuario añade un producto del PLP al Shopping-Cart exitosamente. | ||
Given: el usuario se encuentra en el PLP | ||
When: el usuario hace click sobre el boton “Add To Cart” en el producto deseado. | ||
Then: el producto se agrega al Shopping-Cart. | ||
And: el string del botón "Add to Cart" es cambiado a "Remove" | ||
And: se suma +1 en el icono del carrito de compras, ubicado en la parte superior derecha. | ||
And: el producto añadido desde el PLP debe visualizar las mismas características en el SCP | ||
Scenario: Usuario añade un producto del PDP al Shopping-Cart exitosamente. | ||
Given: el usuario se encuentra en el PDP del producto | ||
When: el usuario hace click sobre el boton “Add To Cart”. | ||
Then: el producto se agrega al Shopping-Cart. | ||
And: el string del botón "Add to Cart" es cambiado a "Remove" | ||
And: se suma +1 en el icono del carrito de compras, ubicado en la parte superior derecha. | ||
And: el producto añadido desde el PDP debe visualizar las mismas características en el SCP | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package e2e.pages.Eri; | ||
|
||
//import org.junit.Test; | ||
//import org.junit.jupiter.api.DisplayName; | ||
//import java.util.List; | ||
import java.util.function.Supplier; | ||
|
||
//import org.openqa.selenium.By; | ||
import org.openqa.selenium.*; | ||
|
||
//import e2e.pages.Eri.ProductDetailsPage; | ||
import e2e.utils.*; | ||
|
||
//* Tech Debt: GX3-248 =https://upexgalaxy26.atlassian.net/browse/GX3-248 */ | ||
public class LoginPage { | ||
|
||
// Login | ||
WebDriver web; | ||
Locator get; | ||
Action Do; | ||
Assertion validate; | ||
Supplier<WebElement> usernameInput; | ||
Supplier<WebElement> passwordInput; | ||
Supplier<WebElement> loginSubmitButton; | ||
|
||
// * #1 ARMAR EL CONSTRUCTOR con WebDriver (para usar los selectores/Locators) | ||
public LoginPage(WebDriver driver, Locator locator, Action action) { | ||
this.web = driver; | ||
this.get = locator; | ||
this.Do = action; | ||
this.validate = new Assertion(); | ||
|
||
// * #2 LOCATORS DE PAGE => dentro del Constructor (requiere tipado Suppiler<>) | ||
// login | ||
this.usernameInput = () -> this.get.ByTestId("username"); | ||
this.passwordInput = () -> this.get.ByTestId("password"); | ||
this.loginSubmitButton = () -> this.get.ByTestId("login-button"); | ||
} | ||
|
||
// * MÉTODOS CON LOS SELECTORES => métodos public void/String/WebElement/Numbers | ||
public void enterUsername(String value) { | ||
this.Do.enterValue(this.usernameInput.get(), value); | ||
} | ||
|
||
// * MÉTODOS CON LOS SELECTORES => métodos public void/String/WebElement/Numbers | ||
public void enterPassword(String value) { | ||
this.Do.enterValue(this.passwordInput.get(), value); | ||
} | ||
|
||
// * MÉTODOS CON LOS SELECTORES => métodos public void/String/WebElement/Numbers | ||
public void submitLogin() { | ||
this.Do.click(this.loginSubmitButton.get()); | ||
} | ||
|
||
public void Login() { | ||
this.enterUsername("standard_user"); | ||
this.enterPassword("secret_sauce"); | ||
this.submitLogin(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
package e2e.pages.Eri; | ||
|
||
//import org.junit.Test; | ||
//import org.junit.jupiter.api.DisplayName; | ||
import java.util.List; | ||
import java.util.function.Supplier; | ||
|
||
//import org.openqa.selenium.By; | ||
import org.openqa.selenium.WebDriver; | ||
import org.openqa.selenium.WebElement; | ||
|
||
import e2e.pages.Eri.ProductDetailsPage; | ||
import e2e.utils.Action; | ||
import e2e.utils.Assertion; | ||
import e2e.utils.Locator; | ||
|
||
//* Tech Debt: GX3-248 =https://upexgalaxy26.atlassian.net/browse/GX3-248 */ | ||
public class ProductDetailsPage { | ||
|
||
private Locator get; | ||
private Action Do; | ||
private Assertion validate; | ||
// PLP | ||
public Supplier<List<WebElement>> productImages; | ||
public Supplier<List<WebElement>> productTitle; | ||
public Supplier<List<WebElement>> productName; | ||
public Supplier<List<WebElement>> productDescription; | ||
public Supplier<List<WebElement>> productImage; | ||
public Supplier<List<WebElement>> productPrice; | ||
public Supplier<List<WebElement>> addToCartButton; | ||
public Supplier<WebElement> backButton; | ||
private Supplier<WebElement> yourCart; | ||
public Supplier<WebElement> removeButton; | ||
|
||
// * #1 ARMAR EL CONSTRUCTOR con WebDriver (para usar los selectores/Locators) | ||
public ProductDetailsPage(WebDriver driver, Locator locator, Action action) { | ||
this.get = locator; | ||
this.Do = action; | ||
this.validate = new Assertion(); | ||
|
||
// * #2 LOCATORS DE PAGE => dentro del Constructor (requiere tipado Suppiler<>) | ||
|
||
// PLP | ||
this.productImages = () -> get.ByClasses(".inventory_item_img"); | ||
this.productTitle = () -> get.ByClasses(".inventory_item_name"); | ||
this.productName = () -> this.get.ByClasses(".inventory_details_name.large_size>div"); | ||
this.productDescription = () -> this.get.ByClasses(".inventory_details_desc"); | ||
this.productImage = () -> this.get.ByClasses(".inventory_details_img"); | ||
this.productPrice = () -> this.get.ByClasses(".inventory_details_price"); | ||
this.addToCartButton = () -> this.get.ByClasses("[data-test=\"add-to-cart-sauce-labs-backpack\"]"); | ||
this.backButton = () -> this.get.ByClass("[data-test=\"back-to-products\"]"); | ||
this.yourCart = () -> this.get.ByClass(".shopping_cart_badge"); | ||
this.removeButton = () -> this.get.ByClass("[data-test=\"remove-sauce-labs-backpack\"]"); | ||
|
||
} | ||
|
||
// * #3 MÉTODOS CON LOS SELECTORES => métodos public | ||
|
||
// * _____ SELECT PRODUCT _____ */ | ||
public void goToProductDetailsImage(Integer ProductIndex) { | ||
WebElement imagen = this.productImages.get().get(1); | ||
imagen.click(); | ||
} | ||
|
||
public void goToProductDetailsTitle(Integer ProductIndex) { | ||
WebElement Title = this.productTitle.get().get(0); | ||
Title.click(); | ||
} | ||
|
||
// * _____ GET_____ */ | ||
public String getProductName(Integer productIndex) { | ||
WebElement Name = this.productName.get().get(0); | ||
String productName = Name.getText(); | ||
return productName; | ||
} | ||
|
||
public String getProductDescription(Integer productIndex) { | ||
WebElement Descripcion = this.productDescription.get().get(0); | ||
String productDescription = Descripcion.getText(); | ||
return productDescription; | ||
} | ||
|
||
public String getProductPrice(Integer productIndex) { | ||
WebElement Price = this.productPrice.get().get(productIndex); | ||
String productPrice = Price.getText(); | ||
return productPrice; | ||
} | ||
|
||
public void getProductImage(Integer productIndex) { | ||
WebElement image = this.productImage.get().get(productIndex); | ||
validate.shouldBeVisible(image); | ||
} | ||
|
||
// * _____ MAIN ACTIONS _____ */ | ||
public void selectAddToCartButton(Integer productIndex) { | ||
this.Do.click(this.addToCartButton.get().get(productIndex)); | ||
} | ||
|
||
public void goBackToProducts() { | ||
this.Do.click(this.backButton.get()); | ||
} | ||
|
||
public void goToYourCart(WebElement givenProduct) { | ||
WebElement button = this.yourCart.get(); | ||
button.click(); | ||
} | ||
|
||
public void selectRemoveButton(Integer productIndex) { | ||
this.Do.click(this.removeButton.get()); | ||
} | ||
} |
Oops, something went wrong.