Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/next release #327

Merged
merged 7 commits into from
Jan 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions DEV.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ client would. So, we build the framework in a dedicated module, and then we incl
| [spectrum](spectrum) | Framework |
| [it](it) | Runs the same e2e suite with all the browsers, no testbook |
| [it-grid](it-grid) | Runs the same e2e suite as the `it` module, pointing to a local embedded grid |
| [it-bidi](it-bidi) | Runs a bunch of tests with the `webSocketUrl` capability |
| [it-testbook](it-testbook) | Runs a bunch of tests with a testbook |
| [it-macos](it-macos) | Runs a bunch of tests specific to macOS (Safari) |
| [it-appium](it-appium) | Runs a bunch of tests with Appium |
| [verify-commons](verify-commons) | Contains common classes used in other verify modules |
| [verify-browsers](verify-browsers) | Verifies results of the `it`, `it-testbook`, and `it-grid` modules |
| [verify-browsers](verify-browsers) | Verifies results of the `it`, `it-testbook`, `it-grid`, and `it-bidi` modules |
| [verify-macos](verify-macos) | Verifies results of the `it-macos` module |
| [verify-appium](verify-appium) | Verifies results of the `it-appium` module |
| [cleanup](cleanup) | Cleans each module after the execution |
Expand Down Expand Up @@ -45,6 +46,7 @@ To avoid manual operations, at the end of the full build, the `cleanup` module w
| spectrum | ✅ | ❌ | remove `SpectrumSessionListener` |
| it | ❌ | ✅ | add `SpectrumSessionListener` |
| it-grid | ❌ | ✅ | add `SpectrumSessionListener` |
| it-bidi | ❌ | ✅ | add `SpectrumSessionListener` |
| it-testbook | ❌ | ✅ | add `SpectrumSessionListener` |
| it-appium | ❌ | ✅ | add `SpectrumSessionListener` |
| verify-browsers | ✅ | ✅ | add `SpectrumSessionListener` |
Expand Down Expand Up @@ -116,13 +118,13 @@ The [checkstyle plugin](https://maven.apache.org/plugins/maven-checkstyle-plugin

These are the available profiles you can find in the [pom.xml](pom.xml):

| Profile | Description |
|----------------|--------------------------------------------------------------|
| all | runs the full build. Active by default |
| framework-only | builds the framework, skipping unit tests |
| browsers | runs tests in the `it`, `it-testbook`, and `it-grid` modules |
| macos | runs tests in the `it-macos` module |
| appium | runs tests in the `it-appium` module |
| Profile | Description |
|----------------|-------------------------------------------------------------------------|
| all | runs the full build. Active by default |
| framework-only | builds the framework, skipping unit tests |
| browsers | runs tests in the `it`, `it-testbook`, `it-grid`, and `it-bidi` modules |
| macos | runs tests in the `it-macos` module |
| appium | runs tests in the `it-appium` module |

You can leverage them to run specific groups of submodules. It's better to leverage these profiles instead of limiting
the execution to single modules with `-pl <module name>` in order to build the related `verify-*` and `cleanup` modules as well.
Expand Down
18 changes: 18 additions & 0 deletions cleanup/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,24 @@
</resources>
</configuration>
</execution>
<execution>
<id>Copy LauncherSessionListener to "it-bidi" module's classes</id>
<phase>clean</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>../it-bidi/target/classes/META-INF/services</outputDirectory>
<resources>
<resource>
<directory>${spectrumMetaInfServicesFolder}</directory>
<includes>
<include>${launcherSessionListener}</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
Expand Down
151 changes: 151 additions & 0 deletions it-bidi/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
<?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>

<parent>
<groupId>io.github.giulong</groupId>
<artifactId>spectrum-aggregate</artifactId>
<version>${revision}</version>
</parent>

<artifactId>it-bidi</artifactId>

<dependencies>
<dependency>
<groupId>io.github.giulong</groupId>
<artifactId>spectrum</artifactId>
<version>${revision}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>chrome</id>
<activation>
<property>
<name>browsersTests</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<id>Chrome IT</id>
<goals>
<goal>integration-test</goal>
</goals>
<configuration>
<reportNameSuffix>chrome</reportNameSuffix>
<systemPropertyVariables>
<spectrum.driver>chrome</spectrum.driver>
</systemPropertyVariables>
<summaryFile>target/failsafe-reports/failsafe-chrome.xml</summaryFile>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>firefox</id>
<activation>
<property>
<name>browsersTests</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<id>Firefox IT</id>
<goals>
<goal>integration-test</goal>
</goals>
<configuration>
<reportNameSuffix>firefox</reportNameSuffix>
<systemPropertyVariables>
<spectrum.driver>firefox</spectrum.driver>
</systemPropertyVariables>
<summaryFile>target/failsafe-reports/failsafe-firefox.xml</summaryFile>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>edge</id>
<activation>
<property>
<name>browsersTests</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<id>Edge IT</id>
<goals>
<goal>integration-test</goal>
</goals>
<configuration>
<reportNameSuffix>edge</reportNameSuffix>
<systemPropertyVariables>
<spectrum.driver>edge</spectrum.driver>
</systemPropertyVariables>
<summaryFile>target/failsafe-reports/failsafe-edge.xml</summaryFile>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package io.github.giulong.spectrum.it.pages;

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;

import java.util.List;

import static org.openqa.selenium.support.ui.ExpectedConditions.*;

@Getter
@Endpoint("checkboxes")
public class CheckboxPage extends SpectrumPage<CheckboxPage, Void> {

@FindBys({
@FindBy(id = "checkboxes"),
@FindBy(tagName = "input")
})
private List<WebElement> checkboxes;

@Override
public CheckboxPage waitForPageLoading() {
pageLoadWait.until(and(
urlToBe("https://the-internet.herokuapp.com/checkboxes"),
visibilityOfAllElements(checkboxes)));

return this;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package io.github.giulong.spectrum.it.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<LandingPage, Void> {

@FindBy(id = "login")
private WebElement form;

@FindBy(tagName = "h1")
private WebElement title;

@FindBy(linkText = "A/B Testing")
private WebElement abTestLink;

@FindBy(linkText = "Add/Remove Elements")
private WebElement addRemoveElementsLink;

@FindBy(linkText = "Broken Images")
private WebElement brokenImagesLink;

@FindBy(linkText = "Checkboxes")
private WebElement checkboxLink;

@FindBy(linkText = "Form Authentication")
private WebElement formLoginLink;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package io.github.giulong.spectrum.it.tests;

import io.github.giulong.spectrum.SpectrumTest;
import io.github.giulong.spectrum.it.pages.CheckboxPage;
import io.github.giulong.spectrum.it.pages.LandingPage;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.openqa.selenium.bidi.module.Network;
import org.openqa.selenium.bidi.network.AddInterceptParameters;

import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.openqa.selenium.bidi.network.InterceptPhase.BEFORE_REQUEST_SENT;

@SuppressWarnings("unused")
@DisplayName("Checkbox Page")
public class BiDiCheckboxIT extends SpectrumTest<Void> {

private LandingPage landingPage;

private CheckboxPage checkboxPage;

@Test
public void testWithNoDisplayName() {
try (Network network = new Network(driver)) {
String intercept = network.addIntercept(new AddInterceptParameters(BEFORE_REQUEST_SENT));
assertNotNull(intercept);
}
}
}
19 changes: 19 additions & 0 deletions it-bidi/src/test/resources/banner.txt
Original file line number Diff line number Diff line change
@@ -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)}|
\__________________________________________________/
37 changes: 37 additions & 0 deletions it-bidi/src/test/resources/configuration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
application:
baseUrl: https://the-internet.herokuapp.com/

drivers:
waits:
implicit: 2
downloadTimeout: 5
chrome:
args:
- --headless=new
capabilities:
webSocketUrl: true
firefox:
args:
- -headless
capabilities:
webSocketUrl: true
edge:
args:
- --headless=new
experimentalOptions:
binary: ${EDGE_BINARY:-}
capabilities:
webSocketUrl: true

video:
frames:
- autoAfter
- manual
skipDuplicateFrames: false

extent:
theme: DARK
fileName: report-${spectrum.driver:-chrome}.html
inline: true
sort:
name: { }
3 changes: 3 additions & 0 deletions it-bidi/src/test/resources/filtered/properties.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: ${project.artifactId}
version: ${project.version}
url: https://github.com/giulong/spectrum
3 changes: 3 additions & 0 deletions it-bidi/src/test/resources/js/report.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
document
.querySelectorAll("video")
.forEach(video => video.classList.add("class-added-from-js"));
16 changes: 16 additions & 0 deletions it-bidi/src/test/resources/logback-test.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<conversionRule conversionWord="colored" class="io.github.giulong.spectrum.internals.ColoredConverter" />
<property name="PATTERN" value="%d{HH:mm:ss.SSS} %.-1level %-30.30logger{0} | %msg%nopex%n"/>
<property name="COLOR_PATTERN" value="%d{HH:mm:ss.SSS} %colored(%.-1level %-30.30logger{0} | %msg%nopex%n)"/>

<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${COLOR_PATTERN}</pattern>
</encoder>
</appender>

<root level="${spectrum.log.level:-INFO}">
<appender-ref ref="STDOUT"/>
</root>
</configuration>
Loading
Loading