diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/com/mavlushechka/a1qa/models/Interest.java | 13 | ||||
-rw-r--r-- | src/main/java/com/mavlushechka/a1qa/pages/InterestsForm.java | 45 |
2 files changed, 45 insertions, 13 deletions
diff --git a/src/main/java/com/mavlushechka/a1qa/models/Interest.java b/src/main/java/com/mavlushechka/a1qa/models/Interest.java index 8bb2d9a..c8e7531 100644 --- a/src/main/java/com/mavlushechka/a1qa/models/Interest.java +++ b/src/main/java/com/mavlushechka/a1qa/models/Interest.java @@ -1,18 +1,7 @@ package com.mavlushechka.a1qa.models; -import com.mavlushechka.a1qa.elements.Button; -import com.mavlushechka.a1qa.utils.StringUtils; -import org.openqa.selenium.By; - public enum Interest { - BALLS(), CABLES(), CINNAMON(), CLOSETS(), COTTON(), DOUGH(), DRYWALL(), ENVELOPPES(), FAUCETS(), MULLETS(), POLO(), PONIES(), POSTITS(), PURPLE(), QUESTIONS(), SELECTALL(), SNAILS(), SQUARES(), TIRES(), UNSELECTALL(), WINDOWS(); - - public final Button checkbox; - - - Interest() { - checkbox = new Button(By.xpath("//label[contains(@class, 'checkbox__label') and contains(@for, 'interest_%s')]".formatted(toString().toLowerCase())), StringUtils.capitalizeFirstLetter(toString().toLowerCase()) + " checkbox"); - } + BALLS(), CABLES(), CINNAMON(), CLOSETS(), COTTON(), DOUGH(), DRYWALL(), ENVELOPPES(), FAUCETS(), MULLETS(), POLO(), PONIES(), POSTITS(), PURPLE(), QUESTIONS(), SELECTALL(), SNAILS(), SQUARES(), TIRES(), UNSELECTALL(), WINDOWS() } diff --git a/src/main/java/com/mavlushechka/a1qa/pages/InterestsForm.java b/src/main/java/com/mavlushechka/a1qa/pages/InterestsForm.java index d1ba673..f36f3f3 100644 --- a/src/main/java/com/mavlushechka/a1qa/pages/InterestsForm.java +++ b/src/main/java/com/mavlushechka/a1qa/pages/InterestsForm.java @@ -9,13 +9,56 @@ public class InterestsForm extends BaseForm { private final Button downloadImageButton = new Button(By.xpath("//button[contains(@class, 'avatar-and-interests__avatar-upload-button')]"), "Download image"); + private final Button ballsInterestButton = new Button(By.xpath("//label[contains(@class, 'checkbox__label') and contains(@for, 'interest_balls')]"), "Balls interest checkbox"); + private final Button cablesInterestButton = new Button(By.xpath("//label[contains(@class, 'checkbox__label') and contains(@for, 'interest_cables')]"), "Cables interest checkbox"); + private final Button cinnamonInterestButton = new Button(By.xpath("//label[contains(@class, 'checkbox__label') and contains(@for, 'interest_cinnamon')]"), "Cinnamon interest checkbox"); + private final Button closetsInterestButton = new Button(By.xpath("//label[contains(@class, 'checkbox__label') and contains(@for, 'interest_closets')]"), "Closets interest checkbox"); + private final Button cottonInterestButton = new Button(By.xpath("//label[contains(@class, 'checkbox__label') and contains(@for, 'interest_cotton')]"), "Cotton interest checkbox"); + private final Button doughInterestButton = new Button(By.xpath("//label[contains(@class, 'checkbox__label') and contains(@for, 'interest_dough')]"), "Dough interest checkbox"); + private final Button drywallInterestButton = new Button(By.xpath("//label[contains(@class, 'checkbox__label') and contains(@for, 'interest_drywall')]"), "Drywall interest checkbox"); + private final Button enveloppesInterestButton = new Button(By.xpath("//label[contains(@class, 'checkbox__label') and contains(@for, 'interest_enveloppes')]"), "Enveloppes interest checkbox"); + private final Button faucetsInterestButton = new Button(By.xpath("//label[contains(@class, 'checkbox__label') and contains(@for, 'interest_faucets')]"), "Faucets interest checkbox"); + private final Button mulletsInterestButton = new Button(By.xpath("//label[contains(@class, 'checkbox__label') and contains(@for, 'interest_mullets')]"), "Mullets interest checkbox"); + private final Button poloInterestButton = new Button(By.xpath("//label[contains(@class, 'checkbox__label') and contains(@for, 'interest_polo')]"), "Polo interest checkbox"); + private final Button poniesInterestButton = new Button(By.xpath("//label[contains(@class, 'checkbox__label') and contains(@for, 'interest_ponies')]"), "Ponies interest checkbox"); + private final Button postitsInterestButton = new Button(By.xpath("//label[contains(@class, 'checkbox__label') and contains(@for, 'interest_postits')]"), "Postits interest checkbox"); + private final Button purpleInterestButton = new Button(By.xpath("//label[contains(@class, 'checkbox__label') and contains(@for, 'interest_purple')]"), "Purple interest checkbox"); + private final Button questionsInterestButton = new Button(By.xpath("//label[contains(@class, 'checkbox__label') and contains(@for, 'interest_questions')]"), "Questions interest checkbox"); + private final Button selectAllInterestButton = new Button(By.xpath("//label[contains(@class, 'checkbox__label') and contains(@for, 'interest_selectall')]"), "Select all interest checkbox"); + private final Button snailsAllInterestButton = new Button(By.xpath("//label[contains(@class, 'checkbox__label') and contains(@for, 'interest_snails')]"), "Snails interest checkbox"); + private final Button squaresInterestButton = new Button(By.xpath("//label[contains(@class, 'checkbox__label') and contains(@for, 'interest_squares')]"), "Squares interest checkbox"); + private final Button tiresInterestButton = new Button(By.xpath("//label[contains(@class, 'checkbox__label') and contains(@for, 'interest_tires')]"), "Tires interest checkbox"); + private final Button unselectAllInterestButton = new Button(By.xpath("//label[contains(@class, 'checkbox__label') and contains(@for, 'interest_unselectall')]"), "Unselect all interest checkbox"); + private final Button windowsInterestButton = new Button(By.xpath("//label[contains(@class, 'checkbox__label') and contains(@for, 'interest_windows')]"), "Windows interest checkbox"); public InterestsForm() { super(new Label(By.xpath("//*[contains(@class, 'avatar-and-interests-page')]"), "Interests"), "Interests"); } public void select(Interest interest) { - interest.checkbox.click(); + switch (interest) { + case BALLS -> ballsInterestButton.click(); + case CABLES -> cablesInterestButton.click(); + case CINNAMON -> cinnamonInterestButton.click(); + case CLOSETS -> closetsInterestButton.click(); + case COTTON -> cottonInterestButton.click(); + case DOUGH -> doughInterestButton.click(); + case DRYWALL -> drywallInterestButton.click(); + case ENVELOPPES -> enveloppesInterestButton.click(); + case FAUCETS -> faucetsInterestButton.click(); + case MULLETS -> mulletsInterestButton.click(); + case POLO -> poloInterestButton.click(); + case PONIES -> poniesInterestButton.click(); + case POSTITS -> postitsInterestButton.click(); + case PURPLE -> purpleInterestButton.click(); + case QUESTIONS -> questionsInterestButton.click(); + case SELECTALL -> selectAllInterestButton.click(); + case SNAILS -> snailsAllInterestButton.click(); + case SQUARES -> squaresInterestButton.click(); + case TIRES -> tiresInterestButton.click(); + case UNSELECTALL -> unselectAllInterestButton.click(); + case WINDOWS -> windowsInterestButton.click(); + } } public void clickDownloadImageButton() { |