Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .doc-detective.ci.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"input": [
"src/content/docs/docs/integrations/slack-integration.mdx",
"src/content/docs/docs/getting-started/setup-quickstart.mdx"
],
"output": ".doc-detective/results",
"recursive": true,
"origin": "https://promptless.ai",
"detectSteps": false,
"loadVariables": ".doc-detective/.env",
"beforeAny": ".doc-detective/tests/login.spec.json",
"runOn": [
{
"platforms": ["linux"],
"browsers": [
{
"name": "chrome",
"headless": true
}
]
}
]
}
6 changes: 6 additions & 0 deletions .doc-detective/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,9 @@
# Copy this to .env and fill in your test account values
PROMPTLESS_TEST_EMAIL=your-test-user@example.com
PROMPTLESS_TEST_PASSWORD=your-test-password

# Promptless test org
PROMPTLESS_TEST_ORG_ID=org_xxxxx

# Database connection for resetting onboarding state
DATABASE_URL=postgresql://user:pass@host:5432/dbname
13 changes: 12 additions & 1 deletion .doc-detective/tests/login.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
"testId": "clerk-login",
"description": "Sign in to Promptless with test credentials",
"steps": [
{
"description": "Reset onboarding state for test org",
"runShell": {
"command": "psql $DATABASE_URL -c \"UPDATE customer_info SET onboarding_completed = false, onboarding_info = '{}'::jsonb WHERE org_id = '$PROMPTLESS_TEST_ORG_ID';\""
}
},
{
"description": "Navigate to the sign-in page",
"goTo": "https://accounts.gopromptless.ai/sign-in"
Expand All @@ -27,11 +33,16 @@
"timeout": 5000
}
},
{
"description": "Wait for password page to load",
"wait": 3000
},
{
"description": "Click the password input",
"find": {
"selector": "#password-field",
"click": true
"click": true,
"timeout": 10000
}
},
{
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/doc-detective.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: doc-detective

on:
workflow_dispatch:

jobs:
doc-test:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm

- name: Install Nushell
run: |
curl -fsSL https://github.com/nushell/nushell/releases/latest/download/nu-linux-x86_64.tar.gz -o nu.tar.gz
tar -xzf nu.tar.gz
sudo mv nu-*/nu /usr/local/bin/
rm -rf nu.tar.gz nu-*

- name: Install dependencies
run: npm ci --no-audit --no-fund

- name: Write test credentials
run: |
cat > .doc-detective/.env <<EOF
PROMPTLESS_TEST_EMAIL=${{ secrets.DOC_DETECTIVE_EMAIL }}
PROMPTLESS_TEST_PASSWORD=${{ secrets.DOC_DETECTIVE_PASSWORD }}
DATABASE_URL=${{ secrets.DANGER_WRITE_PROD_DATABASE_URL }}
EOF

- name: Run Doc Detective tests
run: npx doc-detective runTests --config .doc-detective.ci.json

- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: doc-detective-results
path: .doc-detective/results/
35 changes: 35 additions & 0 deletions scripts/reset_onboarding.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env nu

# Reset onboarding state for a given org_id in the customer_info table.
# Requires DATABASE_URL environment variable to be set.

def main [
org_id: string # The org_id to reset onboarding for (e.g. "org_xxxxx")
--dry-run # Print the SQL without executing
] {
let db_url = ($env | get -i DATABASE_URL)
if ($db_url == null or $db_url == "") {
print -e "ERROR: DATABASE_URL environment variable is not set"
exit 1
}

let sql = $"UPDATE customer_info SET onboarding_completed = false, onboarding_info = '{}'::jsonb WHERE org_id = '($org_id)';"

if $dry_run {
print "Would execute:"
print $sql
return
}

print $"Resetting onboarding state for ($org_id)..."

let result = (psql $db_url -c $sql)
print $result

if ($result | str contains "UPDATE 0") {
print -e $"WARNING: No rows updated — org_id '($org_id)' not found in customer_info"
exit 1
}

print "Done."
}