selenium-expect 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- selenium_expect-1.0.0/.editorconfig +17 -0
- selenium_expect-1.0.0/.github/ISSUE_TEMPLATE/bug_report.md +37 -0
- selenium_expect-1.0.0/.github/ISSUE_TEMPLATE/feature_request.md +18 -0
- selenium_expect-1.0.0/.github/PULL_REQUEST_TEMPLATE.md +20 -0
- selenium_expect-1.0.0/.github/dependabot.yml +24 -0
- selenium_expect-1.0.0/.github/workflows/ci.yml +66 -0
- selenium_expect-1.0.0/.github/workflows/docs.yml +37 -0
- selenium_expect-1.0.0/.github/workflows/release.yml +57 -0
- selenium_expect-1.0.0/.gitignore +45 -0
- selenium_expect-1.0.0/.pre-commit-config.yaml +24 -0
- selenium_expect-1.0.0/CHANGELOG.md +57 -0
- selenium_expect-1.0.0/CODE_OF_CONDUCT.md +43 -0
- selenium_expect-1.0.0/CONTRIBUTING.md +108 -0
- selenium_expect-1.0.0/LICENSE +21 -0
- selenium_expect-1.0.0/Makefile +61 -0
- selenium_expect-1.0.0/PKG-INFO +666 -0
- selenium_expect-1.0.0/README.md +627 -0
- selenium_expect-1.0.0/SECURITY.md +19 -0
- selenium_expect-1.0.0/docs/api-reference.md +440 -0
- selenium_expect-1.0.0/docs/assertions/alert.md +148 -0
- selenium_expect-1.0.0/docs/assertions/cookie.md +282 -0
- selenium_expect-1.0.0/docs/assertions/driver.md +592 -0
- selenium_expect-1.0.0/docs/assertions/element.md +1396 -0
- selenium_expect-1.0.0/docs/assertions/iframe.md +163 -0
- selenium_expect-1.0.0/docs/assertions/js.md +315 -0
- selenium_expect-1.0.0/docs/assertions/list.md +420 -0
- selenium_expect-1.0.0/docs/assertions/select.md +355 -0
- selenium_expect-1.0.0/docs/assertions/shadow.md +159 -0
- selenium_expect-1.0.0/docs/assertions/window.md +126 -0
- selenium_expect-1.0.0/docs/changelog.md +3 -0
- selenium_expect-1.0.0/docs/getting-started.md +284 -0
- selenium_expect-1.0.0/docs/guide/composition.md +133 -0
- selenium_expect-1.0.0/docs/guide/configuration.md +178 -0
- selenium_expect-1.0.0/docs/guide/custom-matchers.md +185 -0
- selenium_expect-1.0.0/docs/guide/error-messages.md +135 -0
- selenium_expect-1.0.0/docs/guide/locator-based.md +148 -0
- selenium_expect-1.0.0/docs/guide/migration.md +202 -0
- selenium_expect-1.0.0/docs/guide/poll.md +187 -0
- selenium_expect-1.0.0/docs/guide/soft-assertions.md +137 -0
- selenium_expect-1.0.0/docs/index.md +184 -0
- selenium_expect-1.0.0/mkdocs.yml +97 -0
- selenium_expect-1.0.0/pyproject.toml +103 -0
- selenium_expect-1.0.0/selenium_expect/__init__.py +35 -0
- selenium_expect-1.0.0/selenium_expect/_compose.py +117 -0
- selenium_expect-1.0.0/selenium_expect/_config.py +96 -0
- selenium_expect-1.0.0/selenium_expect/_errors.py +57 -0
- selenium_expect-1.0.0/selenium_expect/_expect.py +181 -0
- selenium_expect-1.0.0/selenium_expect/_locator.py +157 -0
- selenium_expect-1.0.0/selenium_expect/_matcher.py +111 -0
- selenium_expect-1.0.0/selenium_expect/_poll.py +221 -0
- selenium_expect-1.0.0/selenium_expect/_retry.py +145 -0
- selenium_expect-1.0.0/selenium_expect/_soft.py +49 -0
- selenium_expect-1.0.0/selenium_expect/assertions/__init__.py +30 -0
- selenium_expect-1.0.0/selenium_expect/assertions/_base.py +311 -0
- selenium_expect-1.0.0/selenium_expect/assertions/alert.py +131 -0
- selenium_expect-1.0.0/selenium_expect/assertions/cookie.py +330 -0
- selenium_expect-1.0.0/selenium_expect/assertions/driver.py +681 -0
- selenium_expect-1.0.0/selenium_expect/assertions/element.py +1755 -0
- selenium_expect-1.0.0/selenium_expect/assertions/iframe.py +191 -0
- selenium_expect-1.0.0/selenium_expect/assertions/js.py +353 -0
- selenium_expect-1.0.0/selenium_expect/assertions/list.py +763 -0
- selenium_expect-1.0.0/selenium_expect/assertions/select.py +386 -0
- selenium_expect-1.0.0/selenium_expect/assertions/shadow.py +175 -0
- selenium_expect-1.0.0/selenium_expect/assertions/window.py +118 -0
- selenium_expect-1.0.0/selenium_expect/py.typed +0 -0
- selenium_expect-1.0.0/tests/__init__.py +0 -0
- selenium_expect-1.0.0/tests/conftest.py +386 -0
- selenium_expect-1.0.0/tests/integration/__init__.py +0 -0
- selenium_expect-1.0.0/tests/integration/conftest.py +149 -0
- selenium_expect-1.0.0/tests/integration/test_alert.py +26 -0
- selenium_expect-1.0.0/tests/integration/test_compose.py +47 -0
- selenium_expect-1.0.0/tests/integration/test_cookie.py +30 -0
- selenium_expect-1.0.0/tests/integration/test_driver.py +40 -0
- selenium_expect-1.0.0/tests/integration/test_element.py +130 -0
- selenium_expect-1.0.0/tests/integration/test_iframe.py +22 -0
- selenium_expect-1.0.0/tests/integration/test_js.py +25 -0
- selenium_expect-1.0.0/tests/integration/test_list.py +34 -0
- selenium_expect-1.0.0/tests/integration/test_locator.py +24 -0
- selenium_expect-1.0.0/tests/integration/test_poll.py +28 -0
- selenium_expect-1.0.0/tests/integration/test_select.py +45 -0
- selenium_expect-1.0.0/tests/integration/test_shadow.py +32 -0
- selenium_expect-1.0.0/tests/integration/test_soft.py +28 -0
- selenium_expect-1.0.0/tests/test_smoke.py +26 -0
- selenium_expect-1.0.0/tests/unit/__init__.py +0 -0
- selenium_expect-1.0.0/tests/unit/test_assertions_alert.py +49 -0
- selenium_expect-1.0.0/tests/unit/test_assertions_cookie.py +81 -0
- selenium_expect-1.0.0/tests/unit/test_assertions_driver.py +216 -0
- selenium_expect-1.0.0/tests/unit/test_assertions_element.py +319 -0
- selenium_expect-1.0.0/tests/unit/test_assertions_iframe.py +61 -0
- selenium_expect-1.0.0/tests/unit/test_assertions_js.py +89 -0
- selenium_expect-1.0.0/tests/unit/test_assertions_list.py +391 -0
- selenium_expect-1.0.0/tests/unit/test_assertions_select.py +138 -0
- selenium_expect-1.0.0/tests/unit/test_assertions_shadow.py +53 -0
- selenium_expect-1.0.0/tests/unit/test_assertions_window.py +35 -0
- selenium_expect-1.0.0/tests/unit/test_base_features.py +160 -0
- selenium_expect-1.0.0/tests/unit/test_compose.py +232 -0
- selenium_expect-1.0.0/tests/unit/test_config.py +119 -0
- selenium_expect-1.0.0/tests/unit/test_errors.py +171 -0
- selenium_expect-1.0.0/tests/unit/test_expect.py +161 -0
- selenium_expect-1.0.0/tests/unit/test_locator.py +223 -0
- selenium_expect-1.0.0/tests/unit/test_matcher.py +221 -0
- selenium_expect-1.0.0/tests/unit/test_medium_priority.py +599 -0
- selenium_expect-1.0.0/tests/unit/test_poll.py +174 -0
- selenium_expect-1.0.0/tests/unit/test_regression_fixes.py +417 -0
- selenium_expect-1.0.0/tests/unit/test_retry.py +239 -0
- selenium_expect-1.0.0/tests/unit/test_soft.py +94 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
root = true
|
|
2
|
+
|
|
3
|
+
[*]
|
|
4
|
+
end_of_line = lf
|
|
5
|
+
insert_final_newline = true
|
|
6
|
+
trim_trailing_whitespace = true
|
|
7
|
+
|
|
8
|
+
[*.{py,toml}]
|
|
9
|
+
charset = utf-8
|
|
10
|
+
indent_style = space
|
|
11
|
+
indent_size = 4
|
|
12
|
+
|
|
13
|
+
[*.{yml,yaml,json,md}]
|
|
14
|
+
indent_size = 2
|
|
15
|
+
|
|
16
|
+
[Makefile]
|
|
17
|
+
indent_style = tab
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Report a bug or unexpected behavior
|
|
4
|
+
title: "[Bug] "
|
|
5
|
+
labels: bug
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Description
|
|
9
|
+
|
|
10
|
+
<!-- A clear description of the bug -->
|
|
11
|
+
|
|
12
|
+
## Reproduction
|
|
13
|
+
|
|
14
|
+
```python
|
|
15
|
+
# Minimal code to reproduce
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Expected behavior
|
|
19
|
+
|
|
20
|
+
<!-- What you expected to happen -->
|
|
21
|
+
|
|
22
|
+
## Actual behavior
|
|
23
|
+
|
|
24
|
+
<!-- What actually happened -->
|
|
25
|
+
|
|
26
|
+
## Environment
|
|
27
|
+
|
|
28
|
+
- selenium-expect version:
|
|
29
|
+
- Selenium version:
|
|
30
|
+
- Python version:
|
|
31
|
+
- OS:
|
|
32
|
+
|
|
33
|
+
## Stack trace
|
|
34
|
+
|
|
35
|
+
```text
|
|
36
|
+
<!-- Paste any error output here -->
|
|
37
|
+
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature request
|
|
3
|
+
about: Suggest a new assertion or enhancement
|
|
4
|
+
title: "[Feature] "
|
|
5
|
+
labels: enhancement
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Motivation
|
|
9
|
+
|
|
10
|
+
<!-- Why is this needed? What problem does it solve? -->
|
|
11
|
+
|
|
12
|
+
## Proposal
|
|
13
|
+
|
|
14
|
+
<!-- Describe the feature or assertion you'd like to see -->
|
|
15
|
+
|
|
16
|
+
## Alternatives considered
|
|
17
|
+
|
|
18
|
+
<!-- Any alternatives you've considered -->
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
## Summary
|
|
2
|
+
|
|
3
|
+
<!-- Brief description of what this PR does -->
|
|
4
|
+
|
|
5
|
+
## Type of change
|
|
6
|
+
|
|
7
|
+
- [ ] Bug fix
|
|
8
|
+
- [ ] New feature
|
|
9
|
+
- [ ] Breaking change
|
|
10
|
+
- [ ] Documentation
|
|
11
|
+
- [ ] Refactor
|
|
12
|
+
|
|
13
|
+
## Checklist
|
|
14
|
+
|
|
15
|
+
- [ ] `ruff check .` passes
|
|
16
|
+
- [ ] `ruff format --check .` passes
|
|
17
|
+
- [ ] `mypy --strict selenium_expect` passes
|
|
18
|
+
- [ ] `pytest` passes with >= 90% coverage
|
|
19
|
+
- [ ] New behavior is covered by tests
|
|
20
|
+
- [ ] `CHANGELOG.md` updated under `[Unreleased]`
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
- package-ecosystem: pip
|
|
4
|
+
directory: "/"
|
|
5
|
+
schedule:
|
|
6
|
+
interval: weekly
|
|
7
|
+
labels:
|
|
8
|
+
- dependencies
|
|
9
|
+
- python
|
|
10
|
+
groups:
|
|
11
|
+
dev-dependencies:
|
|
12
|
+
patterns:
|
|
13
|
+
- "pytest*"
|
|
14
|
+
- "ruff"
|
|
15
|
+
- "mypy"
|
|
16
|
+
- "build"
|
|
17
|
+
- "pre-commit"
|
|
18
|
+
- package-ecosystem: github-actions
|
|
19
|
+
directory: "/"
|
|
20
|
+
schedule:
|
|
21
|
+
interval: weekly
|
|
22
|
+
labels:
|
|
23
|
+
- dependencies
|
|
24
|
+
- github-actions
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
|
|
13
|
+
concurrency:
|
|
14
|
+
group: ci-${{ github.ref }}
|
|
15
|
+
cancel-in-progress: true
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
lint:
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v5
|
|
22
|
+
- uses: actions/setup-python@v7
|
|
23
|
+
with:
|
|
24
|
+
python-version: "3.13"
|
|
25
|
+
- run: pip install -e ".[dev]"
|
|
26
|
+
- run: ruff check .
|
|
27
|
+
- run: ruff format --check .
|
|
28
|
+
- run: mypy --strict selenium_expect
|
|
29
|
+
|
|
30
|
+
test:
|
|
31
|
+
runs-on: ${{ matrix.os }}
|
|
32
|
+
strategy:
|
|
33
|
+
fail-fast: false
|
|
34
|
+
matrix:
|
|
35
|
+
os: [ubuntu-latest]
|
|
36
|
+
python-version: ["3.11", "3.12", "3.13", "3.14"]
|
|
37
|
+
include:
|
|
38
|
+
- os: windows-latest
|
|
39
|
+
python-version: "3.13"
|
|
40
|
+
- os: macos-latest
|
|
41
|
+
python-version: "3.13"
|
|
42
|
+
steps:
|
|
43
|
+
- uses: actions/checkout@v5
|
|
44
|
+
- uses: actions/setup-python@v7
|
|
45
|
+
with:
|
|
46
|
+
python-version: ${{ matrix.python-version }}
|
|
47
|
+
- run: pip install -e ".[dev]"
|
|
48
|
+
- run: pytest tests/ -v --cov --cov-report=xml
|
|
49
|
+
- uses: codecov/codecov-action@v7
|
|
50
|
+
with:
|
|
51
|
+
files: ./coverage.xml
|
|
52
|
+
|
|
53
|
+
build:
|
|
54
|
+
runs-on: ubuntu-latest
|
|
55
|
+
needs: [lint, test]
|
|
56
|
+
steps:
|
|
57
|
+
- uses: actions/checkout@v5
|
|
58
|
+
- uses: actions/setup-python@v7
|
|
59
|
+
with:
|
|
60
|
+
python-version: "3.13"
|
|
61
|
+
- run: pip install build
|
|
62
|
+
- run: python -m build
|
|
63
|
+
- uses: actions/upload-artifact@v7
|
|
64
|
+
with:
|
|
65
|
+
name: dist
|
|
66
|
+
path: dist/
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
name: Docs
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
pages: write
|
|
11
|
+
id-token: write
|
|
12
|
+
|
|
13
|
+
concurrency:
|
|
14
|
+
group: pages
|
|
15
|
+
cancel-in-progress: true
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
build-deploy:
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
environment:
|
|
21
|
+
name: github-pages
|
|
22
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
23
|
+
steps:
|
|
24
|
+
- uses: actions/checkout@v5
|
|
25
|
+
with:
|
|
26
|
+
fetch-depth: 0
|
|
27
|
+
- uses: actions/setup-python@v7
|
|
28
|
+
with:
|
|
29
|
+
python-version: "3.13"
|
|
30
|
+
- run: pip install -e ".[docs]"
|
|
31
|
+
- run: mkdocs build --strict
|
|
32
|
+
- uses: actions/configure-pages@v5
|
|
33
|
+
- uses: actions/upload-pages-artifact@v5
|
|
34
|
+
with:
|
|
35
|
+
path: ./site
|
|
36
|
+
- id: deployment
|
|
37
|
+
uses: actions/deploy-pages@v4
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
build:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v5
|
|
16
|
+
- uses: actions/setup-python@v7
|
|
17
|
+
with:
|
|
18
|
+
python-version: "3.13"
|
|
19
|
+
- run: pip install build
|
|
20
|
+
- run: python -m build
|
|
21
|
+
- uses: actions/upload-artifact@v7
|
|
22
|
+
with:
|
|
23
|
+
name: dist
|
|
24
|
+
path: dist/
|
|
25
|
+
|
|
26
|
+
publish-pypi:
|
|
27
|
+
needs: build
|
|
28
|
+
runs-on: ubuntu-latest
|
|
29
|
+
environment: pypi
|
|
30
|
+
permissions:
|
|
31
|
+
id-token: write
|
|
32
|
+
steps:
|
|
33
|
+
- uses: actions/download-artifact@v7
|
|
34
|
+
with:
|
|
35
|
+
name: dist
|
|
36
|
+
path: dist/
|
|
37
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
38
|
+
|
|
39
|
+
release-github:
|
|
40
|
+
needs: build
|
|
41
|
+
runs-on: ubuntu-latest
|
|
42
|
+
permissions:
|
|
43
|
+
contents: write
|
|
44
|
+
steps:
|
|
45
|
+
- uses: actions/download-artifact@v7
|
|
46
|
+
with:
|
|
47
|
+
name: dist
|
|
48
|
+
path: dist/
|
|
49
|
+
- name: Create GitHub Release
|
|
50
|
+
env:
|
|
51
|
+
GH_TOKEN: ${{ github.token }}
|
|
52
|
+
run: |
|
|
53
|
+
tag="${GITHUB_REF#refs/tags/}"
|
|
54
|
+
gh release create "$tag" \
|
|
55
|
+
--title "$tag" \
|
|
56
|
+
--generate-notes \
|
|
57
|
+
dist/*
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.egg-info/
|
|
6
|
+
*.egg
|
|
7
|
+
dist/
|
|
8
|
+
build/
|
|
9
|
+
.eggs/
|
|
10
|
+
|
|
11
|
+
# Testing
|
|
12
|
+
.pytest_cache/
|
|
13
|
+
.coverage
|
|
14
|
+
htmlcov/
|
|
15
|
+
coverage.xml
|
|
16
|
+
|
|
17
|
+
# Type checking
|
|
18
|
+
.mypy_cache/
|
|
19
|
+
.ruff_cache/
|
|
20
|
+
|
|
21
|
+
# Virtual environments
|
|
22
|
+
.venv/
|
|
23
|
+
venv/
|
|
24
|
+
env/
|
|
25
|
+
|
|
26
|
+
# IDE
|
|
27
|
+
.idea/
|
|
28
|
+
.vscode/
|
|
29
|
+
*.swp
|
|
30
|
+
*.swo
|
|
31
|
+
|
|
32
|
+
# Docs
|
|
33
|
+
site/
|
|
34
|
+
|
|
35
|
+
# OS
|
|
36
|
+
.DS_Store
|
|
37
|
+
Thumbs.db
|
|
38
|
+
|
|
39
|
+
# Project
|
|
40
|
+
ref/
|
|
41
|
+
screenshots/
|
|
42
|
+
tests/integration/test_page.html
|
|
43
|
+
|
|
44
|
+
# AI assistant context
|
|
45
|
+
AGENTS.md
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
3
|
+
rev: v5.0.0
|
|
4
|
+
hooks:
|
|
5
|
+
- id: trailing-whitespace
|
|
6
|
+
- id: end-of-file-fixer
|
|
7
|
+
- id: check-yaml
|
|
8
|
+
- id: check-toml
|
|
9
|
+
- id: check-json
|
|
10
|
+
- id: check-merge-conflict
|
|
11
|
+
- id: check-added-large-files
|
|
12
|
+
- id: detect-private-key
|
|
13
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
14
|
+
rev: v0.8.0
|
|
15
|
+
hooks:
|
|
16
|
+
- id: ruff
|
|
17
|
+
args: [--fix]
|
|
18
|
+
- id: ruff-format
|
|
19
|
+
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
20
|
+
rev: v1.11.0
|
|
21
|
+
hooks:
|
|
22
|
+
- id: mypy
|
|
23
|
+
additional_dependencies: ["selenium>=4.10"]
|
|
24
|
+
args: [--strict, selenium_expect]
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [1.0.0] - 2026-08-27
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Project skeleton with CI, linting, and build infrastructure
|
|
13
|
+
- Regression tests for all bug fixes listed below
|
|
14
|
+
- `CONTRIBUTING.md` with development setup, testing guidelines, and architecture overview
|
|
15
|
+
- `SECURITY.md` with vulnerability reporting policy
|
|
16
|
+
- `CODE_OF_CONDUCT.md` based on Contributor Covenant 2.1
|
|
17
|
+
- GitHub issue templates for bug reports and feature requests
|
|
18
|
+
- Automated release workflow (`.github/workflows/release.yml`) with PyPI trusted publishing and GitHub Releases
|
|
19
|
+
- `expect.configure()` example and Features section to README
|
|
20
|
+
- Ruff badge to README header
|
|
21
|
+
- Comprehensive MkDocs documentation with Material theme
|
|
22
|
+
- Auto-retry polling with configurable timeout and backoff schedules
|
|
23
|
+
- Fluent assertion API for `WebElement`, `WebDriver`, `list[WebElement]`, `Alert`, `Select`, `ShadowRoot`, iframes, cookies, JavaScript, and windows
|
|
24
|
+
- Locator-based expect to avoid `StaleElementReferenceException`
|
|
25
|
+
- Soft assertions with `SoftAssertionCollector` and `assert_all()`
|
|
26
|
+
- Custom matchers via `@extend` decorator and `merge_expects()`
|
|
27
|
+
- `expect.poll()` for retry-based assertions on arbitrary functions
|
|
28
|
+
- `ExpectConfig` dataclass for global and per-assertion configuration
|
|
29
|
+
- Screenshot capture on assertion failure
|
|
30
|
+
- Debug mode with per-poll logging
|
|
31
|
+
- Descriptive error messages with timelines and actual vs expected values
|
|
32
|
+
- Composition assertions: `to_satisfy_all`, `to_satisfy_any`, `to_satisfy_none`
|
|
33
|
+
- Negation via `.not_` on all assertions
|
|
34
|
+
|
|
35
|
+
### Fixed
|
|
36
|
+
|
|
37
|
+
- **`_retry.py`**: Empty `polling_intervals` list caused `IndexError` on first poll
|
|
38
|
+
- **`_retry.py`**: `timeout=0` skipped the first poll, never evaluating the condition
|
|
39
|
+
- **`_config.py`**: `ExpectConfig` did not validate empty `polling_intervals` lists
|
|
40
|
+
- **`_config.py`**: `set_default_timeout()` did not normalize milliseconds (int >= 1000 treated as seconds instead of ms)
|
|
41
|
+
- **`_poll.py`**: `PollAssertion.to_contain()` crashed on falsy non-string values (`0`, `False`, `[]`)
|
|
42
|
+
- **`_poll.py`**: `PollAssertion` did not normalize timeout consistently with `expect()`
|
|
43
|
+
- **`_poll.py`**: Missing validation for empty per-assertion `polling` lists
|
|
44
|
+
- **`_expect.py`**: `expect(timeout=5000)` stored 5000 seconds instead of 5 seconds (timeout not normalized before config overrides)
|
|
45
|
+
- **`_locator.py`**: `LocatorExpect.__getattr__` did not fall back to `CustomMatcherRegistry`, breaking custom matchers on locator-based assertions
|
|
46
|
+
- **`list.py`**: `to_have_texts_contains` and `to_have_texts_containing` crashed on `None` element text
|
|
47
|
+
- **`js.py`**: `to_have_js_result_contains` crashed on falsy non-string values (`0`, `False`, `[]`)
|
|
48
|
+
- **`js.py`**: JavaScript injection vulnerability in `localStorage`, `sessionStorage`, and `to_have_js_variable` methods (f-string interpolation replaced with `arguments[0]` parameter passing)
|
|
49
|
+
- **`driver.py`**: `to_have_capability_contains` crashed on falsy non-string capability values (`False`, `0`)
|
|
50
|
+
- **`element.py`**: `to_have_property_contains` crashed on falsy non-string property values (`False`, `0`)
|
|
51
|
+
|
|
52
|
+
### Changed
|
|
53
|
+
|
|
54
|
+
- **`_expect.py`**: Replaced `expect` function with monkeypatched `.poll`/`.configure` attributes with a proper `Expect` callable class — eliminates `type: ignore`, improves type safety and API discoverability
|
|
55
|
+
- **`_base.py`**: Replaced `os`/`os.path` with `pathlib.Path` for screenshot path handling
|
|
56
|
+
- **`_base.py`**: Screenshot timestamps now use timezone-aware `datetime.now(tz=UTC)` instead of naive `datetime.now()`
|
|
57
|
+
- **`_config.py`**: Centralized `normalize_timeout` function imported by all modules that need timeout normalization
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our pledge
|
|
4
|
+
|
|
5
|
+
We pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
|
6
|
+
|
|
7
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
|
8
|
+
|
|
9
|
+
## Our standards
|
|
10
|
+
|
|
11
|
+
Examples of behavior that contributes to a positive environment:
|
|
12
|
+
|
|
13
|
+
- Demonstrating empathy and kindness toward other people
|
|
14
|
+
- Being respectful of differing opinions, viewpoints, and experiences
|
|
15
|
+
- Giving and gracefully accepting constructive feedback
|
|
16
|
+
- Accepting responsibility and apologizing to those affected by our mistakes
|
|
17
|
+
- Focusing on what is best for the overall community
|
|
18
|
+
|
|
19
|
+
Examples of unacceptable behavior:
|
|
20
|
+
|
|
21
|
+
- The use of sexualized language or imagery, and sexual attention or advances
|
|
22
|
+
- Trolling, insulting or derogatory comments, and personal or political attacks
|
|
23
|
+
- Public or private harassment
|
|
24
|
+
- Publishing others' private information without explicit permission
|
|
25
|
+
- Other conduct which could reasonably be considered inappropriate
|
|
26
|
+
|
|
27
|
+
## Enforcement responsibilities
|
|
28
|
+
|
|
29
|
+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior they deem inappropriate, threatening, offensive, or harmful.
|
|
30
|
+
|
|
31
|
+
## Scope
|
|
32
|
+
|
|
33
|
+
This Code of Conduct applies within all community spaces and also applies when an individual is officially representing the community in public spaces.
|
|
34
|
+
|
|
35
|
+
## Enforcement
|
|
36
|
+
|
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at **mathias.paulenko@outlook.com**. All complaints will be reviewed and investigated promptly and fairly.
|
|
38
|
+
|
|
39
|
+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
|
40
|
+
|
|
41
|
+
## Attribution
|
|
42
|
+
|
|
43
|
+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/), version 2.1, available at <https://www.contributor-covenant.org/version/2/1/code_of_conduct/>.
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Contributing to selenium-expect
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing! This document covers the
|
|
4
|
+
essential setup and workflow for contributors.
|
|
5
|
+
|
|
6
|
+
## Development setup
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
git clone https://github.com/MathiasPaulenko/selenium-expect.git
|
|
10
|
+
cd selenium-expect
|
|
11
|
+
pip install -e ".[dev]"
|
|
12
|
+
pre-commit install
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Daily workflow
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
make check # lint + format check + type check + tests
|
|
19
|
+
make lint-fix # auto-fix lint issues
|
|
20
|
+
make format # format code
|
|
21
|
+
make test # run unit tests
|
|
22
|
+
make test-cov # run tests with coverage report
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Code quality gates
|
|
26
|
+
|
|
27
|
+
All contributions must pass:
|
|
28
|
+
|
|
29
|
+
- **ruff** — linting and formatting (`ruff check` + `ruff format --check`)
|
|
30
|
+
- **mypy --strict** — type checking with no `Any` leakage
|
|
31
|
+
- **pytest** — unit tests with >= 90% coverage
|
|
32
|
+
- **pre-commit hooks** — trailing whitespace, YAML/TOML validation, etc.
|
|
33
|
+
|
|
34
|
+
Run `make check` before pushing to catch issues early.
|
|
35
|
+
|
|
36
|
+
## Testing guidelines
|
|
37
|
+
|
|
38
|
+
- **Unit tests** (`tests/unit/`) — fast, no browser required. Mock all
|
|
39
|
+
Selenium objects. Every bug fix must include a regression test.
|
|
40
|
+
- **Integration tests** (`tests/integration/`) — require a real browser
|
|
41
|
+
(Chrome or Firefox). Run with `pytest -m integration`.
|
|
42
|
+
|
|
43
|
+
### Test conventions
|
|
44
|
+
|
|
45
|
+
- Use `pytest` fixtures for shared setup (see `tests/conftest.py`).
|
|
46
|
+
- Mock drivers and elements via `unittest.mock.MagicMock`.
|
|
47
|
+
- Name regression tests descriptively: `test_<scenario>_<expected_behavior>`.
|
|
48
|
+
- Place regression tests in `tests/unit/test_regression_fixes.py`.
|
|
49
|
+
|
|
50
|
+
## Pull request process
|
|
51
|
+
|
|
52
|
+
1. Create a feature branch from `main`.
|
|
53
|
+
2. Write tests for your change.
|
|
54
|
+
3. Ensure `make check` passes.
|
|
55
|
+
4. Update `CHANGELOG.md` under `## [Unreleased]`.
|
|
56
|
+
5. Open a PR with a clear description linking to any relevant issues.
|
|
57
|
+
|
|
58
|
+
## Architecture overview
|
|
59
|
+
|
|
60
|
+
```text
|
|
61
|
+
selenium_expect/
|
|
62
|
+
├── __init__.py # Public API exports
|
|
63
|
+
├── _expect.py # Expect callable class — main dispatcher
|
|
64
|
+
├── _config.py # ExpectConfig (immutable, frozen dataclass)
|
|
65
|
+
├── _retry.py # retry_until() — agnostic retry loop
|
|
66
|
+
├── _poll.py # PollAssertion — expect.poll()
|
|
67
|
+
├── _locator.py # LocatorExpect — re-finds element each poll
|
|
68
|
+
├── _soft.py # SoftAssertionCollector
|
|
69
|
+
├── _matcher.py # Custom matcher registry (@extend)
|
|
70
|
+
├── _compose.py # to_satisfy_all/any/none
|
|
71
|
+
├── _errors.py # AssertionFormatter
|
|
72
|
+
└── assertions/
|
|
73
|
+
├── _base.py # AssertionMixin — _run_assertion()
|
|
74
|
+
├── alert.py # Alert assertions
|
|
75
|
+
├── cookie.py # Cookie assertions
|
|
76
|
+
├── driver.py # WebDriver assertions
|
|
77
|
+
├── element.py # WebElement assertions
|
|
78
|
+
├── iframe.py # iframe assertions
|
|
79
|
+
├── js.py # JavaScript / storage assertions
|
|
80
|
+
├── list.py # List[WebElement] assertions
|
|
81
|
+
├── select.py # Select dropdown assertions
|
|
82
|
+
├── shadow.py # Shadow DOM assertions
|
|
83
|
+
└── window.py # Window assertions
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Key design principles:
|
|
87
|
+
|
|
88
|
+
- **Single retry path**: All assertions go through `_run_assertion()` in
|
|
89
|
+
`_base.py`, which calls `retry_until()` in `_retry.py`.
|
|
90
|
+
- **Immutable config**: `ExpectConfig` is frozen. Use `.replace()` for
|
|
91
|
+
per-assertion overrides.
|
|
92
|
+
- **Negation via flag**: `not_` property sets `_negate` — no duplicated
|
|
93
|
+
methods.
|
|
94
|
+
- **Registry pattern**: `ASSERTION_REGISTRY` maps type names to assertion
|
|
95
|
+
classes. `expect()` dispatches based on target type.
|
|
96
|
+
|
|
97
|
+
## Release process
|
|
98
|
+
|
|
99
|
+
1. Update `CHANGELOG.md` with dated version header.
|
|
100
|
+
2. Update `__version__` in `selenium_expect/__init__.py`.
|
|
101
|
+
3. Update `version` in `pyproject.toml`.
|
|
102
|
+
4. Commit and tag: `git tag v0.x.y`.
|
|
103
|
+
5. Push the tag: `git push origin v0.x.y`.
|
|
104
|
+
6. CI automatically builds, publishes to PyPI (via trusted publishing), and creates a GitHub Release.
|
|
105
|
+
|
|
106
|
+
## License
|
|
107
|
+
|
|
108
|
+
MIT — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mathias Paulenko
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
.PHONY: help install dev lint lint-fix format format-check test test-cov check build docs docs-serve clean
|
|
2
|
+
|
|
3
|
+
help: ## Show this help message
|
|
4
|
+
@echo "Available targets:"
|
|
5
|
+
@echo " make install - Editable install (no dev extras)"
|
|
6
|
+
@echo " make dev - Editable install with dev extras"
|
|
7
|
+
@echo " make lint - Run ruff check + mypy --strict"
|
|
8
|
+
@echo " make lint-fix - Auto-fix lint issues with ruff"
|
|
9
|
+
@echo " make format - Format code with ruff format"
|
|
10
|
+
@echo " make format-check - Verify formatting without changes"
|
|
11
|
+
@echo " make test - Run the test suite"
|
|
12
|
+
@echo " make test-cov - Run tests with coverage (fail under 90%)"
|
|
13
|
+
@echo " make check - Run lint + format-check + test (full pre-commit check)"
|
|
14
|
+
@echo " make build - Build sdist + wheel into dist/"
|
|
15
|
+
@echo " make docs - Build documentation site"
|
|
16
|
+
@echo " make docs-serve - Serve documentation locally"
|
|
17
|
+
@echo " make clean - Remove build artifacts and caches"
|
|
18
|
+
|
|
19
|
+
install: ## Editable install (no dev extras)
|
|
20
|
+
pip install -e .
|
|
21
|
+
|
|
22
|
+
dev: ## Editable install with dev extras
|
|
23
|
+
pip install -e ".[dev]"
|
|
24
|
+
|
|
25
|
+
lint: ## Run ruff check + mypy --strict
|
|
26
|
+
ruff check .
|
|
27
|
+
mypy --strict selenium_expect
|
|
28
|
+
|
|
29
|
+
lint-fix: ## Auto-fix lint issues
|
|
30
|
+
ruff check --fix .
|
|
31
|
+
|
|
32
|
+
format: ## Format code with ruff format
|
|
33
|
+
ruff format .
|
|
34
|
+
|
|
35
|
+
format-check: ## Verify formatting without changes
|
|
36
|
+
ruff format --check .
|
|
37
|
+
|
|
38
|
+
test: ## Run the test suite
|
|
39
|
+
pytest
|
|
40
|
+
|
|
41
|
+
test-cov: ## Run tests with coverage (fail under 90%)
|
|
42
|
+
pytest --cov=selenium_expect --cov-report=term-missing --cov-fail-under=90
|
|
43
|
+
|
|
44
|
+
check: ## Run lint + format-check + test (full pre-commit check)
|
|
45
|
+
ruff check .
|
|
46
|
+
ruff format --check .
|
|
47
|
+
mypy --strict selenium_expect
|
|
48
|
+
pytest
|
|
49
|
+
|
|
50
|
+
build: ## Build sdist + wheel into dist/
|
|
51
|
+
python -m build
|
|
52
|
+
|
|
53
|
+
docs: ## Build documentation site
|
|
54
|
+
mkdocs build --strict
|
|
55
|
+
|
|
56
|
+
docs-serve: ## Serve documentation locally
|
|
57
|
+
mkdocs serve
|
|
58
|
+
|
|
59
|
+
clean: ## Remove build artifacts and caches
|
|
60
|
+
python -c "import shutil, pathlib; [shutil.rmtree(p, ignore_errors=True) for p in ['dist','build','.pytest_cache','.mypy_cache','.ruff_cache','htmlcov','site'] + list(pathlib.Path('.').glob('*.egg-info'))]"
|
|
61
|
+
python -c "import shutil, pathlib; [shutil.rmtree(p, ignore_errors=True) for p in pathlib.Path('.').rglob('__pycache__')]"
|