-
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 #3 from donatas-b/manager-feature
Manager feature implementation
- Loading branch information
Showing
16 changed files
with
428 additions
and
49 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 |
---|---|---|
|
@@ -25,4 +25,5 @@ replay_pid* | |
|
||
.idea | ||
target | ||
allure-results | ||
allure-results | ||
build |
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,27 @@ | ||
package xyz.selenide.model; | ||
|
||
import lombok.Getter; | ||
|
||
public enum Currency { | ||
DOLLAR("Dollar"), | ||
PUND("Pound"), | ||
RUPEE("Rupee"); | ||
|
||
@Getter | ||
private final String currency; | ||
|
||
Currency(String currency) { | ||
this.currency = currency; | ||
} | ||
|
||
public static Currency byValue(String currencyValue) { | ||
for (Currency currency : Currency.values()) { | ||
if (currency.currency.equals(currencyValue)) { | ||
return currency; | ||
} | ||
} | ||
throw new IllegalArgumentException( | ||
String.format("Currency enum does not contains value '%s'", currencyValue)); | ||
} | ||
|
||
} |
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
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,24 @@ | ||
package xyz.selenide.model; | ||
|
||
public enum CustomerSortColumn { | ||
FIRST_NAME("First Name"), | ||
LAST_NAME("Last Name"), | ||
POST_CODE("Post Code"); | ||
|
||
private final String column; | ||
|
||
CustomerSortColumn(String columnName) { | ||
this.column = columnName; | ||
} | ||
|
||
public static CustomerSortColumn byValue(String columnName) { | ||
for (CustomerSortColumn column : CustomerSortColumn.values()) { | ||
if (column.column.equals(columnName)) { | ||
return column; | ||
} | ||
} | ||
throw new IllegalArgumentException( | ||
String.format("CustomerSortColumn enum does not contains value '%s'", columnName)); | ||
} | ||
|
||
} |
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,32 @@ | ||
package xyz.selenide.model; | ||
|
||
import com.codeborne.selenide.ElementsCollection; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Comparator; | ||
|
||
public class Customers extends ArrayList<CustomerInformation> { | ||
|
||
public Customers(ElementsCollection rows) { | ||
rows.texts().subList(1, rows.size()).forEach(row -> this.add(new CustomerInformation(row))); | ||
} | ||
|
||
public void sort(CustomerSortColumn column, SortOrder sortOrder) { | ||
switch (sortOrder) { | ||
case ASC -> { | ||
switch (column) { | ||
case FIRST_NAME -> this.sort(Comparator.comparing(CustomerInformation::getFirstName)); | ||
case LAST_NAME -> this.sort(Comparator.comparing(CustomerInformation::getLastName)); | ||
case POST_CODE -> this.sort(Comparator.comparing(CustomerInformation::getPostCode)); | ||
} | ||
} | ||
case DESC -> { | ||
switch (column) { | ||
case FIRST_NAME -> this.sort(Comparator.comparing(CustomerInformation::getFirstName).reversed()); | ||
case LAST_NAME -> this.sort(Comparator.comparing(CustomerInformation::getLastName).reversed()); | ||
case POST_CODE -> this.sort(Comparator.comparing(CustomerInformation::getPostCode).reversed()); | ||
} | ||
} | ||
} | ||
} | ||
} |
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,23 @@ | ||
package xyz.selenide.model; | ||
|
||
public enum SortOrder { | ||
ASC("Ascending"), | ||
DESC("Descending"); | ||
|
||
private final String order; | ||
|
||
SortOrder(String order) { | ||
this.order = order; | ||
} | ||
|
||
public static SortOrder byValue(String orderValue) { | ||
for (SortOrder order : SortOrder.values()) { | ||
if (order.order.equals(orderValue)) { | ||
return order; | ||
} | ||
} | ||
throw new IllegalArgumentException( | ||
String.format("SortOrder enum does not contains value '%s'", orderValue)); | ||
} | ||
|
||
} |
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
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
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
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
38 changes: 38 additions & 0 deletions
38
src/main/java/xyz/selenide/userInterface/CustomersPage.java
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,38 @@ | ||
package xyz.selenide.userInterface; | ||
|
||
import com.codeborne.selenide.Condition; | ||
import com.codeborne.selenide.ElementsCollection; | ||
import com.codeborne.selenide.SelenideElement; | ||
import lombok.Getter; | ||
import xyz.selenide.model.CustomerInformation; | ||
|
||
import static com.codeborne.selenide.Selectors.byTagName; | ||
import static com.codeborne.selenide.Selectors.byText; | ||
import static com.codeborne.selenide.Selenide.$; | ||
import static com.codeborne.selenide.Selenide.$$; | ||
|
||
@Getter | ||
public class CustomersPage { | ||
private final SelenideElement inputSearchCustomers; | ||
private final SelenideElement tableCustomers; | ||
private final ElementsCollection tableCustomersRows; | ||
private final SelenideElement buttonDelete; | ||
private final SelenideElement linkFirstName; | ||
private final SelenideElement linkLastName; | ||
private final SelenideElement linkPostCode; | ||
|
||
public CustomersPage() { | ||
this.inputSearchCustomers = $(byTagName("input")); | ||
this.tableCustomers = $(byTagName("table")); | ||
this.tableCustomersRows = $$(byTagName("tr")); | ||
this.buttonDelete = $(byText("Delete")); | ||
this.linkFirstName = $(byText("First Name")); | ||
this.linkLastName = $(byText("Last Name")); | ||
this.linkPostCode = $(byText("Post Code")); | ||
} | ||
|
||
public boolean isCustomerNotInTheList(CustomerInformation customerInformation) { | ||
SelenideElement notIn = $(byText(customerInformation.getFirstName())).shouldNot(Condition.exist); | ||
return notIn.exists(); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/xyz/selenide/userInterface/OpenAccountPage.java
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,22 @@ | ||
package xyz.selenide.userInterface; | ||
|
||
import com.codeborne.selenide.SelenideElement; | ||
import lombok.Getter; | ||
|
||
import static com.codeborne.selenide.Selectors.byText; | ||
import static com.codeborne.selenide.Selectors.byXpath; | ||
import static com.codeborne.selenide.Selenide.$; | ||
|
||
@Getter | ||
public class OpenAccountPage { | ||
private final SelenideElement drpCustomer; | ||
private final SelenideElement drpCurrency; | ||
private final SelenideElement buttonProcess; | ||
|
||
public OpenAccountPage() { | ||
this.drpCustomer = $(byXpath("//select[@id='userSelect']")); | ||
this.drpCurrency = $(byXpath("//select[@id='currency']")); | ||
this.buttonProcess = $(byText("Process")); | ||
} | ||
|
||
} |
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,13 @@ | ||
package xyz.selenide.stepDefinitions; | ||
|
||
import com.codeborne.selenide.WebDriverRunner; | ||
import io.cucumber.java.After; | ||
|
||
public class Hooks { | ||
|
||
@After | ||
public void After() { | ||
WebDriverRunner.closeWebDriver(); | ||
} | ||
|
||
} |
Oops, something went wrong.