test: verify deployed browser chat stream and immediate pin
This commit is contained in:
1 parent
7cb641b35a
commit
856238f47a
1 file changed
+36
@@ -0,0 +1,36 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Explicit live browser qualification, preserving existing account preferences."""
|
||||||
|
import json,secrets
|
||||||
|
from pathlib import Path
|
||||||
|
from playwright.sync_api import sync_playwright,expect
|
||||||
|
values=json.loads(Path('.runtime/deployment.json').read_text())
|
||||||
|
with sync_playwright() as p:
|
||||||
|
browser=p.chromium.launch(headless=True)
|
||||||
|
context=browser.new_context(ignore_https_errors=True,viewport={'width':1440,'height':1000})
|
||||||
|
page=context.new_page();errors=[]
|
||||||
|
page.on('pageerror',lambda e:errors.append(str(e)))
|
||||||
|
page.goto('https://192.168.86.2:9178/',wait_until='networkidle')
|
||||||
|
page.locator('#loginUsername').fill('admin');page.locator('#loginPassword').fill(values['admin_password']);page.locator('#loginSubmit').click()
|
||||||
|
expect(page.locator('#primaryInput')).to_be_enabled(timeout=30000)
|
||||||
|
page.locator('#newConversation').click()
|
||||||
|
page.locator('#primaryInput').fill('Reply with exactly BROWSER_CHAT_OK. Do not use tools.')
|
||||||
|
page.locator('#primarySend').click()
|
||||||
|
expect(page.locator('#chatTimeline')).to_contain_text('BROWSER_CHAT_OK',timeout=180000)
|
||||||
|
expect(page.locator('#cancelRun')).to_be_hidden(timeout=180000)
|
||||||
|
cid=page.evaluate('HopeChat.conversationId')
|
||||||
|
expect(page.locator('#chatTimeline')).to_contain_text('Hope')
|
||||||
|
page.locator('#pinConversation').click()
|
||||||
|
expect(page.locator('#pinConversation')).to_contain_text('Unpin')
|
||||||
|
page.reload(wait_until='networkidle')
|
||||||
|
expect(page.locator('#primaryInput')).to_be_enabled(timeout=30000)
|
||||||
|
row=page.locator('#pinnedConversations button').filter(has_text='Reply with exactly BROWSER_CHAT_OK').last
|
||||||
|
expect(row).to_be_visible(timeout=30000)
|
||||||
|
row.click()
|
||||||
|
expect(page.locator('#chatTimeline')).to_contain_text('BROWSER_CHAT_OK',timeout=30000)
|
||||||
|
page.screenshot(path='.runtime/chat-deployed-desktop.png',full_page=True)
|
||||||
|
assert page.evaluate('document.documentElement.scrollWidth<=innerWidth')
|
||||||
|
assert not errors,errors
|
||||||
|
result=page.evaluate('''async cid=>{await HopeAuth.request('/api/conversations/'+cid,{method:'DELETE'});return true}''',cid)
|
||||||
|
assert result
|
||||||
|
context.close();browser.close()
|
||||||
|
print('live_browser_text_stream_pin_reload=PASS; console_errors=0')
|
||||||
Reference in new issue
Block a user