GithubHelp home page GithubHelp logo

epam / jdi Goto Github PK

View Code? Open in Web Editor NEW
143.0 71.0 109.0 69.03 MB

Try JDI Light https://github.com/jdi-testing/jdi-light

License: GNU General Public License v3.0

Java 63.53% XSLT 0.22% C# 20.26% Groovy 6.41% CSS 2.97% HTML 0.67% JavaScript 0.06% Batchfile 0.01% Gherkin 0.27% Python 5.61%

jdi's Introduction

JDI UI Test Automation Framework

Test framework is deprecated
Plaease see new more powerful version JDI Light
About new features you can read in documentation
If you would like to try JDI Light then pass our tutorials

<dependency>
    <groupId>com.epam.jdi</groupId>
    <artifactId>jdi-light-html</artifactId>
    <version>RELEASE</version>
</dependency>

jdi's People

Contributors

akiofaris avatar alexarm avatar alinablazhko avatar andrey-ryoo avatar anna-belemenko-epam avatar anyayu avatar artsiomch avatar crash1048576 avatar dmitriisemenov avatar elv1s42 avatar epam-roman-iovlev avatar funcat avatar grebnat avatar iteaky avatar ivanoviurii avatar kelinnik avatar konstantinpulin avatar lomdjaria1 avatar lyubenkov avatar marwellazure avatar mefateah avatar naryadchikov avatar nehhen avatar roma0297 avatar romaniovlev avatar sergeybp avatar spbqa avatar vertin avatar walrus94 avatar wujianyy 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  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  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  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  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  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  avatar  avatar  avatar

jdi's Issues

"Displayed" property always return false for iframes.

It is necessary to check that iframe exists and displayed. Perhaps there is another way.
Below is an example.

namespace JDI_Tests.Tests.W3C
{
    [TestFixture]
    public class FrameTests
    {
        [OneTimeSetUp]
        public void Init()
        {
            WebSettings.InitNUnitDefault();
            WinProcUtils.KillAllRunWebDrivers();

            if (!JDISettings.DriverFactory.HasDrivers())
                WebSettings.UseDriver(DriverTypes.Chrome);

            WebSite.Init(typeof(W3CSite));
            W3CSite.W3CPage.Open();
        }

        [Test]
        public void FrameTest()
        {
            W3CSite.W3CPage.IsOpened();

            bool isDisplayed = W3CSite.W3CPage.Frame.Displayed; // always returns false

            W3CSite.W3CPage.Frame.CSS.Click();
        }
    }

    [Site(Domain = "http://www.w3schools.com/", DemoMode = false)]
    public class W3CSite : WebSite
    {
        [Page(Url = "http://www.w3schools.com/html/html_iframe.asp")]
        public static W3CPageWithFrame W3CPage;
        [Page(Url = "http://www.w3schools.com/html/html_tables.asp")]
        public static TablePage TablePage;
    }

    public class W3CPageWithFrame : WebPage
    {
        [Frame(ByXPath = "//iframe[@src='default.asp']")]
        public ExampleFrame Frame;
    }
    public class TablePage : WebPage
    {
        [FindBy(Id = "customers")]
        public Table<CompanyInfo> Companies = new Table<CompanyInfo> { RowFrom = 2 };
        [FindBy(Id = "customers")]
        public Table<CompanyInfoShort> CompaniesShort = new Table<CompanyInfoShort> { RowFrom = 2 };
    }

    public class ExampleFrame : Section
    {
        [FindsBy(How = How.LinkText, Using = "CSS")]
        public Link CSS;
    }
}

[Feature] Add verify layout functionality

It is possible to compare current layout of application vs image using Sikuli
Add method to WebPage which compares current scrren with specified image file like

homePage.verifyLayout("image/homepage.jpeg")

Detailed instructions for Java sample tests

We need step-by-step instructions to run sample tests. For me (as a developer who deals with Java not very often) it it was slightly harder to run them than:

just download this simplest Java example and run test

It turned up not so obvious to run Maven, and I had to google its syntax.

[Feature] Implement Xml log format

It will be good to have logs in xml format so user can easily collapse and expand details for each step

e.g.

Fill login form
Input 'admin' in login field
Find element by css '.login'

Input 'P@ssword' in password field
Find element by css '.psw'

code for this should look like:

public static void main()
{ log.info("Fill login form", () -> fillForm()); }
public static void fillForm()
{ fillField("login", "login"); fillField("password", "P@ssword"); }
public static void fillField(String field, String value)
{ log.info(format("Input '%s' in login field", value), () -> find(field)); }
public static void find(String field)
{ log.info(format("Find element by css '%s'", value == login ? ".login" : ".psw")); }

Add integrated performance and statistic in JDI framework

Implement Performance and statistic module.
Integrate getting time from methods in Action Scenarios

Calculate following metrics:

  1. Average time for all JDI actions
  2. Max time and name of action
  3. List of actions takes more than specified time (e.g. 10 seconds)
  4. Total amount of JDI actions performed
  5. Average and max time for each type of element and action

Update C# version to 1.0.70 - synchronze jdi-web - main

Java-version build fails on Travis CI

Full log is here.

[INFO] Compiling 83 source files to /home/travis/build/epam/JDI/Java/JDI/jdi-uitest-web/target/classes
An exception has occurred in the compiler (1.8.0_31). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
java.lang.NullPointerException
at com.sun.tools.javac.code.Types.isConvertible(Types.java:290)
at com.sun.tools.javac.comp.Check.assertConvertible(Check.java:922)
at com.sun.tools.javac.comp.Check.checkMethod(Check.java:876)

Overall build information:

[INFO] EPAM UI Test Framework ................................ SUCCESS [ 4.403 s]
[INFO] jdi-commons .................................................... SUCCESS [ 6.296 s]
[INFO] EPAM JDI UI Testing Framework Core ............ SUCCESS [ 1.179 s]
[INFO] jdi-matchers ..................................................... SUCCESS [ 4.566 s]
[INFO] EPAM JDI UI Testing Web ................................ FAILURE [ 9.233 s]
[INFO] jdi-uitest-mobile ................................................ SKIPPED
[INFO] jdi-uitest-gui ...................................................... SKIPPED
[INFO] EPAM JDI UI Testing Unit tests ......................... SKIPPED
[INFO] EPAM JDI UI Testing Tutorial Tests .................. SKIPPED
[INFO] EPAM JDI UI Testing Unit tests ......................... SKIPPED
[INFO] jdi-uitest-mobiletests ......................................... SKIPPED
[INFO] jdi-uitest-guitests ............................................... SKIPPED
[INFO] EPAM JDI UI Testing Unit tests ......................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE

C#, do not work frames functionality.

Examle:

The page: http://www.w3schools.com/html/html_iframe.asp
The frame on this page: http://www.w3schools.com/html/default.asp

I'm trying to click the menu item 'Bootstrap' inside the frame, but the library click the menu item 'Bootstrap' from the original page.

Sample code:

`

[Test]
public void FramesTest()
{
    W3CSite.W3CPageWithFrame.Open();
    W3CSite.W3CPageWithFrame.Frame.BootstrapMenuItem.Click();
}

[Site(Domain = "http://www.w3schools.com/", DemoMode = false)]
public class W3CSite : WebSite
{
    [Page(Url = "http://www.w3schools.com/html/html_iframe.asp")]
    public static W3CPageWithFrame W3CPageWithFrame;
}

public class W3CPageWithFrame : WebPage
{
    [Frame(ByXPath = "//iframe[@src='default.asp']")]
    public ExampleFrame Frame;
}

public class ExampleFrame : Section
{
    [FindsBy(How = How.LinkText, Using = "BOOTSTRAP")]
    public Link BootstrapMenuItem;
}

`

c414b-clip-202kb

Custom driver initialization

Please, do not use enum DriverTypes. It would be better to have an interface for WebDriver loading, some classes responsible for common WebDriver launching (FF, Chrome, IE) and some kind of method to add user classes implementing the interface.
There are requests for Linux Chrome support, custom grid. Also I couldn't use you FF implementation because of a browser plugin required on my service. All that extensions could be implemented by users without library changing.

[Feature] Improve logging - Alex Lyubenkov

We need to improve current realization of framework logging layers in order to give more abilities for user to get only necessary info

Verify logging on Examples.
Include Allure reports logging in observation

Anna Belemenko

PropertyReader.readProperties() method never throws IOException

com.epam.commons.PropertyReader:
the method catches all the exceptions and doesn't throw IOException

here is the method definition
private static Properties readProperties() throws IOException {
properties = new Properties();
try {
inputStream = PropertyReader.class.getResourceAsStream(getCorrectPath());
if (inputStream != null)
properties.load(inputStream);
} catch (Exception ex) {
if (inputStream != null) inputStream.close();
}
return properties;
}

Do not throw away parent search context

componentA.parent = null;
componentA.avatar.byLocator = someLocator;
componentA.someButton.click();

AR:
someButton.searchContext == null

ER:
someButton.searchContext == componentA.avatar.byLocator

NOTES:
searchContext is not null ONLY IF all parents are not null

The problem is here:
if(element != null && ReflectionUtils.isClass(element.getClass(), BaseElement.class) && ((p = (el = (BaseElement)element).getParent()) != null || el.avatar.frameLocator != null)) {

Problem with cascade initialization.

I have made following structure of elements:

 Elements<class1>
    in class1: Elements<class2>
        in class2: Elements<class3>

And when I try to get any element from class3, framework can't go out from the recursion during cascade initialization.

[C#] WaitRows method is stuck with Thread.Sleep in parallel

Scenario:
Run for example the WaitRowsTest test from JDI_UIWebTests/Tests/Complex/Table/WaiterTests.cs

HomePage.IsOpened();
Task.Run(() =>
{
	Thread.Sleep(1);
	SupportPage.IsOpened();
});
Assert.IsTrue(Table.WaitRows(6));

Actual result: The test is stuck until an exception in Assert.IsTrue is thrown.
Expected result: The test should be passed (HomePage is opened and WaitRows method waits until SupportPage is loaded and returns true)

Additional information: Test works fine without Thread.Sleep() method. Thest works fine in Java implementation.

Methods select and getSelected for ComboBox element don't work.

select(any_string) returns

java.lang.RuntimeException: java.lang.RuntimeException: java.lang.AssertionError: 'Value' element for dropdown not defined
    at com.epam.commons.Timer.wait(Timer.java:128)
    at com.epam.commons.Timer.alwaysDoneAction(Timer.java:90)
    at com.epam.jdi.uitests.web.selenium.elements.actions.ActionInvoker.doJAction(ActionInvoker.java:74)
    at com.epam.jdi.uitests.web.selenium.elements.actions.ActionInvoker.doJAction(ActionInvoker.java:70)
    at com.epam.jdi.uitests.web.selenium.elements.actions.ElementsActions.select(ElementsActions.java:150)
    at com.epam.jdi.uitests.web.selenium.elements.complex.Selector.select(Selector.java:50)

getSelected() returns NullPointerException.

SmokeTest - java.lang.AssertionError: Do action Select 'CAREERS' failed

I have

java.lang.RuntimeException: java.lang.AssertionError: Do action Select 'CAREERS' failed. Can't get result. Reason: java.lang.AssertionError: Can't find option 'CAREERS'. Please fix allLabelsLocator

	at com.epam.commons.Timer.wait(Timer.java:128)
	at com.epam.commons.Timer.alwaysDoneAction(Timer.java:90)
	at com.epam.jdi.uitests.web.selenium.elements.actions.ActionInvoker.doJAction(ActionInvoker.java:73)
	at com.epam.jdi.uitests.web.selenium.elements.actions.ActionInvoker.doJAction(ActionInvoker.java:69)
	at com.epam.jdi.uitests.web.selenium.elements.actions.ElementsActions.select(ElementsActions.java:149)
	at com.epam.jdi.uitests.web.selenium.elements.complex.Selector.select(Selector.java:55)
	at com.epam.jdi.uitests.web.selenium.elements.complex.Selector.select(Selector.java:63)
	at org.mytests.tests.SmokeTest.oneActionTest(SmokeTest.java:46)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
	at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
	at org.testng.TestRunner.privateRun(TestRunner.java:767)
	at org.testng.TestRunner.run(TestRunner.java:617)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
	at org.testng.SuiteRunner.run(SuiteRunner.java:240)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
	at org.testng.TestNG.run(TestNG.java:1057)
	at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:72)
	at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:124)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: java.lang.AssertionError: Do action Select 'CAREERS' failed. Can't get result. Reason: java.lang.AssertionError: Can't find option 'CAREERS'. Please fix allLabelsLocator
	at org.testng.Assert.fail(Assert.java:94)
	at com.epam.web.matcher.base.BaseMatcher.assertException(BaseMatcher.java:194)

Running on MacBook Pro (Retina, 13-inch, Early 2015)
I think it's because of screen size
2017-01-31 22 53 03
When I uncomment #browser.size=1800X1000 its start working

firefox driver is not loaded by default - Dmitry Dobrolubov

Hello,

Version: com.epam.jdi:jdi-uitest-web:1.0.58

STR:

  1. Open main example from https://github.com/epam/JDI-Examples/archive/master.zip
  2. modify test.properties
driver=firefox
driver.getLatest=true
  1. Run tests

Actual result:

[ThreadID: 10]Can't get driver; Thread: 10
Drivers: FIREFOX:com.epam.jdi.uitests.web.selenium.driver.SeleniumDriverFactory$$Lambda$8/1859039536@53f282db; Run: java.lang.ThreadLocal@29b13258Exception: The driver executable does not exist: /home/mike/Downloads/JDI-Examples-master/src/main/resources/driver/geckodriver.exe
[ThreadID: 1]Test run finished. 

Expected result: gecko driver should be loaded and tests successfully started

Going through the sources, I notified that gecko driver is not being loaded at all. Also, the following thing is strange:

from SeleniumDriverFactory:
...
    // GET DRIVER
    protected String registerLocalDriver(DriverTypes driverType) {
        switch (driverType) {
            case CHROME:
            ...
            case FIREFOX:
                return registerDriver(driverType,
                        () -> {
                            DesiredCapabilities capabilities = internetExplorer(); <<<<
                            capabilities.setCapability(PAGE_LOAD_STRATEGY, pageLoadStrategy);
                            setProperty("webdriver.gecko.driver", getFirefoxDriverPath(driversPath));
                            return webDriverSettings.apply(new FirefoxDriver(capabilities));
                        });
            case IE:
...

Please check and fix

Support for models with inheritance in form.fill()

class ModelBase{
String fieldA;
}
class MyModel extends ModelBase{
String fieldB;
}
MyModel model = new MyModel();
model.fieldA = "A";
model.fieldB = "B";
form.fill(model);

AR:
Only fieldB is set in web interface.

ER:
Both fieldA and fieldB are set in web interface.

NOTE:
ReflectionUtils.getFields does not return fields from inheritance chain. That is the reason of the problem.

Support local chrome webdriver in Linux

Currently the framework uses non cross-platform slashes in path names, so the framework can be used only under Windows in local mode (run.type = LOCAL)
It prevents me from using local chrome web-driver, and consequently from using the framework at all.

Improve logging of page objects initialization failures

AR:
If some field in page object is initialized incorrectly, framework throws an exception:
java.lang.AssertionError: Error in getElementInstance for field 'table' with type 'CustomTable
customelements.CustomTable'

ER:
Sometimes it is hard to find incorrect field in page object having only field name and field type.
Page object class/component class should be also logged.

The latest versions of the library do not work with Microsoft UnitTestFramework.

The library is Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll

I just replaced attributes from the "nunit.framework" library on the attributes from the "UnitTestFramework" library.

  • TestFixture - > TestClass
  • OneTimeSetUp -> TestInitialize
  • OneTimeTearDown -> TestCleanup
  • Test -> TestMethod

As a result, the browser(chrome) does not open and the errors do not appear.

The final code:

using JDI_Web.Attributes;
using JDI_Web.Selenium.Elements.Common;
using JDI_Web.Selenium.Elements.Composite;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium.Support.PageObjects;

namespace JDI_Tests.Scenarios.Tests
{
    [TestClass]
    public class FrameTests : TestsBase
    {
        [TestMethod]
        public void FrameTest()
        {
            W3CSite.W3CPage.Open();
            W3CSite.W3CPage.Frame.CSS.Click();
        }
    }

    [Site(Domain = "http://www.w3schools.com/", DemoMode = false)]
    public class W3CSite : WebSite
    {
        [Page(Url = "http://www.w3schools.com/html/html_iframe.asp")]
        public static W3CPageWithFrame W3CPage;
    }

    public class W3CPageWithFrame : WebPage
    {
        [Frame(ByXPath = "//iframe[@src='default.asp']")]
        public ExampleFrame Frame;
    }

    public class ExampleFrame : Section
    {
        [FindsBy(How = How.LinkText, Using = "CSS")]
        public Link CSS;
    }
}

Write Selenium tests on JDI

Implement test on Selenium but under JDI (switch dependency from Selenium to jdi-uitests-web)

  1. Create new empty project
  2. Write JDI Examples using only Selenium (no JDI)
  3. Add JDI package and remove Selenium (change packages) see is this test still work

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.