Git Product home page Git Product logo

bobcat's People

Contributors

3ndriu avatar arekwolk avatar basia-wulnikowska avatar danon9111 avatar dependabot-preview[bot] avatar kkarolk avatar malaskowski avatar mariuszkubis avatar mkrzyzanowski avatar mmanski avatar nowszy94 avatar piotr-wilczynski avatar rzasap avatar shaihuludus avatar twiernik avatar wszczepaniak avatar yohannesalazar 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

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

bobcat's Issues

Redesign abstract and publish page classes

Currently we have AbstractPage class which is applicable for Author instance and PublishPage which is applicable for Publish instance. Current naming convention is misleading, as in this approach AbstractPage should be renamed to AuthorPage. Maybe it would be good to introduce top-level AbstractPage class from which PublishPage and AuthorPage classes would inherit?

TouchUI improvements - allow to configure single field

Implementation of this issue enables to configure AEM TouchUI components field by field. There is no need to configure whole component from static, yaml-based configuration.

Example of Aem richtext component configuration using single dialog fields :

@Test
public void shouldRenderBoldedText() {

  //Assuming page is prepared earlier

  page.getParsys(parsys)
    .getComponent(COMPONENT_NAME)
    .openDialog()
    .setField("", FieldType.RICHTEXT.name(), "test test test")
    .setField("", FieldType.RICHTEXT_FONT_FORMAT.name(), "BOLD")
    .confirm();

     //Assertions here
}

JUnit Tests Rerun

We need a mechanism for re-run failed Junit tests.

  • @Retry annotation on method - method can be re-run after failure
  • number of reruns is defined as property: junit.reruns in property file. If property is not present in configuration then defaut value is 1
  • Field in @Retry annotation can overwrite junit.reruns value

RerunFailedTests fails when all tests are pass

We found some issue with RerunFailedTests feature. When all tests pass, RerunFailedTests throws "No tests were executed!" exception. We should check before starting RerunFailedTests, if failedTests.properties contains scenarios, and trigger RerunFailedTests only if they exist.

Extend gitignore file

We should extend gitignore file to contain:

  • everything that is covered in the github predefined file for Java
  • dev environment configs
  • log files
  • IDE-related files as project.iml, nb-configuration.xml etc.

Wrap TouchUi configs with an object

As for now the Map<String,List<FieldConfig>> is used for describing component configuration. We should wrap it with some object and provide convenient methods for using it

Sending keys to an active element doesn't work poperly

When dialog for component contains multiple rich text fields, switching to them, doesn't work as expected. The frame is being switched properly, but when sending keys using Actions without web element context the active element is not taken into account. This is most probably Selenium issue.

Implement loadable components bobcat way

Selenium provides: https://github.com/SeleniumHQ/selenium/wiki/LoadableComponent

We could have something like this in Bobcat - examples:

@PageObject
public HomePage {

  @LoadableComponent(css = "")
  private WebElement necessaryComponent;

}
@PageObject
public HomePage {

  @LoadableComponent(css = "", behavior = "visibility", timeout = "10" )
  private WebElement necessaryComponent;

}
@LoadableComponent(behavior = "condition")
public HomePage {

}
@PageObject
public HomePage {

  @LoadableComponent(behavior = "visibility", timeout = "10" )
  private Login login;

}

@PageObject(css='.className')
public class Login() {
}

``

Fix integration test errors

The following tests are failing:

  • com.cognifide.bdd.demo.aem.AemRichtextTest.richtextTest_alignRightButton (Chrome)
  • com.cognifide.bdd.demo.aem.AemRichtextTest.richtextTest_alignCenterButton (Chrome)
  • com.cognifide.bdd.demo.aem.AemRichtextTest.richtextTest_underlineButton (Chrome)
  • com.cognifide.bdd.demo.aem.AemRichtextTest.richtextTest_outdentButton (Chrome)
  • com.cognifide.bdd.demo.aem.AemImageTest.shouldSetImageValueByJavaScript (FF concurrent)
  • com.cognifide.bdd.demo.aem.AemTextAreaTest.testType (FF)

Fix aem archetypes

After changes in AbstractPage, AuthorPage etc. our aem archetypes: junit and bdd stopped work. They need to be fixed before release with bobcat 1.0.0

PageObject annotation improvement

There are some classes which need to contain currentScope web element which is visible as not used (like AemPathWindow). In order to make it more readable to the end user we should create such field internally for each class annotated with @PageObject annotation. In situation when someone would want to have control over this field it could be defined manually, then the modified @PageObject annotation should have no effect on this.

We can take a look at the Lombok (www.projectlombok.org) annotations implementation while working on this as it should be helpful.

ScenarioContext is AemClassic module dependent

Since TouchUI module is being integrated to Bobcat, please move ScenarioContext from AemClassic to some independent part. It is pure Cucumber functionality and shouldn't be part of Aem module.
Currently it is located: /bobcat/bb-aem-classic/src/main/java/com/cognifide/qa/bb/aem/dialog/configurer/ScenarioContext.java

Tests quarantine

We would like to have ability to put some tests to quarantine. When such test fails, the exception / message should be visible, but it should not alter the overall result of the build. The entire mechanism should be controlled through Report HTML view (adding, removing from quarantine etc.)

Page utility - new approach to page handling

Introduce a new way of handling pages by Bobcat - a Page utility in favor of sub-classing PublishPage and AuthorPage.

Rationale:

Current approach

At the moment, in Bobcat we have abstract classes like AuthorPage or PublishPage that provide WebDriver instance for navigation properties and contain properties for domains.
The current approach with managing different pages is to subclass these types of pages, inject or simply hardcode the path and add additional fields, like specific page objects. These last items are usually driven by tests itself, they are not necessarily related to the page structure, e.g.:

  • tests of Title component on PageA will result in having the Title injected in PageA;
  • tests on the same page with a Box component will result in adding Box field to PageA;
  • but when running tests on the same component on PageB will require having additional PageObject PageB created - potentially with no difference to the page structure.

In the end we're having multiple, redundant page objects being nothing else than wrappers for properties in specific use cases (as can be seen e.g. here: https://github.com/Cognifide/bobcat/blob/cb894457e92d3d02dbf146f682f35f1e52dc332a/bb-aem-integration-tests/src/main/java/com/cognifide/bdd/demo/po/product/CirclePage.java). Having such implementations indicates that we are recommending/suggesting this solution - while different projects have shown it is not being the most effective way of handling pages.

Additional few things worth considering / areas not addressed with the above approach:

  • we force inheritance with abstract classes
  • URL modifications like query strings or anchors are not easily handled with a fixed path
  • location != content - we have increasing number of Single-Page-Applications, where path of the current page has nothing to do with its content, same goes for content being modified by query strings/anchors - same URL means operating on different PageObjects based on the current * context/state of the application
  • automating authoring tests often is done on 'generic' pages - URL is a secondary property, we care only about currently needed parsys
  • it's not clear how switching between Edit/WcmModeDisabled or other modes should be done - same goes visiting same page on author/publish
  • in Cucumber tests, current page is more of a secondary concern - we usually operate on correctly scoped PageObjects related to sections/components/elements of the page, not the whole page itself
  • we keep paths for given pages in config files (like in the latest TouchUI module), approach driven by Cucumber (need of having human-readable keys for a given page)
  • redirects are problematic with PageObject-driven way (should the redirecting PageObject wait for the being redirected to or the other way around? how to pass paths between these two?)

Based on the above, Bobcat does not provide a clear guidance on how to approach page handling.

Proposed approach

Page utility

In favor of abstract classes, we could provide an extendable utility that would handle navigation and obtaining content.
Base assumptions:

  • contain required objects like WebDriver,
  • handle property injection
  • remember the state / handle redirects etc.
  • allow simple switching between different AEM modes
  • allow overriding/customization of the allowed items or actions

Example API

Opening pages

// based on path
Page.on(PUBLISH).path("/content/test/node").open();

// based on config, e.g pages.yml:
// Test page:
//    - path: /content/test/page
Page.on(AUTHOR).named("Test page").open();

// with query string
Page.on(PUBLISH).path("tested page").query().open();

// custom env
Page.on("192.168.1.2:6103").path("/content/test/node").open();

// handling protocols
Page.protocol(HTTPS).on(PUBLISH).path("/content/test/node").open();

// setting defaults
Page.default().protocol(HTTPS);
Page.default().protocol(HTTP).on(PUBLISH); 

Opening pages in different AEM modes

// EDIT mode - default
Page.on(AUTHOR).path("/content/test/node").open();

// WCM Mode disabled
Page.on(AUTHOR).mode(WCM_MODE_DISABLED).path("/content/test/node").open();

Remembering the context, following redirects etc.

// Remembering the context
Page.on(AUTHOR).path("/content/test/node").open(); //saves as current page
// ... operations on page objects causing a redirect ...
Page.lastPage().open();

// Following redirect
WebElement a = driver.findElement(By.cssLocator("a.my-link"));
Page.navigateBy(a -> a.click()).expecting().path("/content/redirected/path"); // handles `page loading, change of URL etc.

// Verifying redirects
Page.wasRedirected().path("/path/to/potential/redirect");

Obtaining content

// Obtaining parsys/component in authoring

// assuming navigation to an author page happened
// e.g. Page.on(AUTHOR).named("Test page").open();
// based on config, e.g pages.yml:
// Test page:
//    - path: /content/test/page
//    - parsys: /par
Page.current().get().parsys().component(Title.class);

// based on data-path (Touch UI)
Page.current().get().parsys("/data-path").component(Title.class);

// get 1st, last, nTh component from parsys
Page.current().get().parsys().first().component(Title.class) ;
Page.current().get().parsys().last().component(Title.class, 2) ;
Page.current().get().parsys().nth().component(Title.class, 2) ;

// obtaining scoped page objects
Page.current().get().pageobject(Section.class); // default scoping or based on PageObject(locator)

By locator = By.cssLocator(".my-scoped-element");
Page.current().get().scoped(locator).pageobject(Some.class);

WebElement myScope = driver.findElement(locator);
Page.current().get().scoped(myScope).pageobject(Another.class);

To be considered / nice to have

  • using EventFiringWebDriver and WebDriverEventListener to track navigation
    • introduce Navigable - wrapper for WebElements that action on causes navigation events (e.g. hyperlinks)

Basic operations POC

Operations like:

  • set protocol,
  • set host,
  • open by path,
  • open with query string,
  • open by name,
  • with cookie,
  • window size,
  • expecting:
    • path,
    • labda,
    • WebElement,
    • page title,
  • history (prev, next),

Implement Subreport functionality

There is a problem with revealing a subreport form report. When clicking on "+" sign console error shows "togglePart is undefined". It looks like this method is not implemented at all. We need to implement it and investigate the json structure of subreport as for now it is not very handy.

AemImageTest - configureImageConfiguredBySingleFieldsTest failure

Exception: class java.lang.AssertionError
Message: Wrong image path Expected: a string ending with "cover" but: was "/content/dam/geometrixx-gov/cover.jpg" 
org.hamcrest.MatcherAssert.assertThat () 20
org.junit.Assert.assertThat () 956
com.cognifide.bdd.demo.aem.touchui.AemImageTest.configureImageConfiguredBySingleFieldsTest () 120
sun.reflect.NativeMethodAccessorImpl.invoke0 () -2
sun.reflect.NativeMethodAccessorImpl.invoke () 62
sun.reflect.DelegatingMethodAccessorImpl.invoke () 43
java.lang.reflect.Method.invoke () 498
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall () 50
org.junit.internal.runners.model.ReflectiveCallable.run () 12
org.junit.runners.model.FrameworkMethod.invokeExplosively () 47
org.junit.internal.runners.statements.InvokeMethod.evaluate () 17
org.junit.internal.runners.statements.RunBefores.evaluate () 26
org.junit.rules.TestWatcher$1.evaluate () 55
org.junit.rules.ExternalResource$1.evaluate () 48
org.junit.rules.RunRules.evaluate () 20
com.cognifide.qa.bb.junit.TestRunner.runMethod () 167
com.cognifide.qa.bb.junit.TestRunner.runChild () 127
com.cognifide.qa.bb.junit.TestRunner.runChild () 61
org.junit.runners.ParentRunner$3.run () 290
org.junit.runners.ParentRunner$1.schedule () 71
org.junit.runners.ParentRunner.runChildren () 288
org.junit.runners.ParentRunner.access$000 () 58
org.junit.runners.ParentRunner$2.evaluate () 268
org.junit.runners.ParentRunner.run () 363
com.cognifide.qa.bb.junit.TestRunner.run () 140
org.junit.runners.Suite.runChild () 128
org.junit.runners.Suite.runChild () 27
org.junit.runners.ParentRunner$3.run () 290
java.util.concurrent.Executors$RunnableAdapter.call () 511
java.util.concurrent.FutureTask.run () 266
java.util.concurrent.Executors$RunnableAdapter.call () 511
java.util.concurrent.FutureTask.run () 266
java.util.concurrent.ThreadPoolExecutor.runWorker () 1,142
java.util.concurrent.ThreadPoolExecutor$Worker.run () 617
java.lang.Thread.run () 745

License headers issue

Each of our license header contain "Bobcat Parent" name. Should it be like that? Wouldn't it be better with just "Bobcat"?

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.