init
This commit is contained in:
commit
4f4c37bc53
26 files changed
+953
No files matched your search
+38
@@ -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
|
||||
Generated
+3
@@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
Generated
+7
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="ThrowablePrintStackTrace" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<scope name="Tests" level="WARNING" enabled="false" />
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
||||
Generated
+14
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
Generated
+124
@@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
||||
Generated
+6
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -0,0 +1,184 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>pl.factor</groupId>
|
||||
<artifactId>EsetSmartSecurityFramework</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.codeborne</groupId>
|
||||
<artifactId>selenide</artifactId>
|
||||
<version>7.7.3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.cucumber</groupId>
|
||||
<artifactId>cucumber-java</artifactId>
|
||||
<version>7.20.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.cucumber</groupId>
|
||||
<artifactId>cucumber-junit</artifactId>
|
||||
<version>7.20.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.34</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.datafaker</groupId>
|
||||
<artifactId>datafaker</artifactId>
|
||||
<version>2.4.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.passay</groupId>
|
||||
<artifactId>passay</artifactId>
|
||||
<version>1.6.6</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<version>1.5.17</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>2.0.9</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.rest-assured</groupId>
|
||||
<artifactId>rest-assured</artifactId>
|
||||
<version>5.5.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.rest-assured</groupId>
|
||||
<artifactId>json-path</artifactId>
|
||||
<version>5.5.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.17.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.awaitility</groupId>
|
||||
<artifactId>awaitility</artifactId>
|
||||
<version>4.2.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.11.0</version>
|
||||
<configuration>
|
||||
<encoding>UTF-8</encoding>
|
||||
<source>${maven.compiler.source}</source>
|
||||
<target>${maven.compiler.target}</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>3.1.2</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.surefire</groupId>
|
||||
<artifactId>surefire-junit47</artifactId>
|
||||
<version>3.1.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<configuration>
|
||||
<testFailureIgnore>false</testFailureIgnore>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>net.masterthought</groupId>
|
||||
<artifactId>maven-cucumber-reporting</artifactId>
|
||||
<version>5.7.6</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>execution</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>generate</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<projectName>EsetSmartSecurityFramework</projectName>
|
||||
<buildNumber>1.0.0</buildNumber>
|
||||
<inputDirectory>${project.basedir}</inputDirectory>
|
||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||
<skipEmptyJSONFiles>true</skipEmptyJSONFiles>
|
||||
<classifications>
|
||||
<platform>Windows</platform>
|
||||
<browser>Chrome</browser>
|
||||
<device>Desktop</device>
|
||||
</classifications>
|
||||
<jsonFiles>
|
||||
<param>**/*.json</param>
|
||||
</jsonFiles>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- Weryfikacja zależności -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>3.6.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>analyze</id>
|
||||
<goals>
|
||||
<goal>analyze-only</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<failOnWarning>false</failOnWarning>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -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 {
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package frameworkContext;
|
||||
|
||||
public class ContextFactory {
|
||||
private static ThreadLocal<ContextThread> contextThread;
|
||||
|
||||
// @Before(order = 1)
|
||||
public static void instantiateContextObject() {
|
||||
contextThread = ThreadLocal.withInitial(ContextThread::new);
|
||||
}
|
||||
|
||||
public static Context getContext() {
|
||||
return contextThread.get().getContext();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package frameworkContext;
|
||||
|
||||
public class ContextThread {
|
||||
private Context Context;
|
||||
|
||||
public Context getContext() {
|
||||
if (Context == null) {
|
||||
Context = new Context();
|
||||
}
|
||||
return Context;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package pages;
|
||||
|
||||
public class Pages {
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package pojos;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class Emails {
|
||||
|
||||
private List<Email> emails;
|
||||
private boolean expired;
|
||||
}
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
@@ -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<CharacterRule> 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);
|
||||
}
|
||||
}
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package steps;
|
||||
|
||||
public class Steps {
|
||||
}
|
||||
@@ -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()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<configuration scan="false" scanPeriod="120 seconds">
|
||||
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>INFO</level>
|
||||
</filter>
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} %highlight(%-5level) %cyan(%logger{36}) - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
|
||||
<file>${user.dir}\target\logs\logfile.log</file>
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} %-5level %logger{36} - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<root level="DEBUG">
|
||||
<appender-ref ref="STDOUT"/>
|
||||
<appender-ref ref="FILE"/>
|
||||
</root>
|
||||
</configuration>
|
||||
Reference in new issue
Block a user