Skip to content
This repository has been archived by the owner on Mar 19, 2021. It is now read-only.

Commit

Permalink
Split exceptions/test, fix test_client_disabling
Browse files Browse the repository at this point in the history
Move exceptions to own file
Get environment variables in own method
Make chromedriver path an environment variable and check for it
Remove empty lines
Add excplicit wait in job cancel test
Fix test_client_disabling by going back to dashboard before disabling a client

Signed-off-by: Frank Bergkemper <frank.bergkemper@bareos.com>
  • Loading branch information
[Aron Schueler] authored and fbergkemper committed Apr 5, 2018
1 parent 76da6ce commit 833e142
Show file tree
Hide file tree
Showing 3 changed files with 131 additions and 96 deletions.
Empty file added tests/selenium/__init__.py
Empty file.
47 changes: 47 additions & 0 deletions tests/selenium/seleniumtestexceptions.py
@@ -0,0 +1,47 @@
class BadJobException(Exception):
'''Raise when a started job doesn't result in ID'''
def __init__(self, msg=None):
msg = 'Job ID could not be saved after starting the job.'
super(BadJobException, self).__init__(msg)

class ClientStatusException(Exception):
'''Raise when a client does not have the expected status'''
def __init__(self,client, status, msg=None):
if status=='enabled':
msg = '%s is enabled and cannot be enabled again.' % client
if status=='disabled':
msg = '%s is disabled and cannot be disabled again.' % client
super(ClientStatusException, self).__init__(msg)

class ClientNotFoundException(Exception):
'''Raise when the expected client is not found'''
def __init__(self, client, msg=None):
msg = 'The client %s was not found.' % client
super(ClientNotFoundException, self).__init__(msg)

class ElementCoveredException(Exception):
'''Raise when an element is covered by something'''
def __init__(self, value):
msg = 'Click on element %s failed as it was covered by another element.' % value
super(ElementCoveredException, self).__init__(msg)

class ElementTimeoutException(Exception):
'''Raise when waiting on an element times out'''
def __init__(self, value):
if value != 'spinner':
msg = 'Waiting for element %s returned a TimeoutException.' % value
else:
msg = 'Waiting for the spinner to disappear returned a TimeoutException.' % value
super(ElementTimeoutException, self).__init__(msg)

class ElementNotFoundException(Exception):
'''Raise when an element is not found'''
def __init__(self, value):
msg = 'Element %s was not found.' % value
super(ElementTimeoutException, self).__init__(msg)

class FailedClickException(Exception):
'''Raise when wait_and_click fails'''
def __init__(self, value):
msg = 'Waiting and trying to click %s failed.' % value
super(FailedClickException, self).__init__(msg)

0 comments on commit 833e142

Please sign in to comment.