{"id":14984355,"url":"https://github.com/mcrumm/elogram","last_synced_at":"2025-04-10T20:08:44.794Z","repository":{"id":66903546,"uuid":"319373077","full_name":"mcrumm/elogram","owner":"mcrumm","description":"A mechanism to capture screenshots from Phoenix LiveView tests without a camera.","archived":false,"fork":false,"pushed_at":"2022-11-07T19:01:28.000Z","size":56,"stargazers_count":40,"open_issues_count":1,"forks_count":2,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-03-24T17:52:44.296Z","etag":null,"topics":["elixir-lang","elixir-phoenix","google-chrome","headless-testing","phoenix-framework","phoenix-liveview","screenshots"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mcrumm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-07T16:08:35.000Z","updated_at":"2025-01-02T07:48:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"c68b8c4c-f301-4d55-a928-0659e44beab7","html_url":"https://github.com/mcrumm/elogram","commit_stats":{"total_commits":21,"total_committers":3,"mean_commits":7.0,"dds":0.1428571428571429,"last_synced_commit":"9e68bdb3d08a65b2e0356756a3d256f98c796f83"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcrumm%2Felogram","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcrumm%2Felogram/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcrumm%2Felogram/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcrumm%2Felogram/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mcrumm","download_url":"https://codeload.github.com/mcrumm/elogram/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248288350,"owners_count":21078903,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elixir-lang","elixir-phoenix","google-chrome","headless-testing","phoenix-framework","phoenix-liveview","screenshots"],"created_at":"2024-09-24T14:08:54.933Z","updated_at":"2025-04-10T20:08:44.767Z","avatar_url":"https://github.com/mcrumm.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ELogram\n\n\u003c!-- MDOC --\u003e\nCapture screenshots with the [`Phoenix.LiveViewTest`](https://hexdocs.pm/phoenix_live_view/Phoenix.LiveViewTest.html) Element API.\n\n**This package is EXPERIMENTAL and should not be used by anyone.**\n\n## Installation\n\nThe package can be installed\nby adding `elogram` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:elogram,\n       only: :test, git: \"https://github.com/mcrumm/elogram.git\"}\n  ]\nend\n```\n\n## Capturing Screenshots\n\nStart the screenshots server in `test/test_helper.exs`:\n\n```diff\n+ Elogram.start([])\nExUnit.start()\n```\n\nThen capture a screenshot from your LiveView:\n\n```elixir\ndefmodule MyAppWeb.PageLiveTest do\n  use MyAppWeb.ConnCase\n\n  import Phoenix.LiveViewTest\n  import Elogram.CaptureScreenshot\n\n  test \"a thousand words\", %{conn: conn} end\n    {:ok, view, _} = live(conn, \"/\")\n\n    assert view\n           |\u003e capture_screenshot(name: \"welcome.png\")\n           |\u003e render() =~ \"Welcome to Phoenix!\"\n  end\nend\n```\n\n## Test Setup\n\n### Headless Chrome\n\nStart a headless browser before running your tests:\n\n**Github Actions**\n```yaml\nsteps:\n    - name: Start Google Chrome\n      run: google-chrome --headless --disable-gpu --remote-debugging-port=9222 \u0026\n```\n\n**MacOS**\n```sh\n/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome --headless --disable-gpu --remote-debugging-port=9222\n```\n\n### Save Path\n\nBy default screenshots will be saved to `tmp/screenshots`, so you may wish to update your `.gitignore` file to include the tmp directory:\n\n```.gitignore\n# Temporary files for e.g. tests\n/tmp\n```\n\n\u003c!-- MDOC --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcrumm%2Felogram","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmcrumm%2Felogram","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcrumm%2Felogram/lists"}