Files
eminuxandCursor 70fccc493e Usa screenshot di pagina come sfondo heatmap al posto dell’iframe.
Cattura periodica client-side (con consenso), storage ActiveStorage e overlay allineato all’immagine.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-20 23:14:47 +02:00

45 lines
1.2 KiB
Ruby

# frozen_string_literal: true
require "rails_helper"
RSpec.describe "Admin analytics", type: :request do
let!(:admin) { AdminAccount.create!(username: "ops-analytics", password: "Password123") }
before do
post admin_login_path, params: { username: admin.username, password: "Password123" }
AnalyticsPageStat.create!(
day: Time.zone.today,
page_path: "/prezzi",
device: "desktop",
pageview_count: 12,
scroll_samples: 10,
scroll_sum_pct: 600,
max_scroll_pct: 90
)
AnalyticsPageCell.create!(
day: Time.zone.today,
page_path: "/prezzi",
device: "desktop",
cell_x: 10,
cell_y: 15,
click_count: 4,
move_count: 40
)
end
it "mostra l'elenco pagine" do
get admin_analytics_path
expect(response).to have_http_status(:ok)
expect(response.body).to include("/prezzi")
expect(response.body).to include("12")
expect(response.body).to include("40")
end
it "mostra la heatmap di una pagina" do
get admin_analytics_page_path, params: { page_path: "/prezzi" }
expect(response).to have_http_status(:ok)
expect(response.body).to include("admin-heatmap")
expect(response.body).to include("/prezzi")
end
end