forked from retoor/devplacepy
fix: correct "bugs" to "issues" in routing table and README references across multiple documentation files
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
# retoor <retoor@molodetz.nl>
|
||||
|
||||
from tests.conftest import BASE_URL
|
||||
|
||||
SUBMIT = "#create-issue-modal button[type='submit']"
|
||||
SPINNER = "#create-issue-modal button[type='submit'] .btn-spinner"
|
||||
|
||||
|
||||
def _open_form(page):
|
||||
page.goto(f"{BASE_URL}/issues", wait_until="domcontentloaded")
|
||||
page.click("button:has-text('Report Issue')")
|
||||
page.fill("#issue-title", "Spinner regression title")
|
||||
page.fill("#issue-description", "Steps to reproduce the spinner regression")
|
||||
|
||||
|
||||
def test_submit_disables_button_and_shows_spinner(alice):
|
||||
page, _ = alice
|
||||
page.route(
|
||||
"**/issues/create",
|
||||
lambda route: route.fulfill(
|
||||
status=200,
|
||||
content_type="application/json",
|
||||
body='{"uid":"spin-job","status_url":"/issues/jobs/spin-job"}',
|
||||
),
|
||||
)
|
||||
page.route(
|
||||
"**/issues/jobs/spin-job",
|
||||
lambda route: route.fulfill(
|
||||
status=200,
|
||||
content_type="application/json",
|
||||
body='{"uid":"spin-job","kind":"issue_create","status":"pending"}',
|
||||
),
|
||||
)
|
||||
_open_form(page)
|
||||
page.click(SUBMIT)
|
||||
page.locator(f"{SUBMIT}.is-loading").wait_for(state="visible")
|
||||
assert page.locator(SUBMIT).is_disabled()
|
||||
assert page.locator(SPINNER).is_visible()
|
||||
|
||||
|
||||
def test_submit_prevents_double_posting(alice):
|
||||
page, _ = alice
|
||||
create_calls = []
|
||||
page.route(
|
||||
"**/issues/create",
|
||||
lambda route: (
|
||||
create_calls.append(1),
|
||||
route.fulfill(
|
||||
status=200,
|
||||
content_type="application/json",
|
||||
body='{"uid":"once-job","status_url":"/issues/jobs/once-job"}',
|
||||
),
|
||||
)[-1],
|
||||
)
|
||||
page.route(
|
||||
"**/issues/jobs/once-job",
|
||||
lambda route: route.fulfill(
|
||||
status=200,
|
||||
content_type="application/json",
|
||||
body='{"uid":"once-job","kind":"issue_create","status":"pending"}',
|
||||
),
|
||||
)
|
||||
_open_form(page)
|
||||
page.click(SUBMIT)
|
||||
page.locator(f"{SUBMIT}.is-loading").wait_for(state="visible")
|
||||
page.evaluate(
|
||||
"document.querySelector('form[data-issue-create]')"
|
||||
".dispatchEvent(new Event('submit', {cancelable: true, bubbles: true}))"
|
||||
)
|
||||
page.wait_for_timeout(300)
|
||||
assert len(create_calls) == 1
|
||||
|
||||
|
||||
def test_submit_reenables_button_on_error(alice):
|
||||
page, _ = alice
|
||||
page.route(
|
||||
"**/issues/create",
|
||||
lambda route: route.fulfill(
|
||||
status=503,
|
||||
content_type="application/json",
|
||||
body='{"ok":false,"message":"The issue tracker is not configured"}',
|
||||
),
|
||||
)
|
||||
_open_form(page)
|
||||
page.click(SUBMIT)
|
||||
page.locator(f"{SUBMIT}:not(.is-loading)").wait_for(state="visible")
|
||||
assert not page.locator(SUBMIT).is_disabled()
|
||||
assert not page.locator(SPINNER).is_visible()
|
||||
@@ -0,0 +1,66 @@
|
||||
# retoor <retoor@molodetz.nl>
|
||||
|
||||
from tests.conftest import BASE_URL
|
||||
|
||||
|
||||
def test_issues_page_loads(alice):
|
||||
page, _ = alice
|
||||
page.goto(f"{BASE_URL}/issues", wait_until="domcontentloaded")
|
||||
assert page.is_visible("h1:has-text('Issue Reports')")
|
||||
|
||||
|
||||
def test_issues_filters_visible(alice):
|
||||
page, _ = alice
|
||||
page.goto(f"{BASE_URL}/issues", wait_until="domcontentloaded")
|
||||
assert page.locator(".issues-filter:has-text('Open')").is_visible()
|
||||
assert page.locator(".issues-filter:has-text('Closed')").is_visible()
|
||||
assert page.locator(".issues-filter:has-text('All')").is_visible()
|
||||
|
||||
|
||||
def test_issues_not_configured_notice(alice):
|
||||
page, _ = alice
|
||||
page.goto(f"{BASE_URL}/issues", wait_until="domcontentloaded")
|
||||
assert page.is_visible("text=The issue tracker is not configured yet.")
|
||||
|
||||
|
||||
def test_issues_create_modal(alice):
|
||||
page, _ = alice
|
||||
page.goto(f"{BASE_URL}/issues", wait_until="domcontentloaded")
|
||||
page.click("button:has-text('Report Issue')")
|
||||
assert page.is_visible("h3:has-text('Report an Issue')")
|
||||
|
||||
|
||||
def test_issues_create_cancel(alice):
|
||||
page, _ = alice
|
||||
page.goto(f"{BASE_URL}/issues", wait_until="domcontentloaded")
|
||||
page.click("button:has-text('Report Issue')")
|
||||
page.click("button:has-text('Cancel')")
|
||||
modal = page.locator("#create-issue-modal")
|
||||
assert not modal.is_visible()
|
||||
|
||||
|
||||
def test_issues_unauth(page):
|
||||
page.goto(f"{BASE_URL}/issues", wait_until="domcontentloaded")
|
||||
assert page.is_visible("h1:has-text('Issue Reports')")
|
||||
assert page.locator("a.login-required:has-text('Report Issue')").is_visible()
|
||||
assert page.locator("#create-issue-modal").count() == 0
|
||||
|
||||
|
||||
def test_issue_button_icon_spacing(alice):
|
||||
page, _ = alice
|
||||
page.goto(f"{BASE_URL}/issues", wait_until="domcontentloaded")
|
||||
html = page.locator("button:has-text('Report Issue')").inner_html()
|
||||
assert "</span> Report Issue" in html
|
||||
page.goto(f"{BASE_URL}/", wait_until="domcontentloaded")
|
||||
landing = page.locator("a:has-text('Issue Report')").inner_html()
|
||||
assert "</span> Issue Report" in landing
|
||||
page.goto(f"{BASE_URL}/feed", wait_until="domcontentloaded")
|
||||
footer = page.locator("a:has-text('Issue Report')").inner_html()
|
||||
assert "</span> Issue Report" in footer
|
||||
|
||||
|
||||
def test_issue_detail_not_configured(alice):
|
||||
page, _ = alice
|
||||
page.goto(f"{BASE_URL}/issues/999", wait_until="domcontentloaded")
|
||||
assert page.is_visible("h1.error-code:has-text('404')")
|
||||
assert page.is_visible("text=Page not found")
|
||||
@@ -0,0 +1,10 @@
|
||||
# retoor <retoor@molodetz.nl>
|
||||
|
||||
from tests.conftest import BASE_URL
|
||||
|
||||
|
||||
def test_issue_job_status_not_found(alice):
|
||||
page, _ = alice
|
||||
page.goto(f"{BASE_URL}/issues/jobs/nonexistent-job", wait_until="domcontentloaded")
|
||||
assert page.is_visible("h1.error-code:has-text('404')")
|
||||
assert page.is_visible("text=Page not found")
|
||||
Reference in New Issue
Block a user