From 4f4c37bc53b6157ba49c7f829c974650c26c4de3 Mon Sep 17 00:00:00 2001 From: Factor Date: Thu, 20 Mar 2025 12:36:11 +0100 Subject: [PATCH] init --- .gitignore | 38 ++++ .idea/.gitignore | 3 + .idea/encodings.xml | 7 + .idea/inspectionProfiles/Project_Default.xml | 8 + .idea/misc.xml | 14 ++ .idea/uiDesigner.xml | 124 ++++++++++++ .idea/vcs.xml | 6 + pom.xml | 184 ++++++++++++++++++ src/test/java/TestRunner.java | 17 ++ src/test/java/Utils/ColorFormatter.java | 25 +++ .../java/Utils/TempMailRestApiClient.java | 41 ++++ src/test/java/Utils/utils.java | 11 ++ src/test/java/frameworkContext/Context.java | 17 ++ .../java/frameworkContext/ContextFactory.java | 14 ++ .../java/frameworkContext/ContextThread.java | 12 ++ src/test/java/pages/EsetHomePage.java | 19 ++ src/test/java/pages/Pages.java | 5 + src/test/java/pojos/Email.java | 21 ++ src/test/java/pojos/Emails.java | 12 ++ src/test/java/steps/CommonSteps.java | 34 ++++ src/test/java/steps/EsetHomeSteps.java | 104 ++++++++++ src/test/java/steps/Hooks.java | 44 +++++ src/test/java/steps/Steps.java | 4 + src/test/java/steps/TempMailAPISteps.java | 143 ++++++++++++++ src/test/resources/features/eset.feature | 21 ++ src/test/resources/logback-test.xml | 25 +++ 26 files changed, 953 insertions(+) create mode 100644 .gitignore create mode 100644 .idea/.gitignore create mode 100644 .idea/encodings.xml create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/uiDesigner.xml create mode 100644 .idea/vcs.xml create mode 100644 pom.xml create mode 100644 src/test/java/TestRunner.java create mode 100644 src/test/java/Utils/ColorFormatter.java create mode 100644 src/test/java/Utils/TempMailRestApiClient.java create mode 100644 src/test/java/Utils/utils.java create mode 100644 src/test/java/frameworkContext/Context.java create mode 100644 src/test/java/frameworkContext/ContextFactory.java create mode 100644 src/test/java/frameworkContext/ContextThread.java create mode 100644 src/test/java/pages/EsetHomePage.java create mode 100644 src/test/java/pages/Pages.java create mode 100644 src/test/java/pojos/Email.java create mode 100644 src/test/java/pojos/Emails.java create mode 100644 src/test/java/steps/CommonSteps.java create mode 100644 src/test/java/steps/EsetHomeSteps.java create mode 100644 src/test/java/steps/Hooks.java create mode 100644 src/test/java/steps/Steps.java create mode 100644 src/test/java/steps/TempMailAPISteps.java create mode 100644 src/test/resources/features/eset.feature create mode 100644 src/test/resources/logback-test.xml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5ff6309 --- /dev/null +++ b/.gitignore @@ -0,0 +1,38 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..aa00ffa --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..c0ee0d5 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,8 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..82dbec8 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..2b63946 --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..22850f3 --- /dev/null +++ b/pom.xml @@ -0,0 +1,184 @@ + + + 4.0.0 + + pl.factor + EsetSmartSecurityFramework + 1.0-SNAPSHOT + + + 17 + 17 + UTF-8 + + + + + com.codeborne + selenide + 7.7.3 + test + + + + io.cucumber + cucumber-java + 7.20.1 + test + + + + io.cucumber + cucumber-junit + 7.20.1 + test + + + + org.projectlombok + lombok + 1.18.34 + test + + + + net.datafaker + datafaker + 2.4.0 + test + + + + org.passay + passay + 1.6.6 + test + + + + ch.qos.logback + logback-classic + 1.5.17 + test + + + + org.slf4j + slf4j-api + 2.0.9 + test + + + + io.rest-assured + rest-assured + 5.5.1 + test + + + + io.rest-assured + json-path + 5.5.1 + test + + + + com.fasterxml.jackson.core + jackson-databind + 2.17.1 + test + + + + org.awaitility + awaitility + 4.2.2 + test + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.11.0 + + UTF-8 + ${maven.compiler.source} + ${maven.compiler.target} + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.1.2 + + + org.apache.maven.surefire + surefire-junit47 + 3.1.2 + + + + false + + + + + net.masterthought + maven-cucumber-reporting + 5.7.6 + + + execution + verify + + generate + + + EsetSmartSecurityFramework + 1.0.0 + ${project.basedir} + ${project.build.directory} + true + + Windows + Chrome + Desktop + + + **/*.json + + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + 3.6.1 + + + analyze + + analyze-only + + + false + + + + + + + + + \ No newline at end of file diff --git a/src/test/java/TestRunner.java b/src/test/java/TestRunner.java new file mode 100644 index 0000000..392482d --- /dev/null +++ b/src/test/java/TestRunner.java @@ -0,0 +1,17 @@ +import io.cucumber.junit.Cucumber; +import io.cucumber.junit.CucumberOptions; +import org.junit.runner.RunWith; + +@RunWith(Cucumber.class) +@CucumberOptions( + features = {"src/test/resources/features"}, + glue = {"steps"}, + plugin = {"json:target/cucumber-report/cucumber.json"}, + monochrome = false, + stepNotifications = true, + //ToDo change this! + tags = "@ESET", + snippets = CucumberOptions.SnippetType.CAMELCASE +) +public class TestRunner { +} diff --git a/src/test/java/Utils/ColorFormatter.java b/src/test/java/Utils/ColorFormatter.java new file mode 100644 index 0000000..1e67bb6 --- /dev/null +++ b/src/test/java/Utils/ColorFormatter.java @@ -0,0 +1,25 @@ +package Utils; + +public enum ColorFormatter { + BLACK(30), + RED(31), + GREEN(32), + YELLOW(33), + BLUE(34), + PURPLE(35), + CYAN(36), + WHITE(37); + + private static final String RESET = "\u001B[0m"; + private static final String PREFIX = "\u001B["; + private static final String SUFFIX = "m"; + private final String colorCode; + + ColorFormatter(int code) { + this.colorCode = PREFIX + code + SUFFIX; + } + + public String toConsole(String text) { + return colorCode + text + RESET; + } +} diff --git a/src/test/java/Utils/TempMailRestApiClient.java b/src/test/java/Utils/TempMailRestApiClient.java new file mode 100644 index 0000000..6262a1c --- /dev/null +++ b/src/test/java/Utils/TempMailRestApiClient.java @@ -0,0 +1,41 @@ +package Utils; + +import io.restassured.RestAssured; +import io.restassured.response.Response; + +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.Matchers.hasItem; + +public class TempMailRestApiClient { + private static final String TEMPMAIL_BASE_URL = "https://api.tempmail.lol/v2"; + + private static final String POST_CREATE_URI = "/inbox/create"; + private static final String GET_INBOX_URI = "/inbox"; + + public Response createInbox() { + return RestAssured.given() + .baseUri(TEMPMAIL_BASE_URL) + .when() + .post(POST_CREATE_URI) + .then() + .assertThat() + .statusCode(201) + .extract() + .response(); + } + + public Response getInbox(String token, String emailSubject) { + return RestAssured.given() + .baseUri(TEMPMAIL_BASE_URL) + .queryParam("token", token) + .when() + .get(GET_INBOX_URI) + .then() + .assertThat() + .statusCode(200) + .body("emails.size()", greaterThan(0)) + .body("emails.subject", hasItem(emailSubject)) + .extract() + .response(); + } +} diff --git a/src/test/java/Utils/utils.java b/src/test/java/Utils/utils.java new file mode 100644 index 0000000..1f654dd --- /dev/null +++ b/src/test/java/Utils/utils.java @@ -0,0 +1,11 @@ +package Utils; + + +import net.datafaker.Faker; + +public class utils { + + public static int getRandomValue(int min, int max) { + return new Faker().number().numberBetween(min, max); + } +} diff --git a/src/test/java/frameworkContext/Context.java b/src/test/java/frameworkContext/Context.java new file mode 100644 index 0000000..7f63316 --- /dev/null +++ b/src/test/java/frameworkContext/Context.java @@ -0,0 +1,17 @@ +package frameworkContext; + +import io.cucumber.java.Scenario; +import lombok.Data; +import lombok.NoArgsConstructor; + +@NoArgsConstructor +@Data +public class Context { + + // Scenario + private String tempEmail; + private String tempEmailToken; + + // Framework + private Scenario scenario; +} diff --git a/src/test/java/frameworkContext/ContextFactory.java b/src/test/java/frameworkContext/ContextFactory.java new file mode 100644 index 0000000..eb549f6 --- /dev/null +++ b/src/test/java/frameworkContext/ContextFactory.java @@ -0,0 +1,14 @@ +package frameworkContext; + +public class ContextFactory { + private static ThreadLocal contextThread; + + // @Before(order = 1) + public static void instantiateContextObject() { + contextThread = ThreadLocal.withInitial(ContextThread::new); + } + + public static Context getContext() { + return contextThread.get().getContext(); + } +} diff --git a/src/test/java/frameworkContext/ContextThread.java b/src/test/java/frameworkContext/ContextThread.java new file mode 100644 index 0000000..1e733b2 --- /dev/null +++ b/src/test/java/frameworkContext/ContextThread.java @@ -0,0 +1,12 @@ +package frameworkContext; + +public class ContextThread { + private Context Context; + + public Context getContext() { + if (Context == null) { + Context = new Context(); + } + return Context; + } +} diff --git a/src/test/java/pages/EsetHomePage.java b/src/test/java/pages/EsetHomePage.java new file mode 100644 index 0000000..97bd63a --- /dev/null +++ b/src/test/java/pages/EsetHomePage.java @@ -0,0 +1,19 @@ +package pages; + +import com.codeborne.selenide.SelenideElement; +import org.openqa.selenium.support.FindBy; + +public class EsetHomePage extends Pages { + + // FIELDS + @FindBy(id = "email") + public SelenideElement accountEmailField; + + @FindBy(id = "password") + public SelenideElement accountPasswordField; + + // BUTTONS + @FindBy(id = "cc-accept") + public SelenideElement cookiesConsentAcceptButton; + +} diff --git a/src/test/java/pages/Pages.java b/src/test/java/pages/Pages.java new file mode 100644 index 0000000..2b98a01 --- /dev/null +++ b/src/test/java/pages/Pages.java @@ -0,0 +1,5 @@ +package pages; + +public class Pages { + +} diff --git a/src/test/java/pojos/Email.java b/src/test/java/pojos/Email.java new file mode 100644 index 0000000..1592359 --- /dev/null +++ b/src/test/java/pojos/Email.java @@ -0,0 +1,21 @@ +package pojos; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; + +@Data +@JsonIgnoreProperties(ignoreUnknown = true) +public class Email { + + private String to; + private String from; + private String subject; + private String body; + private long date; + private String ip; + private String html; + + @JsonProperty("_id") + private String id; +} diff --git a/src/test/java/pojos/Emails.java b/src/test/java/pojos/Emails.java new file mode 100644 index 0000000..587a78e --- /dev/null +++ b/src/test/java/pojos/Emails.java @@ -0,0 +1,12 @@ +package pojos; + +import lombok.Data; + +import java.util.List; + +@Data +public class Emails { + + private List emails; + private boolean expired; +} diff --git a/src/test/java/steps/CommonSteps.java b/src/test/java/steps/CommonSteps.java new file mode 100644 index 0000000..9a8ad08 --- /dev/null +++ b/src/test/java/steps/CommonSteps.java @@ -0,0 +1,34 @@ +package steps; + +import com.codeborne.selenide.Selenide; +import io.cucumber.java.en.And; +import org.openqa.selenium.WindowType; + +import java.time.Duration; + +import static com.codeborne.selenide.Selenide.*; + +public class CommonSteps { + + + @And("Navigate to {string}") + public void navigateTo(String url) { + open(url); + } + + @And("CommonSteps: Open new tab in browser with url {string}") + public void commonstepsOpenNewTabWithUrl(String url) { + switchTo().newWindow(WindowType.TAB); + Selenide.open(url); + } + + @And("CommonSteps: Got to tab number {int}") + public void commonstepsGoToTabNumber(int tabNumber) { + switchTo().window(tabNumber - 1); + } + + @And("CommonSteps: Wait {int} seconds") + public void commonstepsWaitSeconds(int time) { + sleep(Duration.ofSeconds(time).toMillis()); + } +} diff --git a/src/test/java/steps/EsetHomeSteps.java b/src/test/java/steps/EsetHomeSteps.java new file mode 100644 index 0000000..221e858 --- /dev/null +++ b/src/test/java/steps/EsetHomeSteps.java @@ -0,0 +1,104 @@ +package steps; + +import Utils.ColorFormatter; +import com.codeborne.selenide.Condition; +import com.codeborne.selenide.ex.ElementNotFound; +import io.cucumber.java.en.And; +import lombok.extern.slf4j.Slf4j; +import org.openqa.selenium.By; +import org.passay.CharacterData; +import org.passay.CharacterRule; +import org.passay.EnglishCharacterData; +import org.passay.PasswordGenerator; +import pages.EsetHomePage; + +import java.time.Duration; +import java.util.Arrays; +import java.util.List; + +import static com.codeborne.selenide.Selenide.$; +import static com.codeborne.selenide.Selenide.page; +import static frameworkContext.ContextFactory.getContext; + +@Slf4j +public class EsetHomeSteps extends Steps { + + EsetHomePage webPage = page(EsetHomePage.class); + + @And("EsetHomePage: Click button {string}") + public void esethomepageClickButton(String buttonName) { + $(By.xpath("//*[text()='%s' and not(self::b)]" + .formatted(buttonName))) + .scrollIntoCenter() + .click(); + } + + @And("EsetHomePage: Accept cookies") + public void esethomepageAcceptCookies() { + try { + webPage.cookiesConsentAcceptButton + .shouldBe(Condition.visible, Duration.ofSeconds(5)) + .scrollIntoCenter() + .click(); + } catch (ElementNotFound e) { + // do nothing + } + } + + @And("EsetHomePage: Enter saved temporary email address") + public void esethomepageFillSavedEmail() { + webPage.accountEmailField.scrollIntoCenter().setValue(getContext().getTempEmail()); + } + + @And("EsetHomePage: Enter generated password") + public void esethomepageFillGeneratedPassword() { + String password = generatePassword(12); + + webPage.accountPasswordField.scrollIntoCenter().setValue(password); + + log.info("Password entered: {}", ColorFormatter.RED.toConsole(password)); + } + + @And("EsetHomePage: Choose system {string}") + public void esethomepageChooseSystem(String systemName) { + $(By.xpath("//button[@data-label='device-protect-os-card-%s-button']" + .formatted(systemName))) + .scrollIntoCenter() + .click(); + } + + @And("EsetHomePage: Read ESET Smart Security activation code") + public void esethomepageReadESETSmartSecurityActivationCode() { + String key = $(By.xpath("//p[text()='Klucz aktywacji']/..//following-sibling::*[1]/p")).getText(); + + log.info(""" + + ESET Smart Security activation key found: + + =---------------------------= + {} + =---------------------------= + + """, ColorFormatter.GREEN.toConsole(key)); + } + + public static String generatePassword(int length) { + PasswordGenerator generator = new PasswordGenerator(); + List rules = Arrays.asList( + new CharacterRule(EnglishCharacterData.LowerCase, 1), + new CharacterRule(EnglishCharacterData.UpperCase, 1), + new CharacterRule(EnglishCharacterData.Digit, 1), + new CharacterRule(new CharacterData() { + public String getErrorCode() { + return "ERROR"; + } + + public String getCharacters() { + return "!@#$%^&*"; + } + }, 1) + ); + + return generator.generatePassword(length, rules); + } +} diff --git a/src/test/java/steps/Hooks.java b/src/test/java/steps/Hooks.java new file mode 100644 index 0000000..ba2fbd4 --- /dev/null +++ b/src/test/java/steps/Hooks.java @@ -0,0 +1,44 @@ +package steps; + +import com.codeborne.selenide.Configuration; +import io.cucumber.java.After; +import io.cucumber.java.Before; +import io.cucumber.java.Scenario; +import lombok.extern.slf4j.Slf4j; +import org.openqa.selenium.chrome.ChromeOptions; + +import static frameworkContext.ContextFactory.instantiateContextObject; + +@Slf4j +public class Hooks { + + @Before + public void setup(Scenario scenario) { + instantiateContextObject(); + + ChromeOptions options = new ChromeOptions(); + options.addArguments("--incognito"); + Configuration.browserCapabilities = options; + + Configuration.browser = "chrome"; + Configuration.timeout = 30000; + Configuration.pollingInterval = 500; + Configuration.browserSize = "1920x1080"; + Configuration.headless = true; + + log.info("Start scenario: {}", scenario.getName()); + } + + @After + public void exit(Scenario scenario) { + genericAfter(scenario); + } + + private void genericAfter(Scenario scenario) { + if (scenario.isFailed()) { + log.error("Scenario error"); + } + + log.info("Finished scenario: {}", scenario.getName()); + } +} \ No newline at end of file diff --git a/src/test/java/steps/Steps.java b/src/test/java/steps/Steps.java new file mode 100644 index 0000000..02d3436 --- /dev/null +++ b/src/test/java/steps/Steps.java @@ -0,0 +1,4 @@ +package steps; + +public class Steps { +} diff --git a/src/test/java/steps/TempMailAPISteps.java b/src/test/java/steps/TempMailAPISteps.java new file mode 100644 index 0000000..46c2ebe --- /dev/null +++ b/src/test/java/steps/TempMailAPISteps.java @@ -0,0 +1,143 @@ +package steps; + +import Utils.ColorFormatter; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.cucumber.java.en.And; +import io.restassured.RestAssured; +import io.restassured.response.Response; +import lombok.extern.slf4j.Slf4j; +import pojos.Email; +import pojos.Emails; + +import java.util.concurrent.TimeUnit; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import static com.codeborne.selenide.Selenide.open; +import static frameworkContext.ContextFactory.getContext; +import static org.awaitility.Awaitility.await; +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.Matchers.hasItem; + +@Slf4j +public class TempMailAPISteps extends Steps { + + private static final String BASE_URL = "https://api.tempmail.lol/v2"; + private static final String ESET_URL_LINK = "https://login\\.eset\\.com/link/confirmregistration\\?token=[a-zA-Z0-9-]+"; + private static final String ESET_KEY_PATTERN = "\\b[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}\\b"; + + private final ObjectMapper objectMapper = new ObjectMapper(); + private Response response; + + + @And("TempMailAPI: Save to context generated email and token") + public void tempmailapiSaveToContextGeneratedEmailAndToken() { + + response = RestAssured.given() + .baseUri(BASE_URL) + .when() + .post("/inbox/create") + .then() + .assertThat() + .statusCode(201) + .extract() + .response(); + + String address = response.jsonPath().getString("address"); + String token = response.jsonPath().getString("token"); + + getContext().setTempEmail(address); + getContext().setTempEmailToken(token); + + log.info("Temporary email address has been successfully retrieved: {}, with token: {}", + ColorFormatter.GREEN.toConsole(address), + ColorFormatter.GREEN.toConsole(token)); + } + + @And("TempMailAPI: Confirm Home Eset registration") + public void tempmailapiAgreeRegistrationInHomeEset() { + + String emailSubject = "Potwierdzenie utworzenia konta"; + + getEmailsUntilFindEmailWithSubject(emailSubject); + String responeJsonString = response.getBody().asString(); + + try { + Emails emails = objectMapper.readValue(responeJsonString, Emails.class); + + for (Email email : emails.getEmails()) { + if (email.getSubject().equals(emailSubject)) { + Pattern pattern = Pattern.compile(ESET_URL_LINK); + Matcher matcher = pattern.matcher(email.getHtml()); + + if (matcher.find()) { + String href = matcher.group(); + log.info("Activation link found: {}", href); + open(href); + } else { + throw new RuntimeException("Activation link not found"); + } + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + @And("TempMailAPI: Download ESET Smart Security activation code") + public void tempmailapiGetActivationKeyForEset() { + + final String emailSubject = "Thank you for your interest in ESET HOME Security Premium"; + + getEmailsUntilFindEmailWithSubject(emailSubject); + String responeJsonString = response.getBody().asString(); + + try { + Emails emails = objectMapper.readValue(responeJsonString, Emails.class); + + for (Email email : emails.getEmails()) { + if (email.getSubject().equals(emailSubject)) { + Pattern pattern = Pattern.compile(ESET_KEY_PATTERN); + Matcher matcher = pattern.matcher(email.getHtml()); + + if (matcher.find()) { + log.info(""" + ESET Smart Security activation key found: + !!!!!!!!!!!!!!!!!!!!!!!!!!! + {} + !!!!!!!!!!!!!!!!!!!!!!!!!!! + """, matcher.group()); + } else { + throw new RuntimeException("Activation key not found"); + } + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + private void getEmailsUntilFindEmailWithSubject(String emailSubject) { + + final String token = getContext().getTempEmailToken(); + + await().atMost(60, TimeUnit.SECONDS) + .pollInterval(1, TimeUnit.SECONDS) + .ignoreExceptions() + .untilAsserted(() -> + + response = RestAssured.given() + .baseUri(BASE_URL) + .queryParam("token", token) + .when() + .get("/inbox") + .then() + .assertThat() + .statusCode(200) + .body("emails.size()", greaterThan(0)) + .body("emails.subject", hasItem(emailSubject)) + .extract() + .response() + ); + } +} diff --git a/src/test/resources/features/eset.feature b/src/test/resources/features/eset.feature new file mode 100644 index 0000000..bbd2436 --- /dev/null +++ b/src/test/resources/features/eset.feature @@ -0,0 +1,21 @@ +@ESET +Feature: Download ESET Smart Security license key + + Scenario: Download ESET Smart Security license key + Given Navigate to "https://home.eset.com" + And TempMailAPI: Save to context generated email and token + And EsetHomePage: Accept cookies + And EsetHomePage: Click button "Utwórz konto" + And EsetHomePage: Enter saved temporary email address + And EsetHomePage: Click button "Kontynuuj za pomocą e-maila" + And EsetHomePage: Enter generated password + And EsetHomePage: Click button "Utwórz konto lub zaloguj się" + And TempMailAPI: Confirm Home Eset registration + And EsetHomePage: Click button "Pierwsze kroki" + And EsetHomePage: Click button "Wypróbuj ESET za darmo" + And EsetHomePage: Click button "Kontynuuj" + And EsetHomePage: Click button "Chroń swój dom" + And EsetHomePage: Click button "Kontynuuj" + And EsetHomePage: Click button "Wyświetl szczegóły dotyczące wersji próbnej" + And EsetHomePage: Click button "Kontynuuj" + And EsetHomePage: Read ESET Smart Security activation code diff --git a/src/test/resources/logback-test.xml b/src/test/resources/logback-test.xml new file mode 100644 index 0000000..376647a --- /dev/null +++ b/src/test/resources/logback-test.xml @@ -0,0 +1,25 @@ + + + + + + + INFO + + + %d{HH:mm:ss.SSS} %highlight(%-5level) %cyan(%logger{36}) - %msg%n + + + + + ${user.dir}\target\logs\logfile.log + + %d{HH:mm:ss.SSS} %-5level %logger{36} - %msg%n + + + + + + + +