Skip to content

Commit

Permalink
ignore playwright
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonyshull committed May 28, 2024
1 parent dd78beb commit d214478
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 2 additions & 0 deletions integration/e2e_tests/all-scenarios.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ const baseURL = process.env.HOST

files.forEach((file) => {
test.describe("All scenarios", {tag: "@scenarios"}, (_) => {
test.use({userAgent: "Playwright"});

const filePath = path.join(filesPath, file);
const { scenario } = require(filePath);

Expand Down
14 changes: 10 additions & 4 deletions lib/dotcom_web/controllers/tracker_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ defmodule DotcomWeb.TrackerController do
require Logger

def tracker(conn, _params) do
if Plug.Conn.get_req_header(conn, "user-agent") != ["Playwright"] do
maybe_log(conn)
end

conn
|> send_resp(200, "ok")
|> halt
end

defp maybe_log(conn) do
case Plug.Conn.read_body(conn) do
{:ok, _body, conn} ->
%{"path" => path, "session_id" => session_id} = conn.body_params
Expand All @@ -18,9 +28,5 @@ defmodule DotcomWeb.TrackerController do
_ ->
nil
end

conn
|> send_resp(200, "ok")
|> halt
end
end
1 change: 0 additions & 1 deletion playwright.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ module.exports = defineConfig({
baseURL: process.env.HOST ? `https://${process.env.HOST}` : 'http://localhost:4001',
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
userAgent: 'Playwright',
},
/* set the expect timeout to 30s */
expect: { timeout: 30000 },
Expand Down

0 comments on commit d214478

Please sign in to comment.