Skip to content

Commit

Permalink
Merge 4adec70 into 9a829c6
Browse files Browse the repository at this point in the history
  • Loading branch information
lkiesow committed Nov 7, 2021
2 parents 9a829c6 + 4adec70 commit 8f5fbba
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
selenium
urllib3
52 changes: 52 additions & 0 deletions .github/selenium-tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/usr/bin/env python3

import sys

from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.common.by import By


BASE_URL = 'http://admin:opencast@127.0.0.1:5000'

driver = None


def navigate(path):
driver.get(f'{BASE_URL}{path}')


def wait_for(driver, element, timeout=20):
return WebDriverWait(driver, timeout).until(
expected_conditions.presence_of_element_located(element))


def check_pyca():
print('%-30s' % 'Testing pyCA header…', end='')
navigate('/')
elem = driver.find_element(By.TAG_NAME, 'header')
assert 'pyCA' == elem.text
print('✓')

print('%-30s' % 'Testing FontAwesome…', end='')
wait_for(driver, (By.CSS_SELECTOR, 'span.action'), timeout=0.2)
elem = driver.find_elements(By.CSS_SELECTOR, 'span.action svg')[0]
assert elem.get_attribute('role') == 'img'
print('✓')

print('%-30s' % 'Testing recordings table…', end='')
selector = '#recordings tbody tr'
wait_for(driver, (By.CSS_SELECTOR, selector), timeout=0.2)
recording_rows = driver.find_elements(By.CSS_SELECTOR, selector)
assert len(recording_rows) == 4
print('✓')


if __name__ == '__main__':
options = webdriver.FirefoxOptions()
if sys.argv[-1] != 'gui':
options.headless = True
driver = webdriver.Firefox(options=options)
check_pyca()
driver.close()
Binary file added .github/test.db.gz
Binary file not shown.
13 changes: 13 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
- 3.7
- 3.8
- 3.9
- '3.10'

steps:
- name: install libgnutls28-dev
Expand All @@ -42,6 +43,18 @@ jobs:
- name: run test
run: make test

- name: start user interface
run: |
gunzip .github/test.db.gz
mv .github/test.db pyca.db
./start.sh ui &
- name: install selenium
run: pip install -r .github/requirements.txt

- name: run user interface integration tests
run: ./.github/selenium-tests

- name: upload test coverage to coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
3 changes: 2 additions & 1 deletion ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ <h1>
<div>Processed</div>
<div class=inactive>{{ processed }}</div>
</div>
</div>
</summary>

<main class=center>
Expand All @@ -57,7 +58,7 @@ <h2>Preview Images</h2>
<div v-else>No preview image</div>
</section>

<section>
<section id=recordings>
<h2>Recordings</h2>

<table>
Expand Down

0 comments on commit 8f5fbba

Please sign in to comment.