-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
all_Automation_Git_Actions #106
base: all-automation
Are you sure you want to change the base?
Changes from 145 commits
b6e5e1b
efdf874
2a40803
2e46039
8d06c76
beffa39
30a254e
270f373
b35831e
35e2d84
900b64d
91d65da
9828208
b692c0e
95c451e
f2bad51
3c03c90
f9bd430
d6be537
cf6b51a
5afcfd4
0d64ef1
444ffc9
702b46d
434deb3
2deb159
f1c69c2
bab1247
a1c12c7
002190a
aa64b96
e02e592
7e731d2
d31f1cb
dedc78f
22f767d
153f747
dfc1876
ffe1cfb
f9e2066
234c785
6024972
8ad71b8
0fe8a5f
fbe3b9a
9274dcd
9b120aa
a88abe9
07b29a6
c311d0c
3e10ea5
fbb193b
1a05f9c
a6f52ea
15ca30d
07bcd4b
203a09d
b7564d3
76b7730
41e64c5
2c7cfb7
39cfc5c
91fcf89
d392536
37ec723
d6d5c85
92fb840
e50641d
38b4d3d
d5bd55e
4ec5350
3358a8d
bc33547
250ec75
9f16eee
cd3c014
73c04c2
2f821cf
dc5a84e
4d58c1c
568019f
a5673c7
ce15264
40c4a27
ea3cbe6
fe64129
1498996
9247ca5
6a85dd2
f1d85be
4399f85
71145d8
a401976
1475bd7
373da27
5a45739
d5fc035
2591c52
1e2ff6f
8deeba1
5127f20
dbf4acf
5d31a1d
69d6ecb
9e75e82
19beba6
6afbdfc
e0b5c8a
e935456
88082bb
6a017e2
ef1328d
f3e14d8
4b05363
a0f942a
dc547cc
46c97c7
01399e4
1f1b3c0
f9aa28f
03b6cba
c5b6f3f
2ed0651
7482e94
d7af57b
eb5a52c
717a7d3
1f390b4
12c601a
02bb790
b8080da
9a0fb51
d0ff0df
f087281
22e2622
9807df2
87b8579
3623649
8ba0971
14a9871
3ba1541
70d2a03
f78638c
768b85c
49be92a
577232e
252360f
96243c3
74a357c
85ebc21
b1dbe1a
33a2fa8
ca083fd
516764c
e7c31be
4a99f3d
2fc4e45
d589dbd
cdbd99f
b56581c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Python CI with pytest | ||
|
||
on: | ||
push: | ||
branches: [all_Automation_Actions] | ||
pull_request: | ||
branches: [all_Automation_Actions] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.12' | ||
|
||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y portaudio19-dev python3-dev google-chrome-stable | ||
python -m pip install --upgrade pip | ||
pip install selenium pytest webdriver-manager pyaudio pytest-html pytest-mock gtts comtypes | ||
|
||
- name: Run tests | ||
run: | | ||
cd /home/runner/work/all-learner-ai-app/all-learner-ai-app/allAutomation | ||
pytest my_project/tests/microphoneSimulationTest.py | ||
shell: /usr/bin/bash -e {0} | ||
env: | ||
pythonLocation: /opt/hostedtoolcache/Python/3.12.4/x64 | ||
PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.12.4/x64/lib/pkgconfig | ||
Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.4/x64 | ||
Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.4/x64 | ||
Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.4/x64 | ||
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.12.4/x64/lib | ||
|
||
# jobs: | ||
# build: | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - uses: actions/checkout@v2 | ||
# - name: Install system dependencies | ||
# run: sudo apt-get install -y portaudio19-dev | ||
# - name: Set up Python | ||
# uses: actions/setup-python@v2 | ||
# with: | ||
# python-version: '3.12' | ||
# - name: Install dependencies | ||
# run: | | ||
# python -m pip install --upgrade pip | ||
# pip install pytest==7.3.1 | ||
# pip install selenium==4.10.0 | ||
# pip install pytest-html==3.2.0 | ||
# pip install pytest-mock==3.11.1 | ||
# pip install webdriver-manager==3.8.6 | ||
# pip install pyaudio==0.2.13 | ||
# - name: Run tests | ||
# run: pytest |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -0,0 +1,48 @@ | ||||
import pytest | ||||
from selenium import webdriver | ||||
from selenium.webdriver.chrome.service import Service | ||||
from selenium.webdriver.chrome.options import Options as ChromeOptions | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove unused import.
- from selenium.webdriver.chrome.options import Options as ChromeOptions Committable suggestion
Suggested change
ToolsRuff
|
||||
from webdriver_manager.chrome import ChromeDriverManager | ||||
|
||||
|
||||
@pytest.fixture(scope="module") | ||||
def setup(): | ||||
# Initialize ChromeOptions | ||||
chrome_options = ChromeOptions() | ||||
chrome_options.add_argument('--headless') # Uncomment to run Chrome in headless mode | ||||
chrome_options.add_argument('--no-sandbox') # Bypass OS security model | ||||
chrome_options.add_argument('--disable-dev-shm-usage') # Overcome limited resource problems | ||||
|
||||
chrome_options.add_argument("--remote-debugging-port=9222") | ||||
chrome_options.add_argument("--disable-gpu") | ||||
chrome_options.add_argument("--remote-allow-origins=*") | ||||
chrome_options.add_argument("--incognito") | ||||
chrome_options.add_argument("--use-fake-ui-for-media-stream") | ||||
chrome_options.add_argument("--use-file-for-fake-audio-capture") | ||||
chrome_options.add_argument("--use-fake-ui-for-media-stream") | ||||
chrome_options.add_argument("--use-file-for-fake-audio-capture=output_audio.wav") | ||||
|
||||
# Initialize Chrome WebDriver using WebDriverManager with a specific version | ||||
service = Service(ChromeDriverManager().install()) | ||||
driver = webdriver.Chrome(service=service, options=chrome_options) | ||||
|
||||
driver.maximize_window() | ||||
|
||||
# Return the WebDriver instance for the tests to use | ||||
yield driver | ||||
|
||||
# Teardown - Close the browser | ||||
driver.quit() | ||||
|
||||
|
||||
def test_open_website(setup): | ||||
driver = setup # Using the WebDriver instance from setup fixture | ||||
|
||||
# Open a website | ||||
driver.get('https://d114esnbvw5tst.cloudfront.net/') | ||||
|
||||
# Ensure the page has fully loaded | ||||
driver.implicitly_wait(10) | ||||
|
||||
# Print the title for debugging purposes | ||||
print("Page title is:", driver.title) | ||||
Comment on lines
+42
to
+52
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add assertions to verify the website's content. The function def test_open_website(setup):
driver = setup
driver.get('https://d114esnbvw5tst.cloudfront.net/')
driver.implicitly_wait(10)
assert "Expected Title" in driver.title, "Title does not match"
print("Page title is:", driver.title) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# test_example.py | ||
def add(x, y): | ||
return x + y | ||
|
||
|
||
def test_add(): | ||
assert add(3, 4) == 7 | ||
assert add(1, 1) == 2 | ||
|
||
print("Added two parameters",add(10, 20)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unused import.
selenium.webdriver.chrome.service.Service
is imported but unused.- from selenium.webdriver.chrome.service import Service
Committable suggestion
Tools
Ruff