mirror of
https://github.com/simonw/datasette.git
synced 2026-07-08 08:34:42 +02:00
Mock navigator.clipboard so Playwright passes in all three browsers
This commit is contained in:
parent
9ec42b2dad
commit
b759ea5486
1 changed files with 14 additions and 3 deletions
|
|
@ -914,9 +914,20 @@ def test_navigation_search_renders_jump_sections_from_javascript_plugins(
|
|||
|
||||
@pytest.mark.playwright
|
||||
def test_insert_row_flow_uses_custom_column_field(page, datasette_server):
|
||||
page.context.grant_permissions(
|
||||
["clipboard-read", "clipboard-write"], origin=datasette_server.rstrip("/")
|
||||
)
|
||||
page.add_init_script("""
|
||||
(() => {
|
||||
let clipboardText = "";
|
||||
Object.defineProperty(navigator, "clipboard", {
|
||||
configurable: true,
|
||||
get: () => ({
|
||||
writeText: async (text) => {
|
||||
clipboardText = String(text);
|
||||
},
|
||||
readText: async () => clipboardText,
|
||||
}),
|
||||
});
|
||||
})();
|
||||
""")
|
||||
page.goto(f"{datasette_server}data/projects")
|
||||
page.locator('button[data-table-action="insert-row"]').click()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue