-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
trying to run git actions first time
- Loading branch information
1 parent
0b5be98
commit cda93d6
Showing
6 changed files
with
56 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,20 @@ | ||
# This workflow will install Python dependencies, run tests and lint with a single version of Python | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | ||
|
||
name: Python application | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.10" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install flake8 pytest | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
- name: Lint with flake8 | ||
run: | | ||
# stop the build if there are Python syntax errors or undefined names | ||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | ||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | ||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | ||
- name: Test with pytest | ||
run: | | ||
pytest | ||
- name: Install dependencies | ||
run: / | ||
python -m pip install --upgrade zip | ||
if [ -f requirements.txt ]; tehn pip install -r requirements.txt; fi | ||
- name: Test selenium | ||
run: / | ||
python manage.py test |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,56 @@ | ||
from django.test import LiveServerTestCase | ||
from selenium import webdriver | ||
from selenium.webdriver.common.keys import Keys | ||
from selenium.webdriver.chrome.options import Options | ||
from django.contrib.auth.models import User | ||
import time | ||
import django | ||
|
||
class Hosttest(LiveServerTestCase): | ||
|
||
def testhomepage(self): | ||
|
||
class LoginFormTest(LiveServerTestCase): | ||
options = Options() | ||
options.headless = True | ||
driver = webdriver.Chrome(options=options) | ||
|
||
driver.get(self.live_server_url) | ||
# try driver.get(self.live_server_url) if driver.get('http://127.0.0.1:8000/') does not work | ||
|
||
assert "Hello, world!" in driver.title | ||
|
||
# class LoginFormTest(LiveServerTestCase): | ||
|
||
|
||
port = 8000 | ||
host = '127.0.0.1' | ||
def setUp(self): | ||
self.selenium = webdriver.Chrome(executable_path="/Users/mueezkhan/django-test/chromedriver") | ||
super(LoginFormTest, self).setUp() | ||
# port = 8000 | ||
# host = '127.0.0.1' | ||
# def setUp(self): | ||
# self.selenium = webdriver.Chrome(executable_path="/Users/mueezkhan/django-test/chromedriver") | ||
# super(LoginFormTest, self).setUp() | ||
|
||
|
||
def tearDown(self): | ||
self.selenium.quit() | ||
super(LoginFormTest, self).tearDown() | ||
# def tearDown(self): | ||
# self.selenium.quit() | ||
# super(LoginFormTest, self).tearDown() | ||
|
||
def testform(self): | ||
driver = self.selenium | ||
# super(LoginFormTest, self).setUp() | ||
driver.get(f"http://127.0.0.1:8000/accounts/login") | ||
|
||
# user = User.objects.create_user('kamil', '[email protected]', 'kamil') | ||
|
||
# print(user) | ||
# time.sleep(1) | ||
user_name = driver.find_element_by_name('username') | ||
user_password = driver.find_element_by_name('password') | ||
time.sleep(3) | ||
submit = driver.find_element_by_id('submit') | ||
|
||
user_name.send_keys('kamil') | ||
user_password.send_keys('kamil') | ||
|
||
submit.send_keys(Keys.RETURN) | ||
time.sleep(3) | ||
print(driver.page_source) | ||
assert 'kamil' in driver.page_source | ||
# def testform(self): | ||
# driver = self.selenium | ||
# # super(LoginFormTest, self).setUp() | ||
# driver.get(f"http://127.0.0.1:8000/accounts/login") | ||
|
||
# # user = User.objects.create_user('kamil', '[email protected]', 'kamil') | ||
|
||
# # print(user) | ||
# # time.sleep(1) | ||
# user_name = driver.find_element_by_name('username') | ||
# user_password = driver.find_element_by_name('password') | ||
# time.sleep(3) | ||
# submit = driver.find_element_by_id('submit') | ||
|
||
# user_name.send_keys('kamil') | ||
# user_password.send_keys('kamil') | ||
|
||
# submit.send_keys(Keys.RETURN) | ||
# time.sleep(3) | ||
# print(driver.page_source) | ||
# assert 'kamil' in driver.page_source | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters