Skip to content

Commit

Permalink
selenium test update to make it easier to run locally and on travis
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonmunro committed Nov 13, 2018
1 parent 447170d commit 5cb8199
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .travis/creds.py-chrome
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import os, sys
from selenium import webdriver

RECIP='testuser@localhost.localdomain'
IMAP_ID='2'
DESIRED_CAP = None
SITE_URL = 'http://cypht-test.org/'
USER = 'testuser'
Expand Down
2 changes: 2 additions & 0 deletions .travis/creds.py-edge
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import os, sys
from selenium import webdriver

RECIP='testuser@localhost.localdomain'
IMAP_ID='2'
DESIRED_CAP = None
SITE_URL = 'http://cypht-test.org/'
USER = 'testuser'
Expand Down
2 changes: 2 additions & 0 deletions .travis/creds.py-ff
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import os, sys
from selenium import webdriver

RECIP='testuser@localhost.localdomain'
IMAP_ID='2'
DESIRED_CAP = None
SITE_URL = 'http://cypht-test.org/'
USER = 'testuser'
Expand Down
2 changes: 2 additions & 0 deletions .travis/creds.py-ie
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import os, sys
from selenium import webdriver

RECIP='testuser@localhost.localdomain'
IMAP_ID='2'
DESIRED_CAP = None
SITE_URL = 'http://cypht-test.org/'
USER = 'testuser'
Expand Down
2 changes: 2 additions & 0 deletions .travis/creds.py-safari
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import os, sys
from selenium import webdriver

RECIP='testuser@localhost.localdomain'
IMAP_ID='2'
DESIRED_CAP = None
SITE_URL = 'http://cypht-test.org/'
USER = 'testuser'
Expand Down
6 changes: 6 additions & 0 deletions tests/selenium/local_creds.example.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

# This is an example config file to run the Selenium tests locally

# recipient E-mail for the send test
RECIP='testuser@localhost.localdomain'

# IMAP id (used to select the correct server in the servers test)
IMAP_ID='2'

# Get webdrivers
from selenium import webdriver

Expand Down
6 changes: 6 additions & 0 deletions tests/selenium/remote_creds.example.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
# This is an example config file to run the Selenium tests remotely,
# specifically with BrowserStack (https://www.browserstack.com)

# recipient E-mail for the send test
RECIP='testuser@localhost.localdomain'

# IMAP id (used to select the correct server in the servers test)
IMAP_ID='2'

# Get webdrivers
from selenium import webdriver

Expand Down
3 changes: 2 additions & 1 deletion tests/selenium/send.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from base import WebTest, USER, PASS
from creds import RECIP
from runner import test_runner
from selenium.common.exceptions import ElementNotVisibleException

Expand All @@ -17,7 +18,7 @@ def load_compose_page(self):

def compose_message(self):
to = self.by_name('compose_to')
to.send_keys('testuser@localhost.localdomain')
to.send_keys(RECIP)
subject = self.by_name('compose_subject')
subject.send_keys('Test')
body = self.by_name('compose_body')
Expand Down
5 changes: 3 additions & 2 deletions tests/selenium/servers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from base import WebTest, USER, PASS
from runner import test_runner
from creds import IMAP_ID
from selenium.common.exceptions import ElementNotVisibleException

class ServersTest(WebTest):
Expand Down Expand Up @@ -55,9 +56,9 @@ def imap_add(self):
assert self.by_class('sys_messages').text == 'Added server!'

def imap_confirm(self):
user = self.by_id('imap_user_2')
user = self.by_id('imap_user_'+IMAP_ID)
user.send_keys('testuser')
passw = self.by_id('imap_pass_2')
passw = self.by_id('imap_pass_'+IMAP_ID)
passw.send_keys('testuser')
self.by_class('test_imap_connect').click()
self.wait_on_sys_message()
Expand Down

0 comments on commit 5cb8199

Please sign in to comment.