Comments (4)
I'm not sure wether I fully understand how the sandbox is actually working, but seems like the issue here is that the request is handled by the LemonEx Plug outside of the phoenix routing and thus the sandbox is not correct setup. I've played around with several code snippets from the documentation for enabling the Ecto Sandbox for LiveView, but couldn't produce a working solution 🤔
from wallaby.
Basically you'll want to add the relevant metadata to the useragent string in your request (you can use the functions in this module to create them https://hexdocs.pm/phoenix_ecto/4.6.1/Phoenix.Ecto.SQL.Sandbox.html) and make sure that it goes through the sandbox plug that is in your endpoint
from wallaby.
To clarify (because the docs I listed show how to set it up for "external clients"), the wallaby test has already checked out a db connection for your test, and ensured that the LV/controller process uses that connection.
The problem is that your webhook request controller doesn't know what db connection to checkout, but that is what the user agent meta string will tell the sandbox plug what to do
from wallaby.
To clarify (because the docs I listed show how to set it up for "external clients"), the wallaby test has already checked out a db connection for your test, and ensured that the LV/controller process uses that connection.
You're right, that's what I figured out too.
I think I solved the issue by adding:
metadata =
MyApp.Repo
|> Phoenix.Ecto.SQL.Sandbox.metadata_for(self())
|> Phoenix.Ecto.SQL.Sandbox.encode_metadata()
and then passing this as user-agent
header to the api request. Seems to work :)
Thank you very much for your help!
from wallaby.
Related Issues (20)
- Passed capabilities may be passed in the wrong format HOT 1
- Modify capabilities while keeping metadata in user agent HOT 2
- Wallaby test issue HOT 1
- js_errors: false config is being ignored
- Is it possible to configure "headless: true | false" at session opening? HOT 2
- Chrome is activated but the test times out HOT 4
- Test cases fail randomely because of missing elements HOT 3
- `run_command.sh` improvements HOT 1
- Running wallaby `feature` tests in VS Code HOT 1
- Minor thing: change wording of docs --> browser / users are not the same. HOT 2
- Suggested Phoenix Configuration for Concurrent Feature Test Issues Warning HOT 1
- How Might A Developer New to Wallaby Understand 'page' In the Documentation? HOT 5
- Setup docs unclear when using Phoenix but not Ecto HOT 3
- Use external chromedriver server? HOT 8
- Debug output HOT 5
- Warning on Elixir 1.17.0-rc.1: `ExUnit.Case.register_test/4 is deprecated` HOT 3
- Getting Selenium (Firefox & Safari) working in Wallaby (~> 0.30.x) HOT 1
- Unable to use Wallaby in release mode
- Feature request: Affordances for asserting on js console output HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wallaby.