BVB Source Codes

cockpit Show selenium-base.py Source code

Return Download cockpit: download selenium-base.py Source code - Download cockpit Source code - Type:.py
  1. #!/usr/bin/python
  2.  
  3. # we need to be able to find and import seleniumlib, so add this directory
  4. import os
  5. import sys
  6. machine_test_dir = os.path.dirname(os.path.abspath(__file__))
  7. if not machine_test_dir in sys.path:
  8.     sys.path.insert(1, machine_test_dir)
  9.  
  10. from avocado import main
  11. from avocado.utils import process
  12. from seleniumlib import *
  13.  
  14. class BasicTestSuite(SeleniumTest):
  15.     """
  16.    :avocado: enable
  17.    """
  18.     def test10Base(self):
  19.         out = process.run("hostname", shell=True)
  20.         server_element = self.wait_id('server-name')
  21.         self.assertTrue(str(out.stdout)[:-1] in str(server_element.text))
  22.         self.error=False
  23.  
  24.     def test20Login(self):
  25.         self.login()
  26.         self.wait_id("sidebar")
  27.         user_element = self.wait_id("content-user-name")
  28.         self.assertEqual(user_element.text, user)
  29.         self.logout()
  30.         self.wait_id('server-name')
  31.         self.login("baduser", "badpasswd")
  32.         message_element = self.wait_id('login-error-message')
  33.         self.assertTrue("Wrong" in message_element.text)
  34.         self.login()
  35.         username_element = self.wait_id("content-user-name")
  36.         self.assertEqual(username_element.text, user)
  37.         self.error=False
  38.  
  39.     def test30ChangeTabServices(self):
  40.         self.login()
  41.         self.wait_id("sidebar")
  42.         self.click(self.wait_link('Services', cond=clickable))
  43.         self.wait_frame("services")
  44.         self.wait_id("services-list-enabled")
  45.         self.click(self.wait_text("Socket", cond=clickable))
  46.         self.wait_text("udev")
  47.         self.wait_id("services-list-enabled")
  48.         self.click(self.wait_text("Target", cond=clickable))
  49.         self.wait_id("services-list-enabled")
  50.         self.wait_text("reboot.target")
  51.         self.click(self.wait_text("System Services", cond=clickable))
  52.         self.wait_id("services-list-enabled")
  53.         self.wait_text("dbus.service")
  54.         self.mainframe()
  55.         self.error=False
  56.  
  57.     def test50ChangeTabLogs(self):
  58.         self.login()
  59.         self.wait_id("sidebar")
  60.         self.click(self.wait_link('Logs', cond=clickable))
  61.         self.wait_frame("logs")
  62.         self.wait_id("journal")
  63.         self.wait_id("journal-current-day")
  64.         self.wait_id("journal-prio")
  65.         self.click(self.wait_text('Errors', cond=clickable, element="button"))
  66.         self.wait_id("journal")
  67.         self.wait_id("journal-current-day")
  68.         self.click(self.wait_text('Warnings', cond=clickable, element="button"))
  69.         self.wait_id("journal")
  70.         self.wait_id("journal-current-day")
  71.         self.click(self.wait_text('Notices', cond=clickable, element="button"))
  72.         self.wait_id("journal")
  73.         self.wait_id("journal-current-day")
  74.         checkt = "ahojnotice"
  75.         process.run("systemd-cat -p notice echo '%s'" % checkt, shell=True)
  76.         self.click(self.wait_text(checkt, cond=clickable))
  77.         self.wait_id('journal-entry')
  78.         self.mainframe()
  79.         self.error=False
  80.  
  81.     def test70ChangeTabNetworking(self):
  82.         self.login()
  83.         self.wait_id("sidebar")
  84.         out = process.run("ip r |grep default | head -1 | cut -d ' ' -f 5", shell=True)
  85.         self.click(self.wait_link('Network', cond=clickable))
  86.         self.wait_frame("network")
  87.         self.wait_id("networking-interfaces")
  88.         self.wait_id("networking-tx-graph")
  89.  
  90.         self.click(self.wait_xpath("//tr[@data-interface='%s']" % out.stdout[:-1],cond=clickable))
  91.         self.wait_text("Carrier", element="td")
  92.         self.mainframe()
  93.         self.error=False
  94.  
  95.     def test80ChangeTabTools(self):
  96.         self.login()
  97.         self.wait_id("sidebar")
  98.         self.click(self.wait_link('Accounts', cond=clickable))
  99.         self.wait_frame("users")
  100.         self.click(self.wait_xpath(
  101.             "//*[@class='cockpit-account-user-name' and contains(text(), '%s')]" % user, cond=clickable))
  102.         self.wait_id('account')
  103.         self.wait_text("Full Name")
  104.         self.click(self.wait_link('Accounts', cond=clickable))
  105.         self.click(self.wait_id("accounts-create", cond=clickable))
  106.         self.wait_id("accounts-create-dialog")
  107.         self.wait_id('accounts-create-create', cond=clickable)
  108.         self.send_keys(self.wait_id('accounts-create-real-name'), 'testxx')
  109.         self.send_keys(self.wait_id('accounts-create-pw1'), passwd)
  110.         self.send_keys(self.wait_id('accounts-create-pw2'), passwd)
  111.         self.wait_xpath("//span[@id='accounts-create-password-meter-message' and contains(text(), '%s')]" % "Excellent")
  112.         self.click(self.wait_id('accounts-create-create', cond=clickable))
  113.         self.click(self.wait_xpath(
  114.             "//*[@class='cockpit-account-user-name' and contains(text(), '%s')]" % 'testxx', cond=clickable))
  115.         self.click(self.wait_id('account-delete', cond=clickable))
  116.         self.wait_id('account-confirm-delete-dialog')
  117.         self.click(self.wait_id('account-confirm-delete-apply', cond=clickable))
  118.         self.wait_xpath(
  119.             "//*[@class='cockpit-account-user-name' and contains(text(), '%s')]" % user, cond=clickable)
  120.         self.mainframe()
  121.  
  122.         self.click(self.wait_link('Terminal', cond=clickable))
  123.         self.wait_frame("terminal")
  124.         terminal = self.wait_xpath("//*[@class='terminal']")
  125.         prefix = "/tmp/cockpitrndadr/"
  126.         self.send_keys(terminal, "mkdir {0}\n".format(prefix), clear=False)
  127.         self.wait_text("mkdir {0}".format(prefix), user, element="div")
  128.         self.send_keys(terminal, "touch {0}abc\n".format(prefix), clear=False)
  129.         self.wait_text("touch {0}abc".format(prefix), user, element="div")
  130.         self.send_keys(terminal, "touch {0}abd\n".format(prefix), clear=False)
  131.         self.wait_text("touch {0}abd".format(prefix), user, element="div")
  132.         self.send_keys(terminal, "ls {0}*\n".format(prefix), clear=False)
  133.         self.wait_text("ls {0}*".format(prefix), '{0}abc'.format(prefix), element="div")
  134.         process.run("ls {0}abc".format(prefix), shell=True)
  135.         process.run("ls {0}abd".format(prefix), shell=True)
  136.         self.send_keys(terminal, "rm {0}abc {0}abd\n".format(prefix), clear=False)
  137.         self.wait_text("rm {0}abc {0}abd".format(prefix), user, element="div")
  138.         self.send_keys(terminal, "ls {0}*\n".format(prefix), clear=False)
  139.         self.wait_text("ls {0}*".format(prefix), 'cannot access', element="div")
  140.         process.run("ls {0}abc |wc -l |grep 0".format(prefix), shell=True)
  141.         process.run("ls {0}abd |wc -l |grep 0".format(prefix), shell=True)
  142.         self.mainframe()
  143.         self.error=False
  144.  
  145. if __name__ == '__main__':
  146.     main()
  147.  
downloadselenium-base.py Source code - Download cockpit Source code
Related Source Codes/Software:
elasticsearch-kopf - web admin interface for elasticsearch 2017-05-07
xunlei-lixian - Thunderbolt offline download script 2017-05-07
xadmin - Drop-in replacement of Django admin comes with lot... 2017-05-07
p2pspider - DHT Spider + BitTorrent Client = P2P Spider 2017-05-07
Backbone.localStorage - A localStorage adapter for Backbone.j 2017-05-07
phenomic - 2017-05-07
shoulda - Makes tests easy on the fingers and the eyes ... 2017-05-07
mio - Metal IO library for Rust 2017-05-07
nova - OpenStack Compute (Nova) ht... 2017-05-07
gobyexample - Go by Example https://gobye... 2017-05-07
react-boilerplate - 2017-06-07
webtorrent - Streaming torrent client for the web ... 2017-06-06
machine-learning-for-software-engineers - A complete daily plan for studying to become a mac... 2017-06-06
upterm - A terminal emulator for the 21st century. 2017-06-06
huginn - Create agents that monitor and act on your behalf.... 2017-06-06
system-design-primer - Learn how to design large-scale systems. Prep for ... 2017-06-06
design-patterns-for-humans - Design Patterns for Humans - An ultra-simplified e... 2017-06-06
developer-roadmap - Roadmap to becoming a web developer in 2017 2017-06-06
nylas-mail - 2017-06-06

 Back to top