diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 000000000..edc179148 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,27 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: bug +assignees: '' + +--- + +#### Describe the bug + + +#### To Reproduce +Steps to reproduce the behaviour: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +#### Expected behavior + + +#### Screenshots + + +#### Additional context + diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 000000000..d189ad628 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,17 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: enhancement +assignees: '' + +--- + +#### Proposed solution + + +#### DoD (Definition of Done) + + +#### Testing + diff --git a/.github/ISSUE_TEMPLATE/general-issue-template.md b/.github/ISSUE_TEMPLATE/general-issue-template.md new file mode 100644 index 000000000..a6c76de51 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/general-issue-template.md @@ -0,0 +1,17 @@ +--- +name: General issue template +about: Describe this issue template's purpose here. +title: '' +labels: '' +assignees: '' + +--- + +#### Description + + +#### DoD (Definition of Done) + + +#### Testing + diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..98c64b348 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,34 @@ +### Description + + + +### Related issues + + +### Type of change + + + + +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) +- [ ] This change requires a documentation update (this needs a follow up PR) + +### Changes Made + + + +### Testing + + + + + +- [ ] Unit Tests +- [ ] Integration Tests +- [ ] Tests do not apply +- [ ] Needs testing (start an issue or do a follow up PR about it) + +### Mentions + diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..f219bb1cf --- /dev/null +++ b/.travis.yml @@ -0,0 +1,90 @@ +sudo: required +dist: xenial +language: python + +python: 3.6 +install: true + +git: + depth: false + quiet: true + +services: docker + +stages: + - name: tests + if: type IN (push, pull_request) + - name: uitests + if: type IN (pull_request) + +jobs: + include: + - stage: tests + name: "Code Style Check" + python: 3.6 + before_script: + - pip install tox-travis + script: tox -e flake8 + - stage: tests + name: "Unit Tests" + python: 3.6 + before_script: + - pip install tox-travis + script: tox -e pytest + - stage: tests + name: "Documentation Tests" + python: 3.6 + before_script: + - pip install tox-travis + - wget https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-linux64.tar.gz + - tar -xvzf geckodriver-v0.24.0-linux64.tar.gz + - rm geckodriver-v0.24.0-linux64.tar.gz + - chmod +x geckodriver + - sudo cp geckodriver /usr/local/bin/ + - geckodriver --version + - sudo apt-get update + - sudo apt-get install firefox -y + script: + - tox -e docs + - stage: tests + name: "Python Code Security Tests" + python: 3.6 + before_script: + - pip install tox-travis + script: tox -e bandit + - stage: uitests + name: "Firefox UI Tests" + python: 3.6 + before_script: + - pip install tox-travis + - wget https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-linux64.tar.gz + - tar -xvzf geckodriver-v0.24.0-linux64.tar.gz + - rm geckodriver-v0.24.0-linux64.tar.gz + - chmod +x geckodriver + - sudo cp geckodriver /usr/local/bin/ + - geckodriver --version + - sudo apt-get update + - sudo apt-get install firefox -y + script: + - tox -e firefox + - stage: uitests + name: "Chrome UI Tests" + python: 3.6 + before_script: + - pip install tox-travis + - curl -sS -o - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add + - echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee -a /etc/apt/sources.list.d/google-chrome.list + - sudo apt-get -y update + - sudo apt-get -y install google-chrome-stable + - wget https://chromedriver.storage.googleapis.com/76.0.3809.68/chromedriver_linux64.zip + - unzip chromedriver_linux64.zip + - rm chromedriver_linux64.zip + - chmod +x chromedriver + - sudo cp chromedriver /usr/local/bin/ + - sudo chromedriver --version + script: + - tox -e chrome + + +notifications: + email: false diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index aba5460f8..99a2f0d6d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,7 +4,9 @@ If you're reading this, it means you saw something that is not right, you want t ### Testing -We have unit tests and currently no integration tests, and always in need of more. In our Git workflow unit tests are run on every Push and Merge Request. +We have a handful of unit tests and UI tests. In our Git workflow unit tests are run on every Push and Pull Request, while UI tests run on every Pull Request. + +For more information this guide on [swift-browser-ui testing](https://swift-browser-ui.readthedocs.io/en/latest/testing.html) might be worth a read. ### Submitting Issues @@ -12,7 +14,7 @@ We have templates for submitting new issues, that you can fill out. For example ### Submitting changes -When you made some changes you are happy with please send a [GitLab merge Request to swift-browser-ui](https://gitlab.csc.fi/CSCCSDP/swift-browser-ui/merge_requests/new) with a clear list of what you've done (read more about [merge requests](https://docs.gitlab.com/ee/gitlab-basics/add-merge-request.html)). When you create that Merge Request, we will forever be in your debt if you check previous docs for typos. +When you made some changes you are happy with please send a [GitLab merge Request to swift-browser-ui](https://github.com/CSCfi/swift-browser-ui/pull_requests/new/devel) with a clear list of what you've done (read more about [pull requests]https://help.github.com/en/articles/about-pull-requests)). When you create that Merge Request, we will forever be in your debt if you check previous docs for typos. Please follow our Git branches model and coding conventions (both below), and make sure all of your commits are atomic (preferably one feature per commit) and it is recommended a Merge Request addresses one functionality or fixes one bug. diff --git a/README.md b/README.md index dc8f9cdb6..b7d598f24 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ ## swift-browser-ui +[![Build Status](https://travis-ci.org/CSCfi/swift-browser-ui.svg?branch=master)](https://travis-ci.org/CSCfi/swift-browser-ui) +[![Coverage Status](https://coveralls.io/repos/github/CSCfi/swift-browser-ui/badge.svg?branch=maste)](https://coveralls.io/github/CSCfi/swift-browser-ui?branch=maste) +[![Documentation Status](https://swift-browser-ui.readthedocs.io/en/latest/?badge=latest)](https://swift-browser-ui.readthedocs.io/en/latest/?badge=latest) + ### Description A web frontend for browsing and downloading objects saved in [SWIFT](https://docs.openstack.org/swift/latest/) diff --git a/tests/coveralls.py b/tests/coveralls.py new file mode 100644 index 000000000..6fedf2167 --- /dev/null +++ b/tests/coveralls.py @@ -0,0 +1,17 @@ +#!/bin/env/python + +import os +from subprocess import call +import sys + +# Run converalls command only on Travis +# Solution provided by +# https://stackoverflow.com/questions/32757765/conditional-commands-in-tox-tox-travis-ci-and-coveralls + +if __name__ == '__main__': + if 'TRAVIS' in os.environ: + rc = call('coveralls') + sys.stdout.write("Coveralls report from TRAVIS CI.\n") + # raise SystemExit(rc) + else: + sys.stdout.write("Not on TRAVIS CI.\n") diff --git a/tox.ini b/tox.ini index 62bd90e73..adc241dd8 100644 --- a/tox.ini +++ b/tox.ini @@ -31,10 +31,12 @@ commands = python -m ui_tests.ui_take_screenshots [testenv:pytest] basepython = python3.6 +passenv = TRAVIS TRAVIS_* deps = .[test] -rrequirements.txt commands = py.test -x --cov=swift_browser_ui tests/ --cov-fail-under=75 + python {toxinidir}/tests/coveralls.py [testenv] basepython = python3.6 @@ -59,3 +61,8 @@ setenv = deps = .[ui_test] commands = py.test -vvv ui_tests/test_frontend_chrome.py ui_tests/test_session_chrome.py + +[travis] +unignore_outcomes = True +python = + 3.6: py36 \ No newline at end of file diff --git a/ui_tests/test_frontend_chrome.py b/ui_tests/test_frontend_chrome.py index c5d93ee9c..4e9fffe96 100644 --- a/ui_tests/test_frontend_chrome.py +++ b/ui_tests/test_frontend_chrome.py @@ -16,7 +16,7 @@ from .common import wait_for_clickable -class TestFirefoxFrontend(ChromiumTestClass): +class TestChromeFrontend(ChromiumTestClass): """Test the frontend wiht chrome.""" @pytest.mark.timeout(60)