from __future__ import annotations import subprocess import sys from pathlib import Path import pytest from skyvern.cli.mcp_tools.prompts import QA_TEST_CONTENT, qa_test from tests.unit.skill_test_helpers import first_nonempty_line_after_h1 ROOT = Path(__file__).resolve().parents[2] BUNDLED_QA_SKILL = ROOT / "skyvern" / "cli" / "skills" / "qa" / "SKILL.md" CLAUDE_QA_SKILL = ROOT / ".claude" / "skills" / "qa" / "SKILL.md" _needs_cloud_repo = pytest.mark.skipif( not CLAUDE_QA_SKILL.exists(), reason=".claude/skills/qa/SKILL.md not present (OSS checkout)", ) @_needs_cloud_repo def test_bundled_and_claude_qa_skill_match_exactly() -> None: assert BUNDLED_QA_SKILL.read_text(encoding="utf-8") == CLAUDE_QA_SKILL.read_text(encoding="utf-8") def test_qa_skill_has_summary_line_before_note_comment() -> None: skill_text = BUNDLED_QA_SKILL.read_text(encoding="utf-8") first_line_after_h1 = first_nonempty_line_after_h1(skill_text) assert first_line_after_h1 assert not first_line_after_h1.startswith("" in skill_text assert "Post Evidence to PR" in skill_text assert ".qa/latest-report.md" in skill_text assert "gh pr comment" in skill_text # Check QA_TEST_CONTENT (MCP prompt) assert "" in QA_TEST_CONTENT assert "Post Evidence to PR" in QA_TEST_CONTENT assert ".qa/latest-report.md" in QA_TEST_CONTENT assert "gh pr comment" in QA_TEST_CONTENT @_needs_cloud_repo def test_validate_skills_package_script_passes() -> None: result = subprocess.run( [sys.executable, str(ROOT / "scripts" / "validate_skills_package.py")], cwd=ROOT, capture_output=True, text=True, check=False, ) assert result.returncode == 0, result.stdout + result.stderr