Skip to content

Commit fbe6a83

Browse files
author
rpobotin
committed
Refactor project structure, update Python version to 3.12, and enhance test organization with new page objects
1 parent c755156 commit fbe6a83

31 files changed

+1441
-428
lines changed

.github/workflows/pylint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ jobs:
99

1010
steps:
1111
- uses: actions/checkout@v2
12-
- name: Set up Python 3.8
12+
- name: Set up Python 3.12
1313
uses: actions/setup-python@v1
1414
with:
15-
python-version: 3.8
15+
python-version: 3.12
1616
- name: Install dependencies
1717
run: |
1818
python -m pip install --upgrade pip

.github/workflows/pytest.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
runs-on: ubuntu-latest
99
strategy:
1010
matrix:
11-
python-version: [ 3.8 ]
11+
python-version: [ 3.12 ]
1212

1313
steps:
1414
- uses: actions/checkout@v2
@@ -20,7 +20,7 @@ jobs:
2020
run: |
2121
python -m pip install --upgrade pip
2222
pip install flake8 pytest
23-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
23+
if [ -f requirements.txt ]; then uv pip install -r requirements.txt --upgrade; fi
2424
- name: Install browsers
2525
run: python -m playwright install
2626
- name: Test with pytest

.pre-commit-config.yaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.5.0
4+
hooks:
5+
# Run the linter.
6+
- id: ruff
7+
args: [ --fix ]
8+
9+
- repo: local
10+
hooks:
11+
- id: code-smell-check
12+
name: Check code smells in pytest tests
13+
entry: bash
14+
language: system
15+
pass_filenames: false
16+
args:
17+
- "-c"
18+
- |
19+
# Run analysis
20+
output=$(python utils/code_smells.py --dir=tests)
21+
22+
echo "$output"
23+
24+
percentage=$(echo "$output" | grep "Percentage of 'smelly' tests: " | awk '{print $5}' | sed 's/%//')
25+
26+
# Check if percentage is numeric
27+
if ! [[ "$percentage" =~ ^[0-9]+(\.[0-9]+)?$ ]]; then
28+
echo "Failed to determine the percentage of 'smelly' tests. Make sure the output contains the expected line."
29+
exit 1
30+
fi
31+
32+
# Now safely compare - if percentage is 50% or higher, block the commit
33+
result=$(echo "$percentage >= 50" | bc)
34+
if [ "$result" -eq 1 ]; then
35+
echo "Too many 'smelly' tests (${percentage}%). Commit blocked!"
36+
exit 1
37+
else
38+
echo "Acceptable level of 'smelly' tests (${percentage}%). Commit allowed."
39+
fi
40+
41+
always_run: true
42+
verbose: true
43+
44+
- id: framework-unit-tests
45+
name: Run framework unit tests
46+
entry: pytest
47+
language: system
48+
pass_filenames: false
49+
args: [
50+
"-m unit",
51+
"-v"
52+
]
53+
always_run: true
54+
verbose: true

Dockerfile

Lines changed: 0 additions & 49 deletions
This file was deleted.

0 commit comments

Comments
 (0)