Skip to content

Commit

Permalink
Add nightly tests
Browse files Browse the repository at this point in the history
  • Loading branch information
karangattu committed Nov 14, 2024
1 parent af4f90b commit 6c3e308
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/nightly-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Nightly Tests for Shiny Assistant

on:
schedule:
- cron: "0 3 * * *"
push:
branches:
- "testing**"
workflow_dispatch:

jobs:
process-issues:
runs-on: ubuntu-latest
permissions: write-all

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "18"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
playwright install chromium --with-deps
- name: Process issue description
id: process-description
run: python tests/run_smoke_test.py
30 changes: 30 additions & 0 deletions tests/run_smoke_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import time

from playwright.sync_api import Playwright, sync_playwright


def run(playwright: Playwright):
chromium = playwright.chromium
browser = chromium.launch()
page = browser.new_page()
page.goto("https://gallery.shinyapps.io/assistant")
page.get_by_label("Python").check()
page.get_by_text("Who can see my activity?").click()
page.get_by_text("Who can see my activity?").click()
page.get_by_role("textbox", name="Enter a message...").click()
page.get_by_role("textbox", name="Enter a message...").fill(
"""
Help me write a shiny app with orange cards
"""
)
page.get_by_label("Send message").click()
time.sleep(12) # required since we are streaming responses
message_contents = page.query_selector_all(".message-content")
last_message_content = message_contents[-1].text_content()
if "orange" not in last_message_content:
raise AssertionError("Expected orange in last message content")
browser.close()


with sync_playwright() as playwright:
run(playwright)

0 comments on commit 6c3e308

Please sign in to comment.