epam / jdi Goto Github PK
View Code? Open in Web Editor NEWTry JDI Light https://github.com/jdi-testing/jdi-light
License: GNU General Public License v3.0
Try JDI Light https://github.com/jdi-testing/jdi-light
License: GNU General Public License v3.0
For Roman Iovlev
Go through key files in jdi-uitests-web package on Java and C#
And be sure that code are the same (functionally) in all files
https://github.com/epam/JDI/tree/master/Java/JDI/jdi-uitest-web/src/main/java/com/epam/jdi/uitests/web/selenium/elements/complex/table
All files
Anna Belemenko
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;
}
}
Go through key files in jdi-uitests-web package on Java and C#
And be sure that code are the same (functionally) in all files
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.
Some web applications could open several windows during work process. ScreenshotMaker doesn't support this feature right now.
Some functionality not work on Mac Os because of Mac specific
Run Jdi tests on Mac and fix all issues which occure
Note: priority starts from 1 highest and 4 lowest
Prioritized List of tests:
4. jdi-uitest-webtests
Add documentation for each element in common on Github Wiki
Structure:
Title
Few images of typical element examples
list of methods and examples of usage
Examples of element initialization
Go through all files in jdi-uitests-core package on Java and C#
And be sure that code are the same (functionally) in all files
Go through key files in jdi-uitests-web package on Java and C#
And be sure that code are the same (functionally) in all files
https://github.com/epam/JDI/tree/master/Java/JDI/jdi-uitest-web/src/main/java/com/epam/jdi/uitests/web/selenium/elements/complex
All files
Anna Belemenko
Add documentation for each element in complex on Github Wiki
Structure:
Title
Few images of typical element examples
list of methods and examples of usage
Examples of element 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.
Add documentation for each element in composite on Github Wiki
Structure:
Title
Few images of typical element examples
list of methods and examples of usage
Examples of element initialization
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")); }
The library is Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
I just replaced attributes from the "nunit.framework" library on the attributes from the "UnitTestFramework" library.
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;
}
}
We have examples project where Allure integrated as reporting.
https://github.com/epam/JDI-Examples
We need to copy this project.
Remove Allure and Replace it with Report Portal
https://github.com/reportportal/reportportal
Check that test run reports generates Successfuly
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
When I uncomment #browser.size=1800X1000
its start working
I think that getting framework settings from JSON file would be a useful feature.
Go through key files in jdi-uitests-web package on Java and C#
And be sure that code are the same (functionally) in all files
https://github.com/epam/JDI/tree/master/Java/JDI/jdi-uitest-web/src/main/java/com/epam/jdi/uitests/web/selenium/elements/common
All files Anna Belemenko
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;
}
`
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.
Implement JDI elements and tests on Python
start 01.06
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")
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
Some functionality not work on Mac Os because of Mac specific
Run Jdi tests on Mac and fix all issues which occure
Note: priority starts from 1 highest and 4 lowest
Prioritized List of tests:
2. jdi-uitest-tutorialtests
Hello,
Version: com.epam.jdi:jdi-uitest-web:1.0.58
STR:
driver=firefox
driver.getLatest=true
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
Go through key files in jdi-uitests-web package on Java and C#
And be sure that code are the same (functionally) in all files
https://github.com/epam/JDI/tree/master/Java/JDI/jdi-uitest-web/src/main/java/com/epam/jdi/uitests/web/settings
WebSettings.java
WebTimeoutSettings.java
https://github.com/epam/JDI/tree/master/Java/JDI/jdi-uitest-web/src/main/java/com/epam/jdi/uitests/web/selenium/driver
SeleniumDriverFactory.java
WebDriverByUtils.javao
WebDriverProvider.java Add
WebDriverUtils.java
https://github.com/epam/JDI/tree/master/Java/JDI/jdi-uitest-web/src/main/java/com/epam/jdi/uitests/web/selenium/elements
WebCascadeInit.java
https://github.com/epam/JDI/tree/master/Java/JDI/jdi-uitest-web/src/main/java/com/epam/jdi/uitests/web/selenium/elements/base
BaseElement.java
Element.java
https://github.com/epam/JDI/tree/master/Java/JDI/jdi-uitest-web/src/main/java/com/epam/jdi/uitests/web/selenium/elements/actions
ActionInvoker.java
ActionScenrios.java Add PageObjects
ElementsActions.java
https://github.com/epam/JDI/tree/master/Java/JDI/jdi-uitest-web/src/main/java/com/epam/jdi/uitests/web/selenium/elements/apiInteract
GetElementModule.java
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;
}
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.
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.
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.
Some functionality not work on Mac Os because of Mac specific
Run Jdi tests on Mac and fix all issues which occure
Note: priority starts from 1 highest and 4 lowest
Prioritized List of tests:
3. jdi-uitest-web-examples
Add documentation for each element in tables on Github Wiki
Structure:
Title
Few images of typical element examples
list of methods and examples of usage
Examples of element initialization
Implement Performance and statistic module.
Integrate getting time from methods in Action Scenarios
Calculate following metrics:
See this good solution and use it in JDI https://github.com/bonigarcia/webdrivermanager
Change files in https://github.com/epam/JDI/tree/master/Java/JDI/jdi-uitest-web/src/main/java/com/epam/jdi/uitests/web/selenium/driver
WebDriverProvider.java
SeleniumDriverFactory.java
Some functionality not work on Mac Os because of Mac specific
Run Jdi tests on Mac and fix all issues which occure
Note: priority starts from 1 highest and 4 lowest
Prioritized List of tests:
Start 06.06
Implement JDI Examples test on Selenide but under JDI (switch dependency from Selenium to jdi-uitests-web)
AFAIK since 2.23 they only have 64 bit.
see more http://chromedriver.storage.googleapis.com/index.html?path=2.23/
Currently run.type = REMOTE leads to using hard coded saucelabs.com/selenium/selenium-grid
Create Template project for allure with Cucumber with JDI similar to https://github.com/epam/JDI-Examples
Implement test on Selenium but under JDI (switch dependency from Selenium to jdi-uitests-web)
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
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.
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)) {
Implement Get Latest driver functionality for C# as n Java (Chrome, Firefox, IE)
https://github.com/epam/JDI/blob/master/Java/JDI/jdi-uitest-web/src/main/java/com/epam/jdi/uitests/web/selenium/driver/WebDriverProvider.java
Start 05.06
Check and fix killAllRunWebBrowsers() in WebDriverUtils.java for Mac
https://github.com/epam/JDI/blob/master/Java/JDI/jdi-uitest-web/src/main/java/com/epam/jdi/uitests/web/selenium/driver/WebDriverUtils.java
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.
Go through all tests in Java run them and be sure that all tests passed on 1.0.70 version
Fix issues if found
https://github.com/epam/JDI/tree/master/Java/Tests
jdi-uitest-tutorialtests
jdi-uitest-web-examples
jdi-uitest-webtests
Start 07.06
Implement main core functionality on Python
Start 15.05
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.