Fakultas Ilmu Komputer UI

Commit 1a6ec013 authored by Rayza Arasj Mahardhika's avatar Rayza Arasj Mahardhika
Browse files

setup coverage

parent bc3614a8
Pipeline #28291 failed with stage
in 3 minutes and 34 seconds
......@@ -3,4 +3,5 @@ __pycache__
*.pyc
.vscode
/staticfiles
db.sqlite3
\ No newline at end of file
db.sqlite3
.coverage
image: alpine:latest
stages:
- deploy
- test
services:
- postgres:latest
Deployment:
image: ruby:2.4
stage: deploy
variables:
POSTGRES_DB: database
POSTGRES_USER: postgres
POSTGRES_PASSWORD: "password"
Testing:
stage: test
image: joyzoursky/python-chromedriver:3.7
before_script:
- gem install dpl
- wget -qO- https://cli-assets.heroku.com/install-ubuntu.sh | sh
- pip install -r requirements.txt
- export DB_HOST=postgres
- python manage.py collectstatic
- python manage.py migrate
script:
- dpl --provider=heroku --app=$HEROKU_APPNAME --api-key=$HEROKU_APIKEY
- export HEROKU_API_KEY=$HEROKU_APIKEY
- heroku run --app $HEROKU_APPNAME migrate
environment:
name: production
url: $HEROKU_APP_HOST
- coverage run --source=accounts,lists manage.py test
- coverage report -m
......@@ -3,6 +3,10 @@ PMPL Course - Class A
URL: http://pmpl-rayza.herokuapp.com
[![pipeline status](https://gitlab.cs.ui.ac.id/pmpl/practice-collection/2019/1606876052-practice/badges/master/pipeline.svg)](https://gitlab.cs.ui.ac.id/pmpl/practice-collection/2019/1606876052-practice/commits/master)
[![coverage report](https://gitlab.cs.ui.ac.id/pmpl/practice-collection/2019/1606876052-practice/badges/master/coverage.svg)](https://gitlab.cs.ui.ac.id/pmpl/practice-collection/2019/1606876052-practice/commits/master)
## Exercise - 3 : Test Isolation
......
File added
......@@ -8,8 +8,24 @@ MAX_WAIT = 10
class FunctionalTest(StaticLiveServerTestCase):
def get_browser(self):
desired_capabilities = webdriver.DesiredCapabilities.CHROME
desired_capabilities['loggingPrefs'] = {'browser': 'ALL'}
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--headless')
chrome_options.add_argument('--disable-gpu')
desired_capabilities.update(chrome_options.to_capabilities())
browser = webdriver.Chrome('./chromedriver', desired_capabilities=desired_capabilities)
return browser
def setUp(self):
self.browser = webdriver.Firefox()
self.browser = self.get_browser()
self.browser.implicitly_wait(3)
def tearDown(self):
......
......@@ -70,7 +70,7 @@ class NewVisitorTest(FunctionalTest):
## We use a new browser session to make sure that no information
## of Edith's is coming through from cookies etc
self.browser.quit()
self.browser = webdriver.Firefox()
self.browser = self.get_browser()
# Francis visits the home page. There is no sign of Edits's
# list
......
......@@ -98,7 +98,7 @@ DATABASES = {
'NAME': os.environ.get('DB_NAME', ''),
'USER': os.environ.get('DB_USER', ''),
'PASSWORD': os.environ.get('DB_PASS', ''),
'HOST': 'localhost',
'HOST': os.environ.get('DB_HOST', 'localhost'),
'PORT': '5432',
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment