@@ -42,11 +42,13 @@ The `upright:install` generator creates:
4242- ` config/initializers/0_url_options.rb ` - Subdomain routing configuration
4343- ` config/initializers/upright.rb ` - Engine configuration
4444- ` config/sites.yml ` - Site/location definitions
45- - ` config/probes/http_probes.yml ` - HTTP probe definitions
46- - ` config/probes/smtp_probes.yml ` - SMTP probe definitions
4745- ` config/prometheus/prometheus.yml ` - Prometheus configuration
4846- ` config/alertmanager/alertmanager.yml ` - AlertManager configuration
4947- ` config/otel_collector.yml ` - OpenTelemetry Collector configuration
48+ - ` probes/ ` - Directory for all probe files
49+ - ` probes/authenticators/ ` - Directory for authenticator classes
50+ - ` probes/http_probes.yml ` - HTTP probe definitions
51+ - ` probes/smtp_probes.yml ` - SMTP probe definitions
5052
5153It also mounts the engine at ` / ` in your routes.
5254
181183
182184# ## HTTP Probes
183185
184- Add probes to `config/ probes/http_probes.yml` :
186+ Add probes to `probes/http_probes.yml` :
185187
186188` ` ` yaml
187189- name: Main Website
@@ -199,7 +201,7 @@ Add probes to `config/probes/http_probes.yml`:
199201
200202# ## SMTP Probes
201203
202- Add probes to `config/ probes/smtp_probes.yml` :
204+ Add probes to `probes/smtp_probes.yml` :
203205
204206` ` ` yaml
205207- name: Primary Mail Server
@@ -220,7 +222,7 @@ bin/rails generate upright:playwright_probe MyServiceAuth
220222This creates a probe class :
221223
222224` ` ` ruby
223- # app/models/ probes/playwright /my_service_auth_probe.rb
225+ # probes/my_service_auth_probe.rb
224226class Probes::Playwright::MyServiceAuthProbe < Upright::Probes::Playwright::Base
225227 # Optionally authenticate before running
226228 # authenticate_with_form :my_service
@@ -239,20 +241,17 @@ end
239241For probes that require authentication, create an authenticator :
240242
241243` ` ` ruby
242- # app/models/playwright/authenticator /my_service.rb
244+ # probes/authenticators /my_service.rb
243245class Playwright::Authenticator::MyService < Upright::Playwright::Authenticator::Base
246+ def signin_redirect_url = "https://app.example.com/dashboard"
247+ def signin_path = "/login"
248+ def service_name = :my_service
249+
244250 def authenticate
245251 page.goto("https://app.example.com/login")
246- page.fill('[name="email"]', credentials[:email])
247- page.fill('[name="password"]', credentials[:password])
248- page.click('button[type="submit"]')
249- page.wait_for_url("**/dashboard**")
250- end
251-
252- private
253-
254- def credentials
255- Rails.application.credentials.my_service
252+ page.get_by_label("Email").fill(credentials.my_service.email)
253+ page.get_by_label("Password").fill(credentials.my_service.password)
254+ page.get_by_role("button", name: "Sign in").click
256255 end
257256end
258257` ` `
0 commit comments