File: selenium-tuned.py

package info (click to toggle)
cockpit 239-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 67,268 kB
  • sloc: javascript: 245,474; ansic: 72,273; python: 23,634; xml: 6,155; sh: 2,919; makefile: 923; sed: 5
file content (47 lines) | stat: -rw-r--r-- 2,106 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from testlib_avocado.seleniumlib import SeleniumTest, clickable, visible, invisible
import os
import sys

machine_test_dir = os.path.dirname(os.path.realpath(__file__))
if machine_test_dir not in sys.path:
    sys.path.insert(1, machine_test_dir)


class TunedProfiles(SeleniumTest):
    """
    :avocado: enable
    """

    def setUp(self):
        super().setUp()
        self.balanced_profile = "balanced"
        self.desktop_profile = "desktop"
        self.prepare_machine_execute()
        self.machine.execute("sudo systemctl start tuned", quiet=True)
        self.machine.execute("sudo tuned-adm profile {}".format(self.balanced_profile), quiet=True)
        self.machine.execute("/usr/sbin/tuned-adm active", quiet=True)
        self.login()

    def get_profile(self):
        return self.machine.execute("/usr/sbin/tuned-adm active", quiet=True).strip().rsplit(" ", 1)[1]

    def testPerformaceProfiles(self):
        self.click(self.wait_link('Overview', cond=clickable))
        self.wait_frame("system")
        self.click(self.wait_text(self.balanced_profile, cond=clickable))
        self.wait_text("Change performance profile")
        self.click(self.wait_text(self.desktop_profile, element="p", cond=clickable))
        self.click(self.wait_text("Change profile", element="button", cond=clickable))
        self.wait_text("Change performance profile", cond=invisible)
        self.wait_id("overview", cond=visible)
        self.wait_text(self.desktop_profile, cond=clickable)
        self.assertIn(self.desktop_profile, self.get_profile())

        self.click(self.wait_text(self.desktop_profile, cond=clickable))
        self.wait_text("Change performance profile")
        self.click(self.wait_text(self.balanced_profile, element="p", cond=clickable))
        self.click(self.wait_text("Change profile", element="button", cond=clickable))
        self.wait_text("Change performance profile", cond=invisible)
        self.wait_id("overview", cond=visible)
        self.wait_text(self.balanced_profile, cond=clickable)
        self.assertIn(self.balanced_profile, self.get_profile())