Selenium in OpenQA testing web pages and more Ondrej Holecek - - PowerPoint PPT Presentation

selenium in openqa
SMART_READER_LITE
LIVE PREVIEW

Selenium in OpenQA testing web pages and more Ondrej Holecek - - PowerPoint PPT Presentation

Selenium in OpenQA testing web pages and more Ondrej Holecek me@aaannz.eu OpenQA system Release management tool .. with included acceptance/integration testing 2 OpenQA tests UX focus Multi-Machine - parallel, serial, results


slide-1
SLIDE 1

Selenium in OpenQA

testing web pages and more

Ondrej Holecek me@aaannz.eu
slide-2
SLIDE 2

2

OpenQA system

  • Release management tool

.. with included acceptance/integration testing

slide-3
SLIDE 3

3

OpenQA tests

  • UX focus
  • Multi-Machine - parallel, serial, results reuse
  • Advanced networking – open vSwitch support
  • Multiple architecture support
  • Scalable – remote workers, asset caching
  • Infrastructure integration – RabbitMQ, fedmsg, GRU
slide-4
SLIDE 4

4

testing web - OpenQA

x11_start_program('firefox'); assert_screen('firefox_started'); assert_and_click('url_bar'); type_string("www.opensuse.org\n"); assert_screen('opensuse.org-looks-fine'); assert_and_click('link_to_portal'); ...

slide-5
SLIDE 5

5

testing web - Selenium

$driver->find_element('#user-action a')->click(); $driver->find_element_by_link_text('Audit log')->click(); wait_for_data_table; like($driver->get_title(), qr/Audit log/, 'on audit log'); my $table = $driver- >find_element_by_id('audit_log_table');

  • k($table, 'audit table found');

my $search = $driver->find_element('input.form-control');

  • k($search, 'search box found');

my @entries = $driver->find_child_elements($table, 'tbody/tr', 'xpath'); is(scalar @entries, 3, 'three elements without filter');

slide-6
SLIDE 6

6

OpenQA tests architecture

  • ~/main.pm
  • ~/tests/
  • ~/needles/
  • ~/lib/
  • ~/data/
  • ~/products/
slide-7
SLIDE 7

7

OpenQA tests architecture

  • ~/main.pm
  • ~/tests/
  • ~/needles/
  • ~/lib/
  • ~/data/
  • ~/products/

➔test loader ➔test directory ➔matching templates ➔support libraries ➔static test data ➔product specific data

mandatory

slide-8
SLIDE 8

8

lib/

  • Automatically added to @INC
  • Base test modules and libraries
  • No ABI specified for libraries
slide-9
SLIDE 9

9

selenium.pm

  • Install phase

‒ selenium-server on SUT ‒ chrome and chromedriver

  • Run phase

‒ obtain IP of SUT ‒ start server and connect driver (Selenium::Remote::Driver)

  • Helper subroutines

‒ wait_for_xpath, wait_for_link, ...

slide-10
SLIDE 10

10

Better of both worlds

my $driver = selenium_driver(); $self->register_barriers('suma_minion_ready'); wait_for_link("Pending Minions", -tries => 10, -wait => 15,

  • reload_after_tries => 1)->click();

wait_for_xpath("//button[\@title='accept']")->click(); wait_for_link(".openqa.suse.de", -tries => 10, -wait => 15,

  • reload_after_tries => 1)->click();

save_screenshot; $self->apply_highstate(); $self->registered_barrier_wait('suma_minion_ready');

slide-11
SLIDE 11

11

Demo

slide-12
SLIDE 12

12

Future

  • new helpers
  • openSUSE distri split into individual libraries
  • support for WinAppDriver as an exercise
slide-13
SLIDE 13

Questions?

slide-14
SLIDE 14

17

Have a Lot of Fun, and Join Us At: www.opensuse.org