@@ -74,14 +74,14 @@ https://github.com/giulong/spectrum/assets/27963644/fecee8f5-f6dc-4b47-81a3-514e
> `-Dspectrum.driver=firefox`, `-Dspectrum.driver=edge` or `-Dspectrum.driver=safari`
Here's an overview of the project created by the archetype, along with the generated report and video:
-
-
+
+
https://github.com/giulong/spectrum/assets/27963644/df6b801e-91ca-415b-b510-a45b7392de20
You can also configure Spectrum to produce additional reports, such as summary and coverage:
-
-
+
+
If you like Spectrum, please consider giving it a GitHub Star ⭐
diff --git a/cleanup/pom.xml b/cleanup/pom.xml
index 57b2abe56..f6a64cad8 100644
--- a/cleanup/pom.xml
+++ b/cleanup/pom.xml
@@ -18,14 +18,6 @@
-
- org.apache.maven.plugins
- maven-checkstyle-plugin
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- org.apache.maven.pluginsmaven-resources-plugin
@@ -138,6 +130,42 @@
+
+ Copy LauncherSessionListener to "it-windows" module's classes
+ clean
+
+ copy-resources
+
+
+ ../it-windows/target/classes/META-INF/services
+
+
+ ${spectrumMetaInfServicesFolder}
+
+ ${launcherSessionListener}
+
+
+
+
+
+
+ Copy LauncherSessionListener to "verify-windows" module's classes
+ clean
+
+ copy-resources
+
+
+ ../verify-windows/target/classes/META-INF/services
+
+
+ ${spectrumMetaInfServicesFolder}
+
+ ${launcherSessionListener}
+
+
+
+
+ Copy LauncherSessionListener to "it-appium" module's classesclean
diff --git a/src/main/resources/images/login-form-it-extent-report.png b/docs/assets/images/login-form-it-extent-report.png
similarity index 100%
rename from src/main/resources/images/login-form-it-extent-report.png
rename to docs/assets/images/login-form-it-extent-report.png
diff --git a/src/main/resources/images/login-form-it.png b/docs/assets/images/login-form-it.png
similarity index 100%
rename from src/main/resources/images/login-form-it.png
rename to docs/assets/images/login-form-it.png
diff --git a/src/main/resources/images/html-summary.png b/docs/assets/images/readme-html-summary.png
similarity index 100%
rename from src/main/resources/images/html-summary.png
rename to docs/assets/images/readme-html-summary.png
diff --git a/src/main/resources/images/html-testbook.png b/docs/assets/images/readme-html-testbook.png
similarity index 100%
rename from src/main/resources/images/html-testbook.png
rename to docs/assets/images/readme-html-testbook.png
diff --git a/it-appium/pom.xml b/it-appium/pom.xml
index 711605cb1..6f7835c91 100644
--- a/it-appium/pom.xml
+++ b/it-appium/pom.xml
@@ -39,6 +39,10 @@
org.apache.maven.pluginsmaven-checkstyle-plugin
+
+ com.diffplug.spotless
+ spotless-maven-plugin
+ org.apache.maven.pluginsmaven-surefire-plugin
@@ -86,4 +90,4 @@
-
\ No newline at end of file
+
diff --git a/it-bidi/pom.xml b/it-bidi/pom.xml
index a2882fb20..08c658340 100644
--- a/it-bidi/pom.xml
+++ b/it-bidi/pom.xml
@@ -39,6 +39,10 @@
org.apache.maven.pluginsmaven-checkstyle-plugin
+
+ com.diffplug.spotless
+ spotless-maven-plugin
+ org.apache.maven.pluginsmaven-surefire-plugin
diff --git a/it-grid/pom.xml b/it-grid/pom.xml
index a2c4b8c21..220523e31 100644
--- a/it-grid/pom.xml
+++ b/it-grid/pom.xml
@@ -48,6 +48,10 @@
org.apache.maven.pluginsmaven-checkstyle-plugin
+
+ com.diffplug.spotless
+ spotless-maven-plugin
+ org.apache.maven.pluginsmaven-surefire-plugin
diff --git a/it-grid/src/test/java/io/github/giulong/spectrum/it_grid/tests/FilesIT.java b/it-grid/src/test/java/io/github/giulong/spectrum/it_grid/tests/FilesIT.java
index 0df6cc60e..c5a433536 100644
--- a/it-grid/src/test/java/io/github/giulong/spectrum/it_grid/tests/FilesIT.java
+++ b/it-grid/src/test/java/io/github/giulong/spectrum/it_grid/tests/FilesIT.java
@@ -2,7 +2,9 @@
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOf;
import java.io.IOException;
@@ -10,8 +12,11 @@
import java.net.HttpURLConnection;
import java.net.URI;
import java.net.URL;
+import java.nio.file.Files;
+import java.nio.file.Path;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Scanner;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -50,6 +55,10 @@ void download() {
downloadPage.getDownloadLinks().getFirst().click();
assertThrows(TimeoutException.class, () -> checkDownloadedFile(FILE_TO_DOWNLOAD));
+
+ final Path downloadsFolder = Path.of(String.valueOf(configuration.getVars().get("downloadsFolder")));
+ assertTrue(Files.exists(downloadsFolder));
+ assertNotEquals(0, Objects.requireNonNull(downloadsFolder.toFile().listFiles()).length);
}
@Test
diff --git a/it-macos/pom.xml b/it-macos/pom.xml
index 9e5395f18..4ab606df8 100644
--- a/it-macos/pom.xml
+++ b/it-macos/pom.xml
@@ -39,6 +39,10 @@
org.apache.maven.pluginsmaven-checkstyle-plugin
+
+ com.diffplug.spotless
+ spotless-maven-plugin
+ org.apache.maven.pluginsmaven-surefire-plugin
diff --git a/it-testbook/pom.xml b/it-testbook/pom.xml
index 578b7e794..63f3ceeb3 100644
--- a/it-testbook/pom.xml
+++ b/it-testbook/pom.xml
@@ -39,6 +39,10 @@
org.apache.maven.pluginsmaven-checkstyle-plugin
+
+ com.diffplug.spotless
+ spotless-maven-plugin
+ org.apache.maven.pluginsmaven-surefire-plugin
diff --git a/it-testbook/src/test/java/io/github/giulong/spectrum/it_testbook/TestBookSessionListener.java b/it-testbook/src/test/java/io/github/giulong/spectrum/it_testbook/TestBookSessionListener.java
index 6ece60b46..03fe62c2a 100644
--- a/it-testbook/src/test/java/io/github/giulong/spectrum/it_testbook/TestBookSessionListener.java
+++ b/it-testbook/src/test/java/io/github/giulong/spectrum/it_testbook/TestBookSessionListener.java
@@ -176,7 +176,7 @@ public void launcherSessionClosed(LauncherSession session) {
private void createExtentFiles(final List fileNames, final Path directory) {
for (String fileName : fileNames) {
assertTrue(Files.createFile(directory.resolve(fileUtils.removeExtensionFrom(fileName)).resolve(fileName)).toFile().exists());
- Thread.sleep(1000); // just to be sure files have different creation dates
+ Thread.sleep(1000); // just to be sure files have different creation dates
}
}
@@ -184,7 +184,7 @@ private void createExtentFiles(final List fileNames, final Path director
private void createFiles(final List fileNames, final Path directory) {
for (String fileName : fileNames) {
assertTrue(Files.createFile(directory.resolve(fileName)).toFile().exists());
- Thread.sleep(1000); // just to be sure files have different creation dates
+ Thread.sleep(1000); // just to be sure files have different creation dates
}
}
@@ -192,7 +192,7 @@ private void createFiles(final List fileNames, final Path directory) {
private void createDirectories(final List directoryNames, final Path parentDirectory) {
for (String fileName : directoryNames) {
assertTrue(Files.createDirectories(parentDirectory.resolve(fileName)).toFile().exists());
- Thread.sleep(1000); // just to be sure files have different creation dates
+ Thread.sleep(1000); // just to be sure files have different creation dates
}
}
diff --git a/it-testbook/src/test/java/io/github/giulong/spectrum/it_testbook/tests/FilesIT.java b/it-testbook/src/test/java/io/github/giulong/spectrum/it_testbook/tests/FilesIT.java
index a2cb6e454..07f475432 100644
--- a/it-testbook/src/test/java/io/github/giulong/spectrum/it_testbook/tests/FilesIT.java
+++ b/it-testbook/src/test/java/io/github/giulong/spectrum/it_testbook/tests/FilesIT.java
@@ -1,9 +1,15 @@
package io.github.giulong.spectrum.it_testbook.tests;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOf;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Objects;
+
import io.github.giulong.spectrum.SpectrumTest;
import io.github.giulong.spectrum.it_testbook.pages.DownloadPage;
import io.github.giulong.spectrum.it_testbook.pages.UploadPage;
@@ -33,6 +39,10 @@ void download() {
downloadPage.getDownloadLinks().getFirst().click();
assertThrows(TimeoutException.class, () -> checkDownloadedFile(FILE_TO_DOWNLOAD));
+
+ final Path downloadsFolder = Path.of(String.valueOf(configuration.getVars().get("downloadsFolder")));
+ assertTrue(Files.exists(downloadsFolder));
+ assertNotEquals(0, Objects.requireNonNull(downloadsFolder.toFile().listFiles()).length);
}
@Test
diff --git a/it-testbook/src/test/java/io/github/giulong/spectrum/it_testbook/tests/LoginFormIT.java b/it-testbook/src/test/java/io/github/giulong/spectrum/it_testbook/tests/LoginFormIT.java
index e352852bf..d69209c75 100644
--- a/it-testbook/src/test/java/io/github/giulong/spectrum/it_testbook/tests/LoginFormIT.java
+++ b/it-testbook/src/test/java/io/github/giulong/spectrum/it_testbook/tests/LoginFormIT.java
@@ -51,7 +51,6 @@ void shouldRunSuccessfully(final String userName, final boolean expected, final
static Stream valuesProvider() {
return Stream.of(
arguments("tom", true, "/secure"),
- arguments("giulio", false, "/login")
- );
+ arguments("giulio", false, "/login"));
}
}
diff --git a/it-windows/pom.xml b/it-windows/pom.xml
new file mode 100644
index 000000000..f15f50dfe
--- /dev/null
+++ b/it-windows/pom.xml
@@ -0,0 +1,93 @@
+
+
+ 4.0.0
+
+
+ io.github.giulong
+ spectrum-aggregate
+ ${revision}
+
+
+ it-windows
+
+
+
+ io.github.giulong
+ spectrum
+ ${revision}
+ test
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-clean-plugin
+
+
+ org.apache.maven.plugins
+ maven-resources-plugin
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+ org.apache.maven.plugins
+ maven-checkstyle-plugin
+
+
+ com.diffplug.spotless
+ spotless-maven-plugin
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+ true
+
+
+
+ org.apache.maven.plugins
+ maven-failsafe-plugin
+
+
+
+
+
+
+ windows
+
+
+ windowsTests
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-failsafe-plugin
+
+
+ Chrome IT
+
+ integration-test
+
+
+ chrome
+
+ chrome
+
+ target/failsafe-reports/failsafe-chrome.xml
+
+
+
+
+
+
+
+
+
diff --git a/it-windows/src/test/java/io/github/giulong/spectrum/it_windows/pages/CheckboxPage.java b/it-windows/src/test/java/io/github/giulong/spectrum/it_windows/pages/CheckboxPage.java
new file mode 100644
index 000000000..e1b2b7f23
--- /dev/null
+++ b/it-windows/src/test/java/io/github/giulong/spectrum/it_windows/pages/CheckboxPage.java
@@ -0,0 +1,35 @@
+package io.github.giulong.spectrum.it_windows.pages;
+
+import static org.openqa.selenium.support.ui.ExpectedConditions.*;
+
+import java.util.List;
+
+import io.github.giulong.spectrum.SpectrumPage;
+import io.github.giulong.spectrum.interfaces.Endpoint;
+
+import lombok.Getter;
+
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.FindBy;
+import org.openqa.selenium.support.FindBys;
+
+@Getter
+@Endpoint("checkboxes")
+@SuppressWarnings("unused")
+public class CheckboxPage extends SpectrumPage {
+
+ @FindBys({
+ @FindBy(id = "checkboxes"),
+ @FindBy(tagName = "input")
+ })
+ private List checkboxes;
+
+ @Override
+ public CheckboxPage waitForPageLoading() {
+ pageLoadWait.until(and(
+ urlToBe("https://the-internet.herokuapp.com/checkboxes"),
+ visibilityOfAllElements(checkboxes)));
+
+ return this;
+ }
+}
diff --git a/it-windows/src/test/java/io/github/giulong/spectrum/it_windows/pages/LandingPage.java b/it-windows/src/test/java/io/github/giulong/spectrum/it_windows/pages/LandingPage.java
new file mode 100644
index 000000000..7f5e45878
--- /dev/null
+++ b/it-windows/src/test/java/io/github/giulong/spectrum/it_windows/pages/LandingPage.java
@@ -0,0 +1,19 @@
+package io.github.giulong.spectrum.it_windows.pages;
+
+import io.github.giulong.spectrum.SpectrumPage;
+
+import lombok.Getter;
+
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.FindBy;
+
+@Getter
+@SuppressWarnings("unused")
+public class LandingPage extends SpectrumPage {
+
+ @FindBy(tagName = "h1")
+ private WebElement title;
+
+ @FindBy(linkText = "Checkboxes")
+ private WebElement checkboxLink;
+}
diff --git a/it-windows/src/test/java/io/github/giulong/spectrum/it_windows/tests/WindowsCheckboxIT.java b/it-windows/src/test/java/io/github/giulong/spectrum/it_windows/tests/WindowsCheckboxIT.java
new file mode 100644
index 000000000..45a3b7d56
--- /dev/null
+++ b/it-windows/src/test/java/io/github/giulong/spectrum/it_windows/tests/WindowsCheckboxIT.java
@@ -0,0 +1,49 @@
+package io.github.giulong.spectrum.it_windows.tests;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.condition.OS.WINDOWS;
+
+import io.github.giulong.spectrum.SpectrumTest;
+import io.github.giulong.spectrum.it_windows.pages.CheckboxPage;
+import io.github.giulong.spectrum.it_windows.pages.LandingPage;
+
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.EnabledOnOs;
+import org.openqa.selenium.WebElement;
+
+@SuppressWarnings("unused")
+@DisplayName("Checkbox Page")
+@EnabledOnOs(WINDOWS)
+class WindowsCheckboxIT extends SpectrumTest {
+
+ private LandingPage landingPage;
+
+ private CheckboxPage checkboxPage;
+
+ @Test
+ void testWithNoDisplayName() {
+ // Open the base url of the application under test
+ driver.get(configuration.getApplication().getBaseUrl());
+ assertEquals("Welcome to the-internet", landingPage.getTitle().getText());
+
+ extentTest.info("Custom step that should not be highlighted on video playback");
+ landingPage.getCheckboxLink().click();
+ extentTest.info("Custom step that should not be highlighted on video playback");
+
+ final WebElement firstCheckbox = checkboxPage.getCheckboxes().getFirst();
+ final WebElement secondCheckbox = checkboxPage.getCheckboxes().get(1);
+
+ assertFalse(firstCheckbox.isSelected());
+ assertTrue(secondCheckbox.isSelected());
+
+ extentTest.info("Custom step that should not be highlighted on video playback");
+ firstCheckbox.click();
+ assertTrue(firstCheckbox.isSelected());
+
+ // Take a screenshot with a custom message
+ screenshotInfo("After checking the first checkbox");
+ }
+}
diff --git a/it-windows/src/test/resources/banner.txt b/it-windows/src/test/resources/banner.txt
new file mode 100644
index 000000000..db9687271
--- /dev/null
+++ b/it-windows/src/test/resources/banner.txt
@@ -0,0 +1,19 @@
+<#assign length = 19 + name?length>
+<#assign pad = length + (54 - length)/2>
+
+======================================================
+
+${"START MODULE ${name?upper_case} TESTS"?left_pad(pad)}
+
+======================================================
+ __________________________________________________
+ / ____ _ \
+| / ___| _ __ ___ ___| |_ _ __ _ _ _ __ ___ |
+| \___ \| '_ \ / _ \/ __| __| '__| | | | '_ ` _ \ |
+| ___) | |_) | __/ (__| |_| | | |_| | | | | | | |
+| |____/| .__/ \___|\___|\__|_| \__,_|_| |_| |_| |
+| ******|_|${" Version: ${version}"?left_pad(39, "*")} |
+| |
+| Please consider giving a GitHub star: |
+| ${url?right_pad(44)}|
+ \__________________________________________________/
diff --git a/it-windows/src/test/resources/configuration.yml b/it-windows/src/test/resources/configuration.yml
new file mode 100644
index 000000000..915e5c16e
--- /dev/null
+++ b/it-windows/src/test/resources/configuration.yml
@@ -0,0 +1,10 @@
+application:
+ baseUrl: https://the-internet.herokuapp.com/
+
+drivers:
+ waits:
+ downloadTimeout: 5
+
+extent:
+ theme: DARK
+ fileName: report-${spectrum.driver:-chrome}.html
diff --git a/it-windows/src/test/resources/filtered/properties.yaml b/it-windows/src/test/resources/filtered/properties.yaml
new file mode 100644
index 000000000..b34a324ea
--- /dev/null
+++ b/it-windows/src/test/resources/filtered/properties.yaml
@@ -0,0 +1,3 @@
+name: ${project.artifactId}
+version: ${project.version}
+url: https://github.com/giulong/spectrum
diff --git a/it-windows/src/test/resources/logback-test.xml b/it-windows/src/test/resources/logback-test.xml
new file mode 100644
index 000000000..f42375332
--- /dev/null
+++ b/it-windows/src/test/resources/logback-test.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+ ${COLOR_PATTERN}
+
+
+
+
+ ${FILE_PATH}/spectrum.log
+
+ ${PATTERN}
+
+
+
+
+
+
+
+
diff --git a/it/pom.xml b/it/pom.xml
index 649aab0a3..1ca76bd7c 100644
--- a/it/pom.xml
+++ b/it/pom.xml
@@ -39,6 +39,10 @@
org.apache.maven.pluginsmaven-checkstyle-plugin
+
+ com.diffplug.spotless
+ spotless-maven-plugin
+ org.apache.maven.pluginsmaven-surefire-plugin
diff --git a/it/src/test/java/io/github/giulong/spectrum/it/tests/FakerIT.java b/it/src/test/java/io/github/giulong/spectrum/it/tests/FakerIT.java
index 1affa6079..0484565b0 100644
--- a/it/src/test/java/io/github/giulong/spectrum/it/tests/FakerIT.java
+++ b/it/src/test/java/io/github/giulong/spectrum/it/tests/FakerIT.java
@@ -82,7 +82,6 @@ void inputsWithProvider(final String number) {
static Stream valuesProvider() {
return Stream.of(
arguments(faker.numerify("##")),
- arguments(faker.numerify("###"))
- );
+ arguments(faker.numerify("###")));
}
}
diff --git a/it/src/test/java/io/github/giulong/spectrum/it/tests/FilesIT.java b/it/src/test/java/io/github/giulong/spectrum/it/tests/FilesIT.java
index 0f4af17ec..9df0e4a2e 100644
--- a/it/src/test/java/io/github/giulong/spectrum/it/tests/FilesIT.java
+++ b/it/src/test/java/io/github/giulong/spectrum/it/tests/FilesIT.java
@@ -3,6 +3,10 @@
import static org.junit.jupiter.api.Assertions.*;
import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOf;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Objects;
+
import io.github.giulong.spectrum.SpectrumTest;
import io.github.giulong.spectrum.it.pages.DownloadPage;
import io.github.giulong.spectrum.it.pages.UploadPage;
@@ -42,6 +46,11 @@ void download() {
// We call the inherited helper method to check if the downloaded file is the one we expect
// This is expected to fail since we're comparing it with a wrong file
assertThrows(TimeoutException.class, () -> checkDownloadedFile(FILE_TO_DOWNLOAD));
+
+ // We still check the driver downloaded files in the right place
+ final Path downloadsFolder = Path.of(String.valueOf(configuration.getVars().get("downloadsFolder")));
+ assertTrue(Files.exists(downloadsFolder));
+ assertNotEquals(0, Objects.requireNonNull(downloadsFolder.toFile().listFiles()).length);
}
@Test
diff --git a/it/src/test/java/io/github/giulong/spectrum/it/tests/LoginFormIT.java b/it/src/test/java/io/github/giulong/spectrum/it/tests/LoginFormIT.java
index 7ec2def9f..414234f9b 100644
--- a/it/src/test/java/io/github/giulong/spectrum/it/tests/LoginFormIT.java
+++ b/it/src/test/java/io/github/giulong/spectrum/it/tests/LoginFormIT.java
@@ -65,8 +65,7 @@ void shouldRunSuccessfully(final String userName, final boolean expected, final
static Stream valuesProvider() {
return Stream.of(
arguments("tom", true, "/secure"),
- arguments("giulio", false, "/login")
- );
+ arguments("giulio", false, "/login"));
}
@Test
diff --git a/pom.xml b/pom.xml
index b8bd77987..e68991db8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -68,10 +68,12 @@
it-bidiit-testbookit-macos
+ it-windowsit-appiumverify-commonsverify-browsersverify-macos
+ verify-windowsverify-appiumcleanup
@@ -108,6 +110,16 @@
+
+ windows
+
+ it-windows
+ verify-commons
+ verify-windows
+ cleanup
+
+
+
appium
@@ -195,7 +207,7 @@
ch.qos.logbacklogback-classic
- 1.5.20
+ 1.5.21org.slf4j
@@ -310,20 +322,6 @@
maven-clean-plugin3.5.0
-
- com.diffplug.spotless
- spotless-maven-plugin
- 3.0.0
-
-
-
-
- java,javax,ch,com,io,net,lombok,org
-
-
-
-
- org.apache.maven.pluginsmaven-checkstyle-plugin
@@ -332,7 +330,7 @@
com.puppycrawl.toolscheckstyle
- 12.1.1
+ 12.2.0com.github.sevntu-checkstyle
@@ -371,6 +369,31 @@
+
+ com.diffplug.spotless
+ spotless-maven-plugin
+ 3.1.0
+
+
+
+
+ java,javax,ch,com,io,net,lombok,org
+
+
+
+ ${maven.multiModuleProjectDirectory}/spotless.xml
+
+
+
+
+
+ validate
+
+ check
+
+
+
+ org.apache.maven.pluginsmaven-compiler-plugin
@@ -386,7 +409,7 @@
org.apache.maven.pluginsmaven-resources-plugin
- 3.3.1
+ 3.4.0UTF-8
@@ -433,7 +456,7 @@
org.apache.maven.pluginsmaven-jar-plugin
- 3.4.2
+ 3.5.0com.github.victools
@@ -484,6 +507,10 @@
org.apache.maven.pluginsmaven-checkstyle-plugin
+
+ com.diffplug.spotless
+ spotless-maven-plugin
+ org.apache.maven.pluginsmaven-resources-plugin
diff --git a/spectrum/pom.xml b/spectrum/pom.xml
index 37981619b..618fd3b6d 100644
--- a/spectrum/pom.xml
+++ b/spectrum/pom.xml
@@ -195,6 +195,10 @@
org.apache.maven.pluginsmaven-checkstyle-plugin
+
+ com.diffplug.spotless
+ spotless-maven-plugin
+ org.apache.maven.pluginsmaven-surefire-plugin
@@ -311,7 +315,7 @@
org.apache.maven.pluginsmaven-source-plugin
- 3.3.1
+ 3.4.0attach-sources
diff --git a/spectrum/src/main/java/io/github/giulong/spectrum/SpectrumEntity.java b/spectrum/src/main/java/io/github/giulong/spectrum/SpectrumEntity.java
index 12b43301e..d49ecaa65 100644
--- a/spectrum/src/main/java/io/github/giulong/spectrum/SpectrumEntity.java
+++ b/spectrum/src/main/java/io/github/giulong/spectrum/SpectrumEntity.java
@@ -120,6 +120,7 @@ public abstract class SpectrumEntity, Data> {
* Hovers on the provided WebElement, leveraging the {@code actions} field
*
* @param webElement the WebElement on which to hover
+ *
* @return the calling SpectrumEntity instance
*/
@SuppressWarnings("unchecked")
@@ -142,9 +143,11 @@ public T screenshot() {
}
/**
- * Adds a screenshot with the provided message and INFO status to the current test in the Extent Report
+ * Adds a screenshot with the provided message and INFO status to the current
+ * test in the Extent Report
*
* @param msg the message to log
+ *
* @return the calling SpectrumEntity instance
*/
@SuppressWarnings("unchecked")
@@ -155,9 +158,11 @@ public T screenshotInfo(final String msg) {
}
/**
- * Adds a screenshot status with the provided message and WARN to the current test in the Extent Report
+ * Adds a screenshot status with the provided message and WARN to the current
+ * test in the Extent Report
*
* @param msg the message to log
+ *
* @return the calling SpectrumEntity instance
*/
@SuppressWarnings("unchecked")
@@ -168,9 +173,11 @@ public T screenshotWarning(final String msg) {
}
/**
- * Adds a screenshot with the provided message and FAIL status to the current test in the Extent Report
+ * Adds a screenshot with the provided message and FAIL status to the current
+ * test in the Extent Report
*
* @param msg the message to log
+ *
* @return the calling SpectrumEntity instance
*/
@SuppressWarnings("unchecked")
@@ -181,9 +188,10 @@ public T screenshotFail(final String msg) {
}
/**
- * Adds a screenshot with the provided message and the provided status to the current test in the Extent Report
+ * Adds a screenshot with the provided message and the provided status to the
+ * current test in the Extent Report
*
- * @param msg the message to log
+ * @param msg the message to log
* @param status the log's status
*/
public void addScreenshotToReport(final String msg, final Status status) {
@@ -209,16 +217,19 @@ public void addScreenshotToReport(final String msg, final Status status) {
}
/**
- * Deletes the download folder (its path is provided in the {@code configuration*.yaml})
+ * Deletes the download folder (its path is provided in the
+ * {@code configuration*.yaml})
*/
public void deleteDownloadsFolder() {
fileUtils.deleteContentOf(Path.of(configuration.getRuntime().getDownloadsFolder()));
}
/**
- * Leverages the configurable {@code downloadWait} to check fluently if the file at the provided path is fully downloaded
+ * Leverages the configurable {@code downloadWait} to check fluently if the file
+ * at the provided path is fully downloaded
*
* @param path the path to the downloaded file to wait for
+ *
* @return the calling SpectrumEntity instance
*/
@SuppressWarnings("unchecked")
@@ -232,10 +243,12 @@ public T waitForDownloadOf(final Path path) {
}
/**
- * Leverages the {@code waitForDownloadOf} method and then compares the checksums of the two files provided.
+ * Leverages the {@code waitForDownloadOf} method and then compares the
+ * checksums of the two files provided.
*
* @param downloadedFileName name of the downloaded file
- * @param fileToCheckName name of the static file to be used as comparison
+ * @param fileToCheckName name of the static file to be used as comparison
+ *
* @return true if the files are equal
*/
public boolean checkDownloadedFile(final String downloadedFileName, final String fileToCheckName) {
@@ -246,17 +259,20 @@ public boolean checkDownloadedFile(final String downloadedFileName, final String
waitForDownloadOf(downloadedFile);
log.info("""
- Checking if these files are the same:
- {}
- {}
- """, downloadedFile, fileToCheck);
+ Checking if these files are the same:
+ {}
+ {}
+ """, downloadedFile, fileToCheck);
return Arrays.equals(sha256Of(downloadedFile), sha256Of(fileToCheck));
}
/**
- * Leverages the {@code waitForDownloadOf} method and then compares the checksums of the file provided.
+ * Leverages the {@code waitForDownloadOf} method and then compares the
+ * checksums of the file provided.
+ *
+ * @param file name of both the downloaded file and the static one to be used as
+ * comparison
*
- * @param file name of both the downloaded file and the static one to be used as comparison
* @return true if the files are equal
*/
public boolean checkDownloadedFile(final String file) {
@@ -264,10 +280,12 @@ public boolean checkDownloadedFile(final String file) {
}
/**
- * Helper method to call Selenium's {@code clear} and {@code sendKeys} on the provided WebElement, which is then returned
+ * Helper method to call Selenium's {@code clear} and {@code sendKeys} on the
+ * provided WebElement, which is then returned
*
* @param webElement target WebElement
* @param keysToSend keys to send
+ *
* @return the target WebElement passed as argument
*/
public WebElement clearAndSendKeys(final WebElement webElement, final CharSequence keysToSend) {
@@ -278,11 +296,13 @@ public WebElement clearAndSendKeys(final WebElement webElement, final CharSequen
}
/**
- * Uploads to the provided WebElement (usually an input field with {@code type="file"}) the file with the provided name, taken from the
+ * Uploads to the provided WebElement (usually an input field with
+ * {@code type="file"}) the file with the provided name, taken from the
* configurable {@code runtime.filesFolder}.
*
* @param webElement target WebElement
- * @param fileName name of the file to be uploaded
+ * @param fileName name of the file to be uploaded
+ *
* @return the calling SpectrumEntity instance
*/
@SuppressWarnings("unchecked")
@@ -295,9 +315,11 @@ public T upload(final WebElement webElement, final String fileName) {
}
/**
- * Checks if the WebElement with the provided {@code by} is present in the current page
+ * Checks if the WebElement with the provided {@code by} is present in the
+ * current page
*
* @param by the WebElement's selector
+ *
* @return true if the WebElement is found
*/
public boolean isPresent(final By by) {
@@ -307,9 +329,11 @@ public boolean isPresent(final By by) {
}
/**
- * Checks if no WebElement with the provided {@code by} is present in the current page
+ * Checks if no WebElement with the provided {@code by} is present in the
+ * current page
*
* @param by the WebElement's selector
+ *
* @return true if the WebElement is not found
*/
public boolean isNotPresent(final By by) {
@@ -320,7 +344,8 @@ public boolean isNotPresent(final By by) {
* Checks if the provided WebElement has the provided css class
*
* @param webElement the WebElement to check
- * @param className the css class to look for
+ * @param className the css class to look for
+ *
* @return true if the WebElement has the provided css class
*/
public boolean hasClass(final WebElement webElement, final String className) {
@@ -330,10 +355,12 @@ public boolean hasClass(final WebElement webElement, final String className) {
}
/**
- * Checks if the provided WebElement has all the provided css classes
+ * Checks if the provided WebElement has all the provided css
+ * classes
*
* @param webElement the WebElement to check
- * @param classes the css classes to look for
+ * @param classes the css classes to look for
+ *
* @return true if the WebElement has all the provided css classes
*/
public boolean hasClasses(final WebElement webElement, final String... classes) {
diff --git a/spectrum/src/main/java/io/github/giulong/spectrum/SpectrumPage.java b/spectrum/src/main/java/io/github/giulong/spectrum/SpectrumPage.java
index ab36eb175..9440ba87f 100644
--- a/spectrum/src/main/java/io/github/giulong/spectrum/SpectrumPage.java
+++ b/spectrum/src/main/java/io/github/giulong/spectrum/SpectrumPage.java
@@ -27,9 +27,11 @@ public abstract class SpectrumPage, Data> extend
private String endpoint;
/**
- * Opens the web page at the URL made by the concatenation of the {@code baseUrl} provided in the {@code configuration.yaml}
- * and the value of the {@code @Endpoint} annotation on the calling SpectrumPage.
- * It also calls the {@link SpectrumPage#waitForPageLoading()} waitForPageLoading} before returning
+ * Opens the web page at the URL made by the concatenation of the
+ * {@code baseUrl} provided in the {@code configuration.yaml} and the value of
+ * the {@code @Endpoint} annotation on the calling SpectrumPage. It also calls
+ * the {@link SpectrumPage#waitForPageLoading()} waitForPageLoading} before
+ * returning
*
* @return the calling SpectrumPage instance
*/
@@ -44,9 +46,10 @@ public T open() {
}
/**
- * This is a method that by default just logs a warning. If you need to check for custom conditions before considering
- * a page fully loaded, you should override this method, so that calling {@link SpectrumPage#open() open}
- * on pages will call your implementation automatically
+ * This is a method that by default just logs a warning. If you need to check
+ * for custom conditions before considering a page fully loaded, you should
+ * override this method, so that calling {@link SpectrumPage#open() open} on
+ * pages will call your implementation automatically
*
* @return the calling SpectrumPage instance
*/
@@ -58,7 +61,8 @@ public T waitForPageLoading() {
}
/**
- * Checks whether the SpectrumPage instance on which this is called is fully loaded
+ * Checks whether the SpectrumPage instance on which this is called is fully
+ * loaded
*
* @return true if the SpectrumPage is loaded
*/
@@ -97,7 +101,8 @@ void injectJsWebElementProxyInto(final Field field) {
if (value instanceof List>) {
log.debug("Field {} is a list. Cannot build proxy eagerly", field.getName());
- @SuppressWarnings("unchecked") final Object webElementProxy = Proxy.newProxyInstance(
+ @SuppressWarnings("unchecked")
+ final Object webElementProxy = Proxy.newProxyInstance(
List.class.getClassLoader(),
new Class>[]{List.class},
JsWebElementListInvocationHandler
diff --git a/spectrum/src/main/java/io/github/giulong/spectrum/SpectrumSessionListener.java b/spectrum/src/main/java/io/github/giulong/spectrum/SpectrumSessionListener.java
index 2046ddb6a..a2ef02b6e 100644
--- a/spectrum/src/main/java/io/github/giulong/spectrum/SpectrumSessionListener.java
+++ b/spectrum/src/main/java/io/github/giulong/spectrum/SpectrumSessionListener.java
@@ -70,8 +70,7 @@ void parseConfiguration() {
.map(profile -> String.format("configuration-%s", profile))
.toList();
- parseVars(CONFIGURATION);
- profileConfigurations.forEach(this::parseVars);
+ parseVars(profileConfigurations);
yamlUtils.updateWithInternalFile(configuration, DEFAULT_CONFIGURATION_YAML);
if (isUnix()) {
@@ -86,23 +85,27 @@ void parseConfiguration() {
List parseProfiles() {
return Arrays.stream(Optional
- .ofNullable(yamlUtils.readClientNode(PROFILE_NODE, CONFIGURATION, String.class))
- .orElse(yamlUtils.readInternalNode(PROFILE_NODE, DEFAULT_CONFIGURATION_YAML, String.class))
- .split(","))
+ .ofNullable(yamlUtils.readClientNode(PROFILE_NODE, CONFIGURATION))
+ .orElse(yamlUtils.readInternalNode(PROFILE_NODE, DEFAULT_CONFIGURATION_YAML))
+ .split(","))
.filter(not(String::isBlank))
.toList();
}
- @SuppressWarnings("unchecked")
- void parseVars(final String profileConfiguration) {
- vars.putAll(yamlUtils.readInternalNode(VARS_NODE, DEFAULT_CONFIGURATION_YAML, Map.class));
+ void parseVars(final List profileConfigurations) {
+ vars.putAll(yamlUtils.readInternalNode(VARS_NODE, DEFAULT_CONFIGURATION_YAML));
if (isUnix()) {
- vars.putAll(yamlUtils.readInternalNode(VARS_NODE, DEFAULT_CONFIGURATION_UNIX_YAML, Map.class));
+ vars.putAll(yamlUtils.readInternalNode(VARS_NODE, DEFAULT_CONFIGURATION_UNIX_YAML));
}
- vars.putAll(Optional.ofNullable(yamlUtils.readClientNode(VARS_NODE, CONFIGURATION, Map.class)).orElse(new HashMap<>()));
- vars.putAll(Optional.ofNullable(yamlUtils.readClientNode(VARS_NODE, profileConfiguration, Map.class)).orElse(new HashMap<>()));
+ vars.putAll(Optional
+ .
+
+ com.diffplug.spotless
+ spotless-maven-plugin
+ org.apache.maven.pluginsmaven-surefire-plugin
diff --git a/verify-browsers/pom.xml b/verify-browsers/pom.xml
index dac04123b..6a82a5351 100644
--- a/verify-browsers/pom.xml
+++ b/verify-browsers/pom.xml
@@ -43,6 +43,10 @@
org.apache.maven.pluginsmaven-checkstyle-plugin
+
+ com.diffplug.spotless
+ spotless-maven-plugin
+ org.apache.maven.pluginsmaven-surefire-plugin
diff --git a/verify-browsers/src/test/java/io/github/giulong/spectrum/verify_browsers/unit/ItVerifierTest.java b/verify-browsers/src/test/java/io/github/giulong/spectrum/verify_browsers/unit/ItVerifierTest.java
index 3ea615c62..aa607b4ca 100644
--- a/verify-browsers/src/test/java/io/github/giulong/spectrum/verify_browsers/unit/ItVerifierTest.java
+++ b/verify-browsers/src/test/java/io/github/giulong/spectrum/verify_browsers/unit/ItVerifierTest.java
@@ -46,19 +46,19 @@ public void logFile() throws FileNotFoundException {
// we indirectly check that the log consumer accepted the event with a regex in the primaryId
assertTrue(logFile.contains("""
- Class Name: ---
- Test Name : ---
- Reason : custom-event
- Result : ---
- Tags : ---"""));
+ Class Name: ---
+ Test Name : ---
+ Reason : custom-event
+ Result : ---
+ Tags : ---"""));
// we indirectly check that the log consumer accepted the event with a regex in the reason
assertTrue(logFile.contains("""
- Class Name: ---
- Test Name : ---
- Reason : secondReason
- Result : ---
- Tags : ---"""));
+ Class Name: ---
+ Test Name : ---
+ Reason : secondReason
+ Result : ---
+ Tags : ---"""));
// we check values sent to @Secured web elements are masked
assertTrue(logFile.contains("Sending keys [***] to id: password"));
diff --git a/verify-commons/pom.xml b/verify-commons/pom.xml
index 099c90011..d362bfa9f 100644
--- a/verify-commons/pom.xml
+++ b/verify-commons/pom.xml
@@ -42,6 +42,10 @@
org.apache.maven.pluginsmaven-checkstyle-plugin
+
+ com.diffplug.spotless
+ spotless-maven-plugin
+ org.apache.maven.pluginsmaven-surefire-plugin
diff --git a/verify-commons/src/main/java/io/github/giulong/spectrum/verify_commons/FailsafeReportsVerifier.java b/verify-commons/src/main/java/io/github/giulong/spectrum/verify_commons/FailsafeReportsVerifier.java
index 4aaa2c4f8..378e5fe29 100644
--- a/verify-commons/src/main/java/io/github/giulong/spectrum/verify_commons/FailsafeReportsVerifier.java
+++ b/verify-commons/src/main/java/io/github/giulong/spectrum/verify_commons/FailsafeReportsVerifier.java
@@ -71,15 +71,15 @@ public boolean verifyResultsAre(final String module, final String driver, final
log
.atLevel(result ? INFO : ERROR)
.log("""
- \s
- Results for report '{}' are:
- \s
- {}
- {}
- {}
- {}
- {}
- """,
+ \s
+ Results for report '{}' are:
+ \s
+ {}
+ {}
+ {}
+ {}
+ {}
+ """,
filePath,
header,
completedLine,
diff --git a/verify-macos/pom.xml b/verify-macos/pom.xml
index a0151829a..2a61bc623 100644
--- a/verify-macos/pom.xml
+++ b/verify-macos/pom.xml
@@ -18,11 +18,6 @@
verify-commons${revision}
-
- org.hamcrest
- hamcrest
- test
-
@@ -43,6 +38,10 @@
org.apache.maven.pluginsmaven-checkstyle-plugin
+
+ com.diffplug.spotless
+ spotless-maven-plugin
+ org.apache.maven.pluginsmaven-surefire-plugin
diff --git a/verify-windows/pom.xml b/verify-windows/pom.xml
new file mode 100644
index 000000000..2b59caeaa
--- /dev/null
+++ b/verify-windows/pom.xml
@@ -0,0 +1,61 @@
+
+
+ 4.0.0
+
+
+ io.github.giulong
+ spectrum-aggregate
+ ${revision}
+
+
+ verify-windows
+
+
+
+ io.github.giulong
+ verify-commons
+ ${revision}
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-clean-plugin
+
+
+ org.apache.maven.plugins
+ maven-resources-plugin
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+ org.apache.maven.plugins
+ maven-checkstyle-plugin
+
+
+ com.diffplug.spotless
+ spotless-maven-plugin
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+ -Dfile.encoding=UTF-8
+
+
+
+ org.apache.maven.plugins
+ maven-failsafe-plugin
+
+ true
+
+
+
+
+
diff --git a/verify-windows/src/test/java/io/github/giulong/spectrum/verify_windows/ItWindowsVerifierTest.java b/verify-windows/src/test/java/io/github/giulong/spectrum/verify_windows/ItWindowsVerifierTest.java
new file mode 100644
index 000000000..850c8739a
--- /dev/null
+++ b/verify-windows/src/test/java/io/github/giulong/spectrum/verify_windows/ItWindowsVerifierTest.java
@@ -0,0 +1,28 @@
+package io.github.giulong.spectrum.verify_windows;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.condition.OS.WINDOWS;
+
+import io.github.giulong.spectrum.verify_commons.FailsafeReportsVerifier;
+
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.EnabledOnOs;
+
+@DisplayName("It Windows Module Verifier")
+@EnabledOnOs(WINDOWS)
+public class ItWindowsVerifierTest {
+
+ private static final FailsafeReportsVerifier FAILSAFE_REPORTS_VERIFIER = FailsafeReportsVerifier.getInstance();
+
+ private static final int COMPLETED = 1;
+ private static final int ERRORS = 0;
+ private static final int FAILURES = 0;
+ private static final int SKIPPED = 0;
+
+ @Test
+ @DisplayName("chrome should have run with the correct results")
+ public void verifyChrome() {
+ assertTrue(FAILSAFE_REPORTS_VERIFIER.verifyResultsAre("it-windows", "chrome", COMPLETED, ERRORS, FAILURES, SKIPPED), "CHROME");
+ }
+}
diff --git a/verify-windows/src/test/resources/configuration.yaml b/verify-windows/src/test/resources/configuration.yaml
new file mode 100644
index 000000000..104ef128a
--- /dev/null
+++ b/verify-windows/src/test/resources/configuration.yaml
@@ -0,0 +1,6 @@
+drivers:
+ waits:
+ downloadTimeout: 5
+ chrome:
+ args:
+ - --headless=new