Code Monkey home page Code Monkey logo

invictum-test's People

Contributors

eliogrin avatar invictum avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

jalona andyglick

invictum-test's Issues

Multilayer panels. (Panels inside other panel)

Example: I have search result page with big count of filters. I create sidebar panel, which one include all possible filters. Each filter is separate panel.
So I will get access to panel something like that:
getPanel(SidebarPanel.class).getPanel(SomeFilter.class);

Is it possible to implement such functionality?

Ability to define iframe as panel

It is possible to build proxy around Frame Panels and provide switching during method interception.
Java cglib allows to do it via byte code manipulation.

Locators strategy usage rework

For now locator() method returns a string representation of related locator. This is acceptable, but limits us to unleash a full stack of By class power. To avoid it a small refactor required.

Add locatorValue(...) method to AbstractPanel and AbstractPage. It should works the same way as old locator(...) method.
Rework locator(...) it should return By locator rather than string representation.

All related classes should be updated:

  • Tricks.
  • Floatting panel.
  • Related tests.

This should be implemented only in version 1.0+ because it will possible brake backward compatibility with 0.1.x versions.

Get back possibility to work with abstract page and panels without yaml

1st case:
HomePage extends AbstractPage (wich one without yaml file) we will get exception:

[main] ERROR com.github.invictum.utils.ResourceProvider - Unable to find 'AbstractPage.yaml' in '/target/test-classes/locators' directory

net.thucydides.core.pages.WrongPageError: The page object class com.*.pages.HomePage looks dodgy:
Failed to instantiate page (java.lang.IllegalStateException)
at com.github.invictum.EnhancedSerenityRunner.methodInvoker(EnhancedSerenityRunner.java:59)

2nd case:
HeaderPanel extends AbstractPanel (wich one without yaml file) we will get exception:

[main] ERROR com.github.invictum.utils.ResourceProvider - Unable to find 'AbstractPanel.yaml' in '/target/test-classes/locators' directory
java.lang.IllegalStateException
    at com.github.invictum.utils.ResourceProvider.getFile(ResourceProvider.java:36)
    at com.github.invictum.unified.data.provider.parsers.YamlParser.load(YamlParser.java:25)
    at com.github.invictum.unified.data.provider.UnifiedDataProviderFactory.mergeLocators(UnifiedDataProviderFactory.java:26)
    at com.github.invictum.unified.data.provider.UnifiedDataProviderFactory.getInstance(UnifiedDataProviderFactory.java:42)
    at com.github.invictum.panels.AbstractPanel.<init>(AbstractPanel.java:26)
    at com.*.panels.AbstractPanel.<init>(AbstractPanel.java:6)

3rd case:
HeaderPanel extends AbstractPanel (wich one with yaml file but without locators in it)

java.lang.NullPointerException
    at com.github.invictum.unified.data.provider.UnifiedDataProviderFactory.mergeLocators(UnifiedDataProviderFactory.java:27)
    at com.github.invictum.unified.data.provider.UnifiedDataProviderFactory.getInstance(UnifiedDataProviderFactory.java:42)
    at com.github.invictum.panels.AbstractPanel.<init>(AbstractPanel.java:26)
    at com.*.panels.AbstractPanel.<init>(AbstractPanel.java:6)
    at com.*.panels.HeaderPanel.<init>(HeaderPanel.java:5)

Add ability to use jQuery selectors

It will be good to have ability to work with jQuery selectors. These will allow to deal with modern ugly UI tricks related to several elements with the same locators on the page in different visibility state.

Mechanics
Add LocatorProvider interface and service loader for it. It will allow to implement quantified locators (i. e. "jquery = div.class:visible"). Work with set of available locator providers should be added to LocatorFactory.

Classes hierarchy
LocatorProvider interface with two methods isAcceptableTo(String) and wrap(String).
JqueryLocatorProvider class that allows to construct jquery selectors.

Implement element wait trick

Trick should allow to check element visibility and invisibility with specified parameters.
It may be based on Visibility trick.

Refactor PanelFactory

Clean up PanelFactory with logic related to init strategies. These logic should be moved to separate util class.
Related unit tests also should be updated.

Introduce ability to disable Panel Init Strategy wait for specified panels

For now PanelFactory implements following init logic:

  • init panel;
  • apply global Panel Init Strategy;
  • if present apply local init strategy (@WhenPanelInit annotation method)
    But for some situations it is not acceptable. I assume we should implement ability to disable global panel init strategy for specified panels.

Use case
Application under test consists of two parts: frontend and backend. Let's assume frontend UI is powered by jQuery lib and backend is pure HTML. To deal with frontend WaitForJquery strategy was configured. In one of test cases work with both frontend and backend is required. But during init of panels on backend test fails, because of jQuery lib absence. Disabling solution will help to avoid its.

Mechanics
During panels init its class should be tested by presence of special annotation. If annotation present, global panel init strategy invoking should be skipped. This logic should be provided in PanelFactory.

Clases hierarchy
DisableGlobalInitStrategy - annotation (applicable only on class level)

Package com.github.invictum.panels

Move Unified Data Provider Parser and Panel Init Strategy settings to configuration level

Let's move Unified Data Provider Parser and Panel Init Strategy settings to configuration level. This solution make ability to avoid configuring specified parameters on luncher level.

Mechanics
UnifiedDataProviderFactory and PanelFactory get related configuration during init. Old methods should remain to give ability to override parameters from code.

Changes required

  • add two extra enum values with defaults to EnhancedSystemProperty (e. g. data.provider.parser = com.github.invictum.unified.data.provider.parsers.YamlParser, panel.init.strategy = com.github.invictum.panels.strategy.NoWaitStrategy)
  • update UnifiedDataProviderFactory to use data.provider.parser option on init.
  • update PanelFactory to use panel.init.strategy option.

Implement floating panel

Floating Panel will contain a few elements on page as usual panel, but doesn't have a base locator. So it isn't locked to root element.

Add ability to use Fixtures in jUnit style tests

For now fixtures functionality is available only for jBehave style tests, let's make it available for jUnit also.

Mechanics
To apply fixture for test special annotation with fixture details should be specified for test method. Fixture will be applied before method and rolled back after it. To apply several fixtures fixture container should be used.
Fixtures execution and restoring should be implemented in scope of EnhancedSerenityRunner class.

Classes hierarchy
Fixture - annotation for fixture. Defines two values: fixture class and optional array of string parameters.
Fixtures - annotation for several fixtures. Defines an array of Fixture annotations.

Package com.github.invictum.fixture

Wrong package settings configuration impacts on performance

If following settings set wrong Reflection start to scan whole project and maven classes:

  • pages.package.name;
  • panels.package.name;
  • fixtures.package.name;

Issue is also reproduced for default settings values because actually they is wrong.

Extract default url key value to properties level

Now DEFAULT_URL_KEY is defined in UrlUtil as constant value (i. g. default). After moving it to configuration level it should be possible to unleash tests run against different url patterns without tests code modification.

Page suffix should be configurable for usage in PageNavigationSteps

For now page suffix is hardcoded to "Page" value, as a result navigation is used in non intuitive way.
Let's assume HomePage.java is present, to open it following code should be used:

pageNavigationSteps.openPage("Home");

Let's move prefix to configuration level with empty default value.

Mechanics
Add to EnhancedSystemProperty one extra property page.navigation.suffix with default value equals to empty string.
Reuse this property value in PageNavigationSteps class.

Implement Safe Picker component

Safe Picker could be implemented as Trick.
It should allow to get data for DTO gracefully (w\o throwing Managed Serenity Exception).

Locator merge during Pages and Panels inheritance

For now it is possible to extend any Panel or Page, but locators are still isolated into classes and inheritance doesn't reflect on it.

Mechanics
On init stage collect locators from parents up to AbstractPanel \ AbstractPage. Merge all locators into final UnifiedDataProvider on child level. If locator keys are equals on parent and child, child should be used as high priority.

Possibility to get list of panels

Example: I have search result page, where each result is separate panel. I need functionality to get list of panels, for example:
getAllPanels(SearchResult.class)[1].getSize();
or

for (SearchResult result in getAllPanels(SearchResult.class)) {
    //do some stuff;
}

Is it possible to implement such functionality?

Xpath detected wrong for some expressions

Xpath detection applies wrong for a/div expression. Specified text is determinated as valid xpath. But shouldn't.
The root cause is that "." isn't escaped in regexp in isXpath(...) method in AbstractPage class.

Remove rest enhancement from core

Following classes and related tests should be removed:

  • Rest
  • RestProfile
  • ProfileManager

It is much better to use native rest-assured or serenity-rest to invoke with API. So specified classes should be removed.

Introduce DTO attribute converters

Attribute converters will allow to represent as String any data annotated by @DtoAttribute. This approach helps to avoid routine with types casting in AbstractDto class.

Mechanics
On each attempt to represent attribute as String all available converters will be tested against compatibility to attribute type. If converter is compatible, convert method will be invoked.
To get a list of available converters (all classes that implement AttributeConverter interface) Reflection could be used. This logic should be isolated in separate static class.
To extend available functionality it is enough to implement AttributeConverter interface with custom converter implementation.

Class hierarchy

  • AttributeConverterUtil - static class with single method that return a list of available converters.
  • AttributeConverter - interface (defines two methods isTypeCompatible() and convert()).
  • IntegerConverter - class implements AttributeConverter.
  • StringConverter - class implements AttributeConverter.
  • FloatConverter - class implements AttributeConverter.
  • AbstractDtoConverter - class implements AttributeConverter (for nested DTO case).
  • DoubleConverter - class implements AttributeConverter.
  • BooleanConverter - class implements AttributeConverter.
  • ListConverter - class implements AttributeConverter.

Package com.github.invictum.dto.converters

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.