ui5-community / wdi5

official UI5 end-to-end test framework for UI5 web-apps. wdi5 = Webdriver.IO + UI5 Test API
https://ui5-community.github.io/wdi5/
Apache License 2.0
102 stars 43 forks source link

Feature Request: Add command to reinitialize wdi5 #38

Closed mikezaschka closed 3 years ago

mikezaschka commented 3 years ago

In my cucumber files there are multiple tests (cucumber scenarios) in one browser session, that all do some routing, some with UI5, some without (e.g. login page -> access launchpad -> access app -> check -> logout page, login page -> access launchpad… The first test runs fine but subsequent tests fail due to some wdi5 internal error (_context is not set and thus _context.waitForUI5() fails). I got things running with a custom command, but reseting the internals from the outside doesn’t seem the best way to go:

browser.addCommand("resetUI5",  () => {
  // UI5 bridge setup
  const context = driver ? driver : browser;
  driver.execute(() => {
    window.bridge = null;
  });
  const wdi5config = context.config.wdi5;
  wdioUI5.injectUI5(context);
  wdioUI5.setup(context);
});

Maybe you can add a similar command that makes it possible to fully reinitialize wdi5 or make waitForUI5 check if all the internals are still valid and if not, do some automated reinitialization.

vobu commented 3 years ago

already in since ages :) https://github.com/js-soft/wdi5/tree/develop/wdio-ui5-service#skip-ui5wdi5-initialization-on-startup