Add settings for playwright-pytest

This commit is contained in:
keisuke-umezawa
2023-06-04 15:00:25 +09:00
parent 11bcc02867
commit 4f5cf5fd3d
3 changed files with 72 additions and 0 deletions
+50
View File
@@ -0,0 +1,50 @@
name: integration-tests
on:
pull_request:
branches:
- main
paths:
- '.github/workflows/integration-tests.yml'
- '**.py'
- '**.ts'
- '**.tsx'
- 'package.json'
- 'package-lock.json'
- 'tsconfig.json'
jobs:
test:
runs-on: ubuntu-20.04
strategy:
matrix:
optuna-version: ['optuna==2.10.0', 'git+https://github.com/optuna/optuna.git']
steps:
- uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '16'
- run: npm install
- run: npm run build:dev
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
architecture: x64
- name: Setup Optuna ${{ matrix.optuna-version }}
run: |
python -m pip install --progress-bar off --upgrade pip setuptools
python -m pip install --progress-bar off --upgrade ${{ matrix.optuna-version }}
- name: Install dependencies
run: |
python -m pip install --progress-bar off .
python -m pip install --progress-bar off pytest-playwright
- name: Install the required browsers
run: playwright install
- name: Run e2e tests
run: pytest e2e_tests
+21
View File
@@ -0,0 +1,21 @@
import re
from playwright.sync_api import Page, expect
def test_homepage_has_Playwright_in_title_and_get_started_link_linking_to_the_intro_page(page: Page):
page.goto("https://playwright.dev/")
# Expect a title "to contain" a substring.
expect(page).to_have_title(re.compile("Playwright"))
# create a locator
get_started = page.get_by_role("link", name="Get started")
# Expect an attribute "to be strictly equal" to the value.
expect(get_started).to_have_attribute("href", "/docs/intro")
# Click the get started link.
get_started.click()
# Expects the URL to contain intro.
expect(page).to_have_url(re.compile(".*intro"))
+1
View File
@@ -17,6 +17,7 @@ moto[s3]
# visual regression tests
pyppeteer
pytest-playwright
# docs
sphinx