PrimeFaces Selenium - Core

PrimeFaces testing support based on Selenium and the concept of page ojects / fragements.

License

License

Categories

Categories

PrimeFaces Jakarta EE The Web Tier Jakarta Server Faces
GroupId

GroupId

org.primefaces.extensions
ArtifactId

ArtifactId

primefaces-selenium-core
Last Version

Last Version

10.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

PrimeFaces Selenium - Core
PrimeFaces testing support based on Selenium and the concept of page ojects / fragements.

Download primefaces-selenium-core

How to add to project

<!-- https://jarcasting.com/artifacts/org.primefaces.extensions/primefaces-selenium-core/ -->
<dependency>
    <groupId>org.primefaces.extensions</groupId>
    <artifactId>primefaces-selenium-core</artifactId>
    <version>10.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.primefaces.extensions/primefaces-selenium-core/
implementation 'org.primefaces.extensions:primefaces-selenium-core:10.0.0'
// https://jarcasting.com/artifacts/org.primefaces.extensions/primefaces-selenium-core/
implementation ("org.primefaces.extensions:primefaces-selenium-core:10.0.0")
'org.primefaces.extensions:primefaces-selenium-core:jar:10.0.0'
<dependency org="org.primefaces.extensions" name="primefaces-selenium-core" rev="10.0.0">
  <artifact name="primefaces-selenium-core" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.primefaces.extensions', module='primefaces-selenium-core', version='10.0.0')
)
libraryDependencies += "org.primefaces.extensions" % "primefaces-selenium-core" % "10.0.0"
[org.primefaces.extensions/primefaces-selenium-core "10.0.0"]

Dependencies

compile (7)

Group / Artifact Type Version
javax.inject : javax.inject jar 1
org.junit.jupiter : junit-jupiter-engine jar 5.7.1
org.junit.jupiter : junit-jupiter-params jar 5.7.1
org.seleniumhq.selenium : selenium-api jar 3.141.59
org.seleniumhq.selenium : selenium-java jar 3.141.59
net.bytebuddy : byte-buddy jar 1.10.22
org.json : json jar 20210307

provided (1)

Group / Artifact Type Version
org.glassfish : jakarta.faces jar 2.3.14

Project Modules

There are no modules declared in this project.

Maven Javadocs License: MIT Actions Status Stackoverflow Discord Chat

primefaces-selenium

PrimeFaces testing support based on JUnit5, Selenium and the concept of page objects / fragments. It also supports JUnit5 parallel test execution to speed up tests.

PrimeFaces-Selenium provides a hook-in to either startup a local server, use a remote adress and to instantiate the WebDriver.

This is the successor of primefaces-arquillian and heavily inspired by Arquillian Graphene.

Configuration

PrimeFaces-Selenium requires a /primefaces-selenium/config.properties to set a PrimeSeleniumAdapter. A sample implementation, which starts a local TomEE, can be found here: TomEE Adapter and FireFox TomEE Adapter

Properties:

property name type default description
adapter org.primefaces.extensions.selenium.spi.PrimeSeleniumAdapter Adapter/Hook-In implementation class
guiTimeout int 2 GUI timeout for waits in seconds
ajaxTimeout int 10 AJAX timeout for guards in seconds
httpTimeout int 10 HTTP timeout for guards in seconds
documentLoadTimeout int 15 Document load timeout in seconds
disableAnimations boolean true If animations should be disabled for tests

Compatibility

Only tested on PrimeFaces 10.0.0+.

Status

Currently, only the following components are implemented (partially):

HTML

  • Link

JSF / PrimeFaces

  • AccordionPanel
  • AutoComplete
  • Calendar
  • CascadeSelect
  • Chips
  • CommandButton
  • CommandLink
  • ConfirmDialog
  • ConfirmPopup
  • DataList (use DataView)
  • DataTable
  • DatePicker
  • Dialog
  • InputMask
  • InputNumber
  • InputSwitch (use ToggleSwitch)
  • InputText
  • InputTextarea
  • Messages
  • OutputLabel
  • OverlayPanel
  • Panel
  • Password
  • Rating
  • Schedule
  • SelectBooleanCheckbox
  • SelectBooleanButton
  • SelectManyCheckbox
  • SelectOneButton
  • SelectOneMenu
  • SelectOneRadio
  • Slider
  • Spinner
  • TabView
  • TextEditor
  • Timeline
  • ToggleSwitch
  • TriStateCheckbox

Contributions are very welcome ;)

Usage

Creating component without annotations:

InputText input=PrimeSelenium.createFragment(InputText.class,By.id("test"));

Example view:

import org.openqa.selenium.support.FindBy;
import org.primefaces.extensions.selenium.AbstractPrimePage;
import org.primefaces.extensions.selenium.component.InputText;
import org.primefaces.extensions.selenium.component.SelectOneMenu;

public class IndexPage extends AbstractPrimePage {

    @FindBy(id = "form:manufacturer")
    private SelectOneMenu manufacturer;

    @FindBy(id = "form:car")
    private InputText car;

    public SelectOneMenu getManufacturer() {
        return manufacturer;
    }

    public InputText getCar() {
        return car;
    }

    @Override
    public String getLocation() {
        return "index.xhtml";
    }
}

Example test:

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.primefaces.extensions.selenium.AbstractPrimePageTest;

public class IndexPageTest extends AbstractPrimePageTest {

    @Inject
    private AnotherPage another;

    @Test
    public void myFirstTest(IndexPage index) throws InterruptedException {
        // right page?
        Assertions.assertTrue(index.isAt());
        assertNotDisplayed(index.getCar());

        // just to follow the browser with a human eye for the showcase :D - not need in your real tests
        Thread.sleep(2000);

        // select manufacturer
        assertDisplayed(index.getManufacturer());
        index.getManufacturer().select("BMW");
        Assertions.assertTrue(index.getManufacturer().isSelected("BMW"));

        // just to follow the browser with a human eye for the showcase :D - not need in your real tests
        Thread.sleep(2000);

        // type car
        assertDisplayed(index.getCar());
        index.getCar().setValue("E30 M3");

        // just to follow the browser with a human eye for the showcase :D - not need in your real tests
        Thread.sleep(2000);

        another.goTo();
        
        ...
    }
}

Build & Run

  • Build by source mvn clean install

Releasing

  • Run mvn versions:set -DgenerateBackupPoms=false -DnewVersion=8.0.5 to update all modules versions
  • Commit and push the changes to GitHub
  • In GitHub create a new Release titled 8.0.5 to tag this release
  • Run mvn clean deploy -Prelease to push to Maven Central
org.primefaces.extensions

PrimeFaces Extensions

Additional JSF 2 components and utilities for PrimeFaces

Versions

Version
10.0.0
8.0.5
8.0.4
8.0.3
8.0.2
8.0.1
8.0.0