[MGNLTEST-19] Page object for rendered pages Created: 18/Sep/19  Updated: 25/Aug/20  Resolved: 18/Aug/20

Status: Closed
Project: Magnolia Test Framework
Component/s: None
Affects Version/s: None
Fix Version/s: 1.0.1

Type: Task Priority: Neutral
Reporter: Christoph Meier Assignee: Michael Duerig
Resolution: Fixed Votes: 0
Labels: QA&Testing, ui-test-fwk
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
dependency
is depended upon by MGNLCE-186 UI tests Pages-app core - medium prio Closed
Template:
Acceptance criteria:
Empty
Task DoR:
Empty
Date of First Response:
Epic Link: core-TF-features-bugs-improvements
Sprint: TE 8, TE 9
Story Points: 5

 Description   

Overview & context

Provide a page object to analyze rendered pages.
It should work on both author and public context.

For the big majority of the tests, it should be sufficient to analyze "only" text on the rendered page.
Hence, let's start with a page object for rendered (content-)pages which focus on text-analyzing functions.

Use cases:

  • pages app
  • p13n functions
  • workflow
  • etc.

Required functions

Page exist

Tests whether a page for the give location exists.
Should be able to differentiate whether it is really the requested page or just an error page returned by tomcat.

Example use case:

Given paige opens the Pages app and adds the page /xyz.
When she publishes page /xyz.
Then page $magnoliaPublic/xyz exists.

has-text

A function to test whether the rendered page contains a given text.

textA-isBefore-textB

A function to test, whether a text-A appears on the page before the text-B.



 Comments   
Comment by Federico Grilli [ 11/Feb/20 ]

Re: the page exists case, we should already have all we need. E.g.

...
pagesApp.hitAction("Publish");
...
// GIVEN
expect.navigation().to(LoginPage.PUBLIC);
expect.loginPage().login(LoginPage.SUPERUSER);

// WHEN
expect.findBar().openApp("pages-app");

// THEN
assertTrue(expect.contentApp("Pages").hasRow("myNewPage"));
Comment by Christoph Meier [ 03/Mar/20 ]

Re: the page exists case, we should already have all we need. E.g.

True indeed. 
However, in case we do provide something base independent from selenium which e.g. used the response body to analyze ... such class should be able to provide also a #pageExists which can be used with just one line instead of using the pages app.

But since me (as the QAE) should not think too much about implementations - the above sense must be considered as a philosophical remark only ;^)

Comment by Christoph Meier [ 03/Mar/20 ]

Possible API

class: RenderedPage

Object provider: PageObjects#render(String path) 

RenderedPage render(String path)

I propose that the path is a path in the website JCR workspace.
Examples:

  • /travel
  • /travel/main/01

The 2nd example is debatable, but I expect it doesn't make a difference for the implementation to allow this or not. prbly makes sense. 
Given the 2nd example, there is prbly a better name for the class (so far proposed as RenderedPage).

Methods

RenderedPage itself then provides the methods as described above:

  • exists
  • hasText(String text)
  • textAisBeforeTextB(String textA, String textB)
     

 

Comment by Christoph Meier [ 03/Mar/20 ]

The changes from Sang on info.magnolia.functionaltests.PagesCoreFunctionalTests - so far on a PR (https://git.magnolia-cms.com/projects/PLATFORM/repos/ce/pull-requests/243/overview) prbly shows a possible way how this one could be tackled with the already info.magnolia.testframework.util.TestUtil#openJcrPropServlet

Generated at Mon Feb 12 07:44:45 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.