linkding/bookmarks/e2e/e2e_test_global_shortcuts.py

31 lines
960 B
Python
Raw Normal View History

2023-01-21 23:47:47 +00:00
from django.urls import reverse
from playwright.sync_api import sync_playwright, expect
from bookmarks.e2e.helpers import LinkdingE2ETestCase
class GlobalShortcutsE2ETestCase(LinkdingE2ETestCase):
def test_focus_search(self):
with sync_playwright() as p:
browser = self.setup_browser(p)
page = browser.new_page()
2024-01-27 10:29:16 +00:00
page.goto(self.live_server_url + reverse("bookmarks:index"))
2023-01-21 23:47:47 +00:00
2024-01-27 10:29:16 +00:00
page.press("body", "s")
2023-01-21 23:47:47 +00:00
2024-01-27 10:29:16 +00:00
expect(page.get_by_placeholder("Search for words or #tags")).to_be_focused()
2023-01-21 23:47:47 +00:00
browser.close()
def test_add_bookmark(self):
with sync_playwright() as p:
browser = self.setup_browser(p)
page = browser.new_page()
2024-01-27 10:29:16 +00:00
page.goto(self.live_server_url + reverse("bookmarks:index"))
2023-01-21 23:47:47 +00:00
2024-01-27 10:29:16 +00:00
page.press("body", "n")
2023-01-21 23:47:47 +00:00
2024-01-27 10:29:16 +00:00
expect(page).to_have_url(self.live_server_url + reverse("bookmarks:new"))
2023-01-21 23:47:47 +00:00
browser.close()