I am working on a feature for a Phoenix app that adds Google Tag Manager variables under certain conditions. While unit testing the related Elixir modules is easy, I’m not sure how to actually test the “frontend” or javascript portion.
Id like to have a feature test that asserts:
- yes this javascript variable was set and its value is foo
- yes this javascript variable was set and its value is bar
- yes this javascript variable was not set at all
Right now Im leaning towards either:
- get a javascript testing framework
- view page source of the Wallaby session, and view the contents of a script tag
Is there any way I can get the JS vars of the current window/session, and view their values (with Wallaby)?