Coder Social home page Coder Social logo

finraos / jtaf-extwebdriver Goto Github PK

View Code? Open in Web Editor NEW
26.0 26.0 49.0 2.23 MB

Extensions for WebDriver is an enhancement to the powerful WebDriver API, with robust features that keep your browser automation running smoothly. It includes a widget library, improved session management and extended functions over the existing WebDriver API.

Home Page: http://finraos.github.io/JTAF-ExtWebDriver

License: Apache License 2.0

Java 97.63% HTML 2.37%

jtaf-extwebdriver's People

Contributors

benbunk avatar bryantrobbins avatar dpulitano avatar finraoss avatar hyaruixi avatar knappk avatar kood1 avatar mibrahim avatar mike-glorioso avatar mmlinford avatar na-na avatar opensource21 avatar smxjrz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jtaf-extwebdriver's Issues

Switch from log4j to slf4j

In our projects we use slf4j combined with logback. So we must now mixed two logframeworks (logback, log4j) in the same project. Migration should be an easy task.

Create unit tests for Properties classes

We need to create unit tests for the following classes:

  • org.finra.jtaf.ewd.impl.ClientProperties
  • org.finra.jtaf.ewd.properties.GUIProperties
  • org.finra.jtaf.ewd.properties.GUIHierarchyConcatenationProperties

SessionManager.setFactory is not working correctly

Currently, the use of DefaultSessionFactory is hard-coded in SessionManager.getInstance(), such that any custom SessionFactory previously registered with SessionManager.setSessionFactory(...) is discarded.

The relevant code from SessionManager.java can be seen in lines 71-73 here:
https://github.com/FINRAOS/JTAF-ExtWebDriver/blob/master/src/main/java/org/finra/jtaf/ewd/session/SessionManager.java

public static SessionManager getInstance() {
return sessionManager.get().setSessionFactory(new DefaultSessionFactory());
}

The fix is probably to have the SessionManager use its current sessionFactory variable here, which will require sessionFactory (which holds the current factory implementation registered with the SessionManager) to become a ThreadLocal because getInstance() is (and should be) static.

I will submit a pull request shortly.

NPE and conditional in DefaultExtWebDriver#selectPopupWindow

The conditional at line 295 currently checks for null, then if null checks for emptiness:

if (currentWindowIds == null && currentWindowIds.size() > 0) {...

This will throw a NullPointerException whenever currentWindowIds is null. Switching the operator from an AND to an OR should avoid the NPE.

The second condition doesn't completely make sense in the context of the method, possibly supposed to be testing for equality rather than for greater than.

NoSuchElementException when instantiating table widget when table isn't there

The constructor of org.finra.jtaf.ewd.widget.element.html.Table will throw a NoSuchElementException if the table does not exist because it calls generateXPathLocator(String locator). It should be possible to at least create the Table object and then later check .isElementPresent(), which is what happens with other widgets.

Add wrapper to avoid attempting to deploy pull request builds

The system which does our CI builds on commit (Travis CI) takes a custom command for deploy. Travis also has the nice feature of automatic "pull request builds" that kick off when a pull request is made.

According to Travis docs and our experience so far:

  • Travis does not make encrypted environment variables available to pull request builds - only to builds triggered by a commit to master.
  • As a result, pull request builds do not have authorization to deploy snapshots, which is a good, safe thing.
  • However, apart from the environment variable availability, pull request builds use the same Travis configuration for build and deploy steps. Because the deploy fails, the entire build fails.
  • Travis makes available an environment variable to help us out: TRAVIS_SECURE_ENV_VARS is set to "true" or "false" depending on the availability of [secure] environment variables.

Given all of that, we should probably wrap our Maven build step with a script that checks this environment variable and avoids deploying altogether if the variables are not available.

Reference:
http://about.travis-ci.org/docs/user/build-configuration/#Set-environment-variables

Remove unused code

Eclipse creates some warning about unused code. This should be removed except, you use it via reflection.

Create test suite for browser only tests

We need to create tests which only executes on a real browser instead of HtmlUnit only. For instance, we need to create tests for ExtWebDriver interface which deals with browser related activities such as back, forward, dialogs, popups. This suite should also include tests around mouse events such as drag and drop which doesn't run on HtmlUnit.

This suite needs to run against Sauce Labs instead of Travis CI.

loadColorMapRbg() is broken

It fails with a fatal error when highlight = somevalue is used because of the split statement, and also on highlight.GET, highlight.PUT, highlight.FIND = somecolor.

Also it seems that the ClientProperties readme on the github.io site has incorrect property names for the highlight color properties.

Allow a default locator to be set for String locators

With recent changes made to improve performance we should allow the setting of a default locator so that we people using the pre-existing locator constructors can get the most out of these changes (they can still have the ability to change locator for each widget by just providing the locator type)

Firefox profile properties ignored if binary path property is default

In org.finra.jtaf.ewd.impl.DefaultSessionFactory.createInnerDriver(Map<String,String>,DesiredCapabilities), lines 376-405:

else if ((browser.equalsIgnoreCase("firefox") || browser.equalsIgnoreCase("*firefox"))) {
        final String ffProfileFolder = properties.getFirefoxProfileFolder();
        final String ffProfileFile = properties.getFirefoxProfileFile();
        final String path = properties.getBinaryPath();

        if (path != null) {
            // Omitted: FirefoxBinary fireFox and FirefoxProfile ffp are created & configured 
            wd = new FirefoxDriver(fireFox, ffp, desiredCapabilities);
        } else {
            wd = new FirefoxDriver(desiredCapabilities);
        }
}

If the binary path is null, the factory creates a default FirefoxDriver and ignores your profile config.

The old EWD didn't require an explicit binary path to use a profile - is this change intended, or shall I fix it?

Setup tests to run against Sauce Labs

We need to have our build integration tests and browser only tests to run against Sauce Labs.

  1. We need to create an Open Sauce account
  2. Configure Travis CI to run the tests

Enabling element highlighting leads to infinite loop

From the code of Element.java in the ewd.element package, we have the following trace occurring in findElement when highlighting is enabled:

  • findElement calls highlight
  • highlight calls setBackgrounColor
  • setBackgroundColor calls eval
  • eval calls getWebElement
  • getWebElement calls findElement
  • etc.

We need to:

  • fix the code to avoid the infinite loop
  • add unit tests for highlighting functionality (not just find, but get and put highlighting as well -- see Element.java for uses of highlight(..) )

Remove CRLF in the repository

The following file have CRLF as line encoding. This should be Unix-Style LF
./src/test/java/org/finra/jtaf/ewd/widget/element/html/TableTest.java: ASCII C program text, with CRLF line terminators
./src/test/java/org/finra/jtaf/ewd/widget/element/html/HtmlListTest.java: ASCII C program text, with CRLF line terminators
./src/test/java/org/finra/jtaf/ewd/widget/element/html/InputTest.java: ASCII C program text, with CRLF line terminators
./src/test/java/org/finra/jtaf/ewd/widget/element/html/ImageTest.java: ASCII C program text, with CRLF line terminators
./src/test/java/org/finra/jtaf/ewd/session/SessionManagerTests.java: ASCII C program text, with CRLF line terminators
./src/test/java/org/finra/jtaf/ewd/session/DefaultSessionFactoryTests.java: ASCII C program text, with CRLF line terminators
./src/test/resources/test.properties: ASCII text, with CRLF line terminators
./src/test/resources/log4j.properties: ASCII text, with CRLF line terminators
./src/main/java/org/finra/jtaf/ewd/impl/ClientProperties.java: ASCII C program text, with CRLF line terminators
./src/main/java/org/finra/jtaf/ewd/session/SessionFactory.java: ASCII C program text, with CRLF line terminators

Add StringLocatorAwareBy and use it for ByLegacy

To allow projects currently using string locators to be backwards compatible, ByLegacy should extend StringLocatorAwareBy as mentioned in #70. String locator methods in Element classes should be deprecated.

Element should used the By-Statement

Element.java findElement is the most used method in the framework and it makes try and error to find the component, first xpath, then byId, then byName .....
This can creates wrong results and is definitely not the fastest way. The main way to find elements should be based on the By-class of selenium. The String location should only be there for backward compatibility..

Make Element Pluggable

Make the Element base class pluggable so that customizations can be made without having to override it.

Integrationtest should be marked

It would be good if all integration-test are marked. I see 2 solutions:

  1. By name-suffix *IntegrationTest
  2. With @Category annotation.

Add a ScreenshotComparison utility to the ExtWebDriver project

It will have a takeScreenshotOfLocator method which will take the following arguments:
String - locator of element to compare, String - relative folder path to which the bitmap_screenshot.png will be saved, File - control picture to compare against

There will also be an assertSimilar method which will take 2 BufferedImages and a double threshhold. An overloaded version will have a default threshhold of .85

  • This method will use a similarity algorithm which returns a double between 0 and 1 that asserts how similar the 2 pictures are

DragAndDrop should be in Element not in InteractiveElement

I can't find any reason, why it is in In InteractiveElement? You can DragAndDrop every WebElement.

Furtermore the code is to complicated

builder.dragAndDrop(this.getWebElement(), 
        new InteractiveElement(element.getByLocator()).getWebElement()).build().perform();

Should be

builder.dragAndDrop(this.getWebElement(), 
            element.getWebElement()).build().perform();

Need to investigate travis builds from forked repo

The deploy.sh script may not be sufficient for forked repos to run their builds on travis-ci. The script handles pull requests builds on original repo but forked repos run mvn deploy instead of mvn install. We may need to modify the script to do deploy only when the build originates from FINRAOS project.

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.