Exemplo n.º 1
0
 def delete_operator(self, name):
     self.current_page.expand_operators()
     op = OperatorsPage(self.driver)
     log.info('Opening operator %s page' % name)
     op.open_operator(name)
     sp = SingleOperatorPage(driver=self.driver)
     log.info('Trying to delete operator %s' % name)
     sp.delete_operator(name)
     self.current_page = OperatorsPage(driver=self.driver)
Exemplo n.º 2
0
 def add_operator(self, operator):
     self.current_page.expand_operators()
     op = OperatorsPage(self.driver)
     log.info('Opening add operator form')
     op.open_add_operator()
     add_form = AddOperatorPage(self.driver)
     log.info('Trying to add new operator %s' % operator)
     add_form.add_new_operator(operator)
     self.current_page = OperatorsPage(self.driver)
Exemplo n.º 3
0
 def edit_operator(self, old, new):
     self.current_page.expand_operators()
     op = OperatorsPage(self.driver)
     log.info('Opening operator %s page' % old)
     op.open_operator(old)
     sp = SingleOperatorPage(driver=self.driver)
     log.info('Trying to edit operator %s' % old)
     sp.edit_operator_open(old)
     form = EditCustomerForm(driver=self.driver)
     form.fill_form_submit(new)
     self.current_page = OperatorsPage(driver=self.driver)
Exemplo n.º 4
0
 def __init__(self):
     if profile_directory:
         self.driver = webdriver.Firefox(webdriver.FirefoxProfile(profile_directory=profile_directory))
     else:
         self.driver = webdriver.Firefox()
     self.driver.implicitly_wait(wait_time)
     self.current_page = LoginPage(driver=self.driver)
Exemplo n.º 5
0
 def logout(self):
     self.current_page.logout()
     self.current_page = LoginPage(driver=self.driver)
     log.info('Logged out')
Exemplo n.º 6
0
 def login(self, account=credentials):
     lp = self.current_page
     lp.open()
     lp.login(credentials)
     self.current_page = MachinesVpn(driver=self.driver)
     log.info('Logged in as %s' % credentials)
Exemplo n.º 7
0
class Application(object):

    def __init__(self):
        if profile_directory:
            self.driver = webdriver.Firefox(webdriver.FirefoxProfile(profile_directory=profile_directory))
        else:
            self.driver = webdriver.Firefox()
        self.driver.implicitly_wait(wait_time)
        self.current_page = LoginPage(driver=self.driver)

    def login(self, account=credentials):
        lp = self.current_page
        lp.open()
        lp.login(credentials)
        self.current_page = MachinesVpn(driver=self.driver)
        log.info('Logged in as %s' % credentials)

    def logout(self):
        self.current_page.logout()
        self.current_page = LoginPage(driver=self.driver)
        log.info('Logged out')

    def add_operator(self, operator):
        self.current_page.expand_operators()
        op = OperatorsPage(self.driver)
        log.info('Opening add operator form')
        op.open_add_operator()
        add_form = AddOperatorPage(self.driver)
        log.info('Trying to add new operator %s' % operator)
        add_form.add_new_operator(operator)
        self.current_page = OperatorsPage(self.driver)

    def delete_operator(self, name):
        self.current_page.expand_operators()
        op = OperatorsPage(self.driver)
        log.info('Opening operator %s page' % name)
        op.open_operator(name)
        sp = SingleOperatorPage(driver=self.driver)
        log.info('Trying to delete operator %s' % name)
        sp.delete_operator(name)
        self.current_page = OperatorsPage(driver=self.driver)

    def edit_operator(self, old, new):
        self.current_page.expand_operators()
        op = OperatorsPage(self.driver)
        log.info('Opening operator %s page' % old)
        op.open_operator(old)
        sp = SingleOperatorPage(driver=self.driver)
        log.info('Trying to edit operator %s' % old)
        sp.edit_operator_open(old)
        form = EditCustomerForm(driver=self.driver)
        form.fill_form_submit(new)
        self.current_page = OperatorsPage(driver=self.driver)

    def check_operator_in_list(self, name):
        try:
            assert self.current_page.check_operator_in_list(name)
            log.info('SUCCESS: Operator %s is present on All Operators page' % name)
        except AssertionError as e:
            log.error('FAILED: Cannot find operator %s on All Operators page' % name)
            raise e

    def check_operator_not_in_list(self, name):
        try:
            assert not self.current_page.check_operator_in_list(name)
            log.info('SUCCESS: Operator %s is NOT present on All Operators page' % name)
        except AssertionError as e:
            log.error('FAILED: Operator %s is on All Operators page' % name)
            raise e

    def close(self):
        self.driver.close()