test_1967510_gemini_google_com.py (1593B)
1 import pytest 2 3 URL = "https://gemini.google.com/" 4 5 ADD_PROMPT_CSS = ".ql-editor.textarea.new-input-ui" 6 SEND_CSS = "[data-mat-icon-name=send]" 7 SIGNED_OUT_TEXT = "been signed out" 8 RESPONSE_CSS = "message-content" 9 EDIT_OLD_PROMPT_CSS = "[data-mat-icon-name=edit]" 10 OLD_PROMPT_CSS = "textarea[id^=mat-input-]" 11 CANCEL_CSS = "button.cancel-button" 12 13 14 async def check_paste_works(client): 15 client.set_clipboard("") 16 await client.navigate(URL) 17 client.await_css(ADD_PROMPT_CSS, is_displayed=True).send_keys("hello") 18 client.await_css(SEND_CSS, is_displayed=True).click() 19 signed_out, _ = client.await_first_element_of( 20 [client.text(SIGNED_OUT_TEXT), client.css(RESPONSE_CSS)], is_displayed=True 21 ) 22 if signed_out: 23 pytest.skip("Blocked from accessing site. Please try testing manually.") 24 return 25 client.soft_click(client.await_css(EDIT_OLD_PROMPT_CSS)) 26 client.await_css(OLD_PROMPT_CSS, is_displayed=True).click() 27 client.execute_script("document.execCommand('selectAll')") 28 client.execute_script("document.execCommand('copy')") 29 client.await_css(CANCEL_CSS, is_displayed=True).click() 30 prompt = client.await_css(ADD_PROMPT_CSS, is_displayed=True) 31 await client.apz_click(element=prompt, offset=[40, 20]) 32 client.do_paste() 33 return client.execute_script( 34 """ 35 return arguments[0].innerText.trim() === "hello" 36 """, 37 prompt, 38 ) 39 40 41 @pytest.mark.skip_platforms("android") 42 @pytest.mark.asyncio 43 @pytest.mark.without_interventions 44 async def test_regression(client): 45 assert await check_paste_works(client)