<reponame>codelibs/fess-test-ui<filename>src/fess/test/ui/admin/dict/synonym/delete.py
from playwright.sync_api import Playwright, sync_playwright


def run(playwright: Playwright) -> None:
    browser = playwright.chromium.launch(headless=False, slow_mo=500)
    context = browser.new_context()

    # Open new page
    page = context.new_page()

    # Go to http://localhost:8080/login/
    page.goto("http://localhost:8080/login/")

    # Fill [placeholder="ユーザー名"]
    page.fill("[placeholder=\"ユーザー名\"]", "admin")

    # Fill [placeholder="パスワード"]
    page.fill("[placeholder=\"パスワード\"]", "admin1234")

    # Click button:has-text("ログイン")
    page.click("button:has-text(\"ログイン\")")
    # assert page.url == "http://localhost:8080/admin/dashboard/"

    # Click text=システム
    page.click("text=システム")

    # Click text=辞書
    page.click("text=辞書")
    # assert page.url == "http://localhost:8080/admin/dict/"

    # Click text=synonym.txt
    page.click("text=synonym.txt")
    # assert page.url == "http://localhost:8080/admin/dict/synonym/?dictId=c3lub255bS50eHQ="

    # Click text=[TV, テレビ]
    page.click("text=[TV, テレビ]")
    # assert page.url == "http://localhost:8080/admin/dict/synonym/details/c3lub255bS50eHQ%3D/4/2"

    # Click text=削除
    page.click("text=削除")

    # Click text=キャンセル
    page.click("text=キャンセル")

    # Click text=削除
    page.click("text=削除")

    # Click text=キャンセル 削除 >> button[name="delete"]
    page.click("text=キャンセル 削除 >> button[name=\"delete\"]")
    # assert page.url == "http://localhost:8080/admin/dict/synonym/list/1?dictId=c3lub255bS50eHQ="

    # Close page
    page.close()

    # ---------------------
    context.close()
    browser.close()


with sync_playwright() as playwright:
    run(playwright)

from playwright.sync_api import Playwright, sync_playwright


def run(playwright: Playwright) -> None:
    browser = playwright.chromium.launch(headless=False, slow_mo=500)
    context = browser.new_context()

    # Open new page
    page = context.new_page()

    # Go to http://localhost:8080/login/
    page.goto("http://localhost:8080/login/")

    # Fill [placeholder="ユーザー名"]
    page.fill("[placeholder=\"ユーザー名\"]", "admin")

    # Fill [placeholder="パスワード"]
    page.fill("[placeholder=\"パスワード\"]", "admin1234")

    # Click button:has-text("ログイン")
    page.click("button:has-text(\"ログイン\")")
    # assert page.url == "http://localhost:8080/admin/dashboard/"

    # Click text=システム
    page.click("text=システム")

    # Click text=辞書
    page.click("text=辞書")
    # assert page.url == "http://localhost:8080/admin/dict/"

    # Click text=synonym.txt
    page.click("text=synonym.txt")
    # assert page.url == "http://localhost:8080/admin/dict/synonym/?dictId=c3lub255bS50eHQ="

    # Click text=[TV, テレビ]
    page.click("text=[TV, テレビ]")
    # assert page.url == "http://localhost:8080/admin/dict/synonym/details/c3lub255bS50eHQ%3D/4/2"

    # Click text=削除
    page.click("text=削除")

    # Click text=キャンセル
    page.click("text=キャンセル")

    # Click text=削除
    page.click("text=削除")

    # Click text=キャンセル 削除 >> button[name="delete"]
    page.click("text=キャンセル 削除 >> button[name=\"delete\"]")
    # assert page.url == "http://localhost:8080/admin/dict/synonym/list/1?dictId=c3lub255bS50eHQ="

    # Close page
    page.close()

    # ---------------------
    context.close()
    browser.close()


with sync_playwright() as playwright:
    run(playwright)
# Open new page # Go to http://localhost:8080/login/ # Fill [placeholder="ユーザー名"] # Fill [placeholder="パスワード"] # Click button:has-text("ログイン") # assert page.url == "http://localhost:8080/admin/dashboard/" # Click text=システム # Click text=辞書 # assert page.url == "http://localhost:8080/admin/dict/" # Click text=synonym.txt # assert page.url == "http://localhost:8080/admin/dict/synonym/?dictId=c3lub255bS50eHQ=" # Click text=[TV, テレビ] # assert page.url == "http://localhost:8080/admin/dict/synonym/details/c3lub255bS50eHQ%3D/4/2" # Click text=削除 # Click text=キャンセル # Click text=削除 # Click text=キャンセル 削除 >> button[name="delete"] # assert page.url == "http://localhost:8080/admin/dict/synonym/list/1?dictId=c3lub255bS50eHQ=" # Close page # ---------------------