From c40f0dee2ca3cd3394c0f66c678a251704dbb684 Mon Sep 17 00:00:00 2001 From: cedaniel200 Date: Thu, 4 Jun 2020 17:45:49 -0500 Subject: [PATCH] Se modifica los selectores y se ajusta con respecto a eso la interaction SelectDropDownButton --- .../interactions/SelectDropDownButton.java | 2 +- .../nameproject/tasks/CreateRepository.java | 8 +++---- .../CreateNewRepositoryPage.java | 22 +++++++++---------- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/src/main/java/co/com/yourcompany/certification/nameproject/interactions/SelectDropDownButton.java b/src/main/java/co/com/yourcompany/certification/nameproject/interactions/SelectDropDownButton.java index b64d86c..b433c8e 100644 --- a/src/main/java/co/com/yourcompany/certification/nameproject/interactions/SelectDropDownButton.java +++ b/src/main/java/co/com/yourcompany/certification/nameproject/interactions/SelectDropDownButton.java @@ -38,7 +38,7 @@ public static SelectDropDownButton addGitIgnoreFilteringBy(GitIgnore valueFilter public static SelectDropDownButton addLicenseFilteringBy(License valueFilter) { return instrumented(SelectDropDownButton.class, ADD_LICENSE, FILTER_LICENSE, valueFilter.toString(), - SELECTOR_FORMAT_LICENSE); + String.format(SELECTOR_FORMAT_LICENSE, valueFilter)); } @Override diff --git a/src/main/java/co/com/yourcompany/certification/nameproject/tasks/CreateRepository.java b/src/main/java/co/com/yourcompany/certification/nameproject/tasks/CreateRepository.java index b4a1175..7c27a6e 100644 --- a/src/main/java/co/com/yourcompany/certification/nameproject/tasks/CreateRepository.java +++ b/src/main/java/co/com/yourcompany/certification/nameproject/tasks/CreateRepository.java @@ -1,6 +1,6 @@ package co.com.yourcompany.certification.nameproject.tasks; -import co.com.yourcompany.certification.nameproject.exceptions.RepositoryAlreadyExistsException; +import co.com.yourcompany.certification.nameproject.exceptions.RepositoryAlreadyExistsError; import co.com.yourcompany.certification.nameproject.exceptions.RepositoryModelCreationException; import co.com.yourcompany.certification.nameproject.interactions.SelectDropDownButton; import co.com.yourcompany.certification.nameproject.model.Repository; @@ -13,10 +13,10 @@ import net.serenitybdd.screenplay.actions.Scroll; import net.serenitybdd.screenplay.conditions.Check; -import static co.com.yourcompany.certification.nameproject.exceptions.RepositoryAlreadyExistsException.withMessageBy; +import static co.com.yourcompany.certification.nameproject.exceptions.RepositoryAlreadyExistsError.withMessageBy; import static co.com.yourcompany.certification.nameproject.model.enumerables.GitIgnore.NONE; import static co.com.yourcompany.certification.nameproject.userinterface.CreateNewRepositoryPage.*; -import static co.com.yourcompany.certification.nameproject.userinterface.GitHubHomePage.NEW_REPOSITORY; +import static co.com.yourcompany.certification.nameproject.userinterface.UserGitHubHomePage.NEW_REPOSITORY; import static co.com.yourcompany.certification.nameproject.util.validations.Validations.isNotEmptyOrNull; import static net.serenitybdd.screenplay.GivenWhenThen.seeThat; import static net.serenitybdd.screenplay.Tasks.instrumented; @@ -39,7 +39,7 @@ public void performAs(T actor) { ); actor.should(seeThat(the(MESSAGE_REPOSITORY_ALREADY_EXISTS), isNotVisible()) - .orComplainWith(RepositoryAlreadyExistsException.class, + .orComplainWith(RepositoryAlreadyExistsError.class, withMessageBy(repository.name()))); actor.attemptsTo( diff --git a/src/main/java/co/com/yourcompany/certification/nameproject/userinterface/CreateNewRepositoryPage.java b/src/main/java/co/com/yourcompany/certification/nameproject/userinterface/CreateNewRepositoryPage.java index a7c3043..c54683c 100644 --- a/src/main/java/co/com/yourcompany/certification/nameproject/userinterface/CreateNewRepositoryPage.java +++ b/src/main/java/co/com/yourcompany/certification/nameproject/userinterface/CreateNewRepositoryPage.java @@ -17,24 +17,22 @@ public class CreateNewRepositoryPage { public static final Target ADD_GITIGNORE = Target .the("Add .gitignore") - .locatedBy("//*[@id=\"new_repository\"]/div[3]/div[4]/ul/li[1]/details/summary"); + .locatedBy(".my-3 > .select-menu > .btn"); + + public static final Target FILTER_GITIGNORE = Target + .the("filter of the gitignore").located(By.id("context-ignore-filter-field")); + + public static final String SELECTOR_FORMAT_GITIGNORE = ".filterable-active"; public static final Target ADD_LICENSE = Target .the("Add a license") - .locatedBy("//*[@id=\"new_repository\"]/div[3]/div[4]/ul/li[2]/details/summary"); - - public static final Target FILTER_GITIGNORE = Target - .the("filter of the gitignore") - .located(By.id("context-ignore-filter-field")); + .locatedBy(".btn > .text-normal"); public static final Target FILTER_LICENSE = Target .the("filter of the license") - .locatedBy("//*[@id=\"repo-new-license-details\"]/div/div/filter-input/input"); - - public static final String SELECTOR_FORMAT_GITIGNORE = "#new_repository > div.js-with-permission-fields > div.js-repository-auto-init-options > ul > li:nth-child(1) > " + - "details > details-menu > div.select-menu-list > div.filterable-active"; + .locatedBy(".SelectMenu-filter > .width-full"); - public static final String SELECTOR_FORMAT_LICENSE = "//label[@aria-selected='true']"; + public static final String SELECTOR_FORMAT_LICENSE = "//div[@class=\"SelectMenu-list\"]//span[contains(text(), '%s')]//ancestor::label"; public static final Target CREATE_REPOSITORY = Target .the("Create repository") @@ -42,5 +40,5 @@ public class CreateNewRepositoryPage { public static final Target MESSAGE_REPOSITORY_ALREADY_EXISTS = Target .the("Error message") - .locatedBy("//*[@id=\"new_repository\"]/div[2]/auto-check/dl/dd[2]"); + .locatedBy(".error > strong"); } \ No newline at end of file