invictum / invictum-test Goto Github PK
View Code? Open in Web Editor NEWAutomation framework based on Serenity BDD project
License: Apache License 2.0
Automation framework based on Serenity BDD project
License: Apache License 2.0
Let's move parser setting to configuration level (i. g. data.provider.source = PATH_TO_CLASS).
Default value should be Yaml parser.
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?
Affected items:
Configuration should be defined on suite runner level.
It will be great if we write provide some information to user about necessity to provide pages and panels package if user don't configure this.
Now getParam() method in AbstractFixture throws an exception during attempt to get non defined parameter. I think it would be great to make it more safe. Let's tweak AbstractFixture a little.
getParam() method should return null (or custom default) for non-existing parameters.
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.
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:
This should be implemented only in version 1.0+ because it will possible brake backward compatibility with 0.1.x versions.
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)
Serenity core version should be extracted in separate variable and moved to parent pom.
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.
Trick should allow to check element visibility and invisibility with specified parameters.
It may be based on Visibility trick.
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.
For now PanelFactory implements following init logic:
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
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
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.
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
If following settings set wrong Reflection start to scan whole project and maven classes:
Issue is also reproduced for default settings values because actually they is wrong.
There are several constant setted to implicit waiting. It's better to rewrite without it.
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.
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.
Related files and tests should be updated.
It will be great if we will provide possibility to check visibility of panel. So user can do some asserts, for example.
Override @url meta.
Implement ability to open pages via page class.
It will allow Page Navigation Steps to manage page opening in more robust way.
Let's make ability to pick element in scope of other elements.
Safe Picker could be implemented as Trick.
It should allow to get data for DTO gracefully (w\o throwing Managed Serenity Exception).
Move locator(...) method logic to separate class LocatorFactory. Also isXpath(..) method should be moved here.
Update related unit tests.
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.
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 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.
Following classes and related tests should be removed:
It is much better to use native rest-assured or serenity-rest to invoke with API. So specified classes should be removed.
For now locators file extensions is .yaml, but should be .yml
Create an archetype of simple jUnit style project tests.
Resource provider should allow to use Panels and Pages with any unique names.
Example: LoginPanel and CustomerLoginPanel should work in the same time.
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
Package com.github.invictum.dto.converters
Let's make able construct DTOs from yml files.
new Dto().fromFile("file.yml");
new Dto().fromFile("file.yml", true);
This will allow to define project based init wait setting.
It will be really good if we can give possibility to avoid of setting default url if user want to get base url as a page url.
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.