Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

calculator-example.yaml 2.0 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
  1. # yaml-language-server: $schema=https://promptfoo.dev/config-schema.json
  2. description: 'Calculator demo for browser automation'
  3. prompts:
  4. - 'Calculate {{num1}} {{operation}} {{num2}}'
  5. providers:
  6. - id: browser
  7. config:
  8. headless: false # See the browser in action
  9. steps:
  10. # Navigate to the demo
  11. - action: navigate
  12. args:
  13. url: 'http://localhost:7860'
  14. # Wait for initial page load
  15. - action: wait
  16. args:
  17. ms: 3000
  18. # Navigate to calculator tab
  19. - action: click
  20. args:
  21. selector: 'button[role="tab"]:nth-child(2)'
  22. # Wait for tab to load
  23. - action: wait
  24. args:
  25. ms: 2000
  26. # Enter numbers and perform calculation
  27. - action: type
  28. args:
  29. selector: '#num1 input'
  30. text: '{{num1}}'
  31. - action: type
  32. args:
  33. selector: '#num2 input'
  34. text: '{{num2}}'
  35. # Select operation
  36. - action: click
  37. args:
  38. selector: '{{operationSelector}}'
  39. # Perform calculation
  40. - action: click
  41. args:
  42. selector: '#calculate'
  43. # Wait for calculation
  44. - action: wait
  45. args:
  46. ms: 2000
  47. # Extract entire result area for debugging
  48. - action: extract
  49. args:
  50. selector: '#result'
  51. name: resultArea
  52. # For demo purposes, we'll just check that we got something
  53. transformResponse: 'extracted.resultArea && extracted.resultArea.includes("Result") ? "Calculator interaction successful" : "No result found"'
  54. # Simple demo tests
  55. tests:
  56. - vars:
  57. num1: '10'
  58. num2: '5'
  59. operation: Add
  60. operationSelector: '#operation label:nth-child(1)'
  61. assert:
  62. - type: contains
  63. value: 'successful'
  64. - vars:
  65. num1: '20'
  66. num2: '4'
  67. operation: Multiply
  68. operationSelector: '#operation label:nth-child(3)'
  69. assert:
  70. - type: contains
  71. value: 'successful'
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...