Git Product home page Git Product logo

primefaces-selenium's Introduction

Maven Javadocs License Actions Status Stackoverflow

primefaces-selenium

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

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

Compatibility

Only tested on PrimeFaces 8.0+.

Status

Currently only the following components are implemented (partially):

HTML

  • Link

JSF / PrimeFaces

  • AccordionPanel
  • AutoComplete
  • Calendar
  • Chips
  • CommandButton
  • CommandLink
  • DataList
  • DataTable
  • DatePicker
  • Dialog
  • InputMask
  • InputNumber
  • InputSwitch
  • InputText
  • InputTextarea
  • Messages
  • Panel
  • SelectBooleanCheckbox
  • SelectBooleanButton
  • SelectManyCheckbox
  • SelectOneButton
  • SelectOneMenu
  • SelectOneRadio
  • Slider
  • Spinner
  • TabView
  • TextEditor
  • ToggleSwitch
  • TriStateCheckbox

Contributions are very welcome ;)

Usage

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

primefaces-selenium's People

Contributors

christophs78 avatar dependabot[bot] avatar melloware avatar tandraschko avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.