EmchBerger / cube-common-develop

Common code for developping the CUBE Tools
MIT License
0 stars 1 forks source link

[testing] do automated ui tests #2

Open SimonHeimberg opened 7 years ago

SimonHeimberg commented 7 years ago

suggestions:

both based on phpunit and able to call selenium webdriver:

SimonHeimberg commented 7 years ago

to try:

does the selenium export work for the tools? (or export from Katalon Recorder)

exported code (generated by https://addons.mozilla.org/en-US/firefox/addon/selenium-ide-php-formatters/ ):

    $this->open("http://xxx/xx");
    $this->click("css=input.newtab-control.newtab-control-pin");
    $this->click("css=span.newtab-title");
    $this->waitForPageToLoad("30000");

Exported java code, to do some automatic replacements:

    driver.get("http://192.168.56.101:8083/login");
    driver.findElement(By.id("username")).clear();
    driver.findElement(By.id("username")).sendKeys("fslflas@jlfdsa.example.com");
    driver.findElement(By.id("password")).clear();
    driver.findElement(By.id("password")).sendKeys("fkjlasjklsfs");
    driver.findElement(By.id("loginForm")).submit();
    assertNotEquals("/login", driver.getCurrentUrl());
SimonHeimberg commented 7 years ago
tool selenium WebDriver more drivers syntax similar connection config remote code coverage
baseMinkTestcase y y * no? ?? todo y
steward y - java simple ?

syntax baseMinkTestCase:

// visit a page
$mink->getSession()->visit($startUrl);

// call to getSession() without argument will always return a default session if has one (goutte2 here)
$mink->getSession()->getPage()->findLink('Downloads')->click();
echo $mink->getSession()->getPage()->getContent();

// call to getSession() with argument will return session by its name
$mink->getSession('custom')->getPage()->findLink('Downloads')->click();
echo $mink->getSession('custom')->getPage()->getContent();

syntax steward:

 $this->wd->get($startUrl);
 $this->findMultipleByClass('cubePa'); // OR
 $this->wd->findElement(WebDriverBy::id('username'));
 $this->wd->getTitle();

mink drivers *: Selenium, Goutte, Zombie, Sahi, GhostDriver, ...

SimonHeimberg commented 6 years ago

If somebody wants to run some tests, ask me to start my selenium-servers and give you the login details. (And some demo code to run steward.)