PageChangeEvents - iks-gmbh-tools/SysNat GitHub Wiki
Problem:
A test app contains many data masks. Best developer practice is to have a page object for each of those. In this case, SysNat must know which page object is the current because its data mask is currently visible. The programmer can let SysNat search for the current page object. However, this can be very time consuming. For good test execution performance SysNat should always know exactly which page object is current.
Solution:
Defining PageChangeObjects is an easy-to-use-mechanism to let SysNat care for updating the current page object. SysNat knows three types of events that can trigger a page object change: ButtonClick, MenuItemClick and TabSwitch. For ButtonClicks a "from-Page" must be defined. MenuItemsClicks and TabSwitches are available from everywhere. No page object is needed therefore in these cases. PageChangeEvents are defined by a fluent API in the LanguageTemplateContainer of test application. A definition of a PageChangeEvent looks that way:
addPageChangeEvent(new PageChangeEventBuilder().from(loginPageObject).via(EventType.ButtonClick).on("Log in").to(mainPageObject).waiting(1000).build());
With "waiting" either a number of milliseconds is defined to wait for the new page to be displayed. Or alternatively, a technical id of ui element can be determined here. SysNat waits for ths element to appear.