Code Monkey home page Code Monkey logo

Comments (4)

mhanberg avatar mhanberg commented on September 15, 2024 1

Can you put the configuration in the test helper? (I assume umbrellas have a test helper for each app)

from wallaby.

Arp-G avatar Arp-G commented on September 15, 2024

Thanks for replying. I tried adding this to my admin app in app/apps/admin_app/test/test_helper.exs

  import Config

  config :wallaby,
    otp_app: :admin_app,
    driver: Wallaby.Chrome,
    screenshot_dir: "wallaby_screenshots",
    # Wallaby should take screenshots on test failures
    screenshot_on_failure: true,
    # Amount of time that Wallaby should wait to find an element on the page.
    max_wait_time: 5000,
    # Throw JavaScript errors in elixir
    js_errors: true,
    # IO device where JavaScript console logs are written
    js_logger: :stdio,
    chromedriver: [
      headless: true
    ]

  {:ok, _} = Application.ensure_all_started(:wallaby)
  Application.put_env(:wallaby, :base_url, MyApp.AdminApp.Endpoint.url())

But on trying to run tests I get a

** (RuntimeError) could not set configuration via Config. This usually means you are trying to execute a configuration file directly, instead of reading it with Config.Reader

I guess configs are to be set only at compile time

from wallaby.

mhanberg avatar mhanberg commented on September 15, 2024

Sorry, I meant by doing Application.put_env

from wallaby.

Arp-G avatar Arp-G commented on September 15, 2024

Thanks a lot @mhanberg that solved my problem.

For anyone encountering the same issue, this is how I set my wallaby configs now, I have set the configurations separately for the different apps in their respective test_helper.exs files and I no longer set the configs in the config/test.exs files

  Application.put_all_env([
    {
      :wallaby,
      otp_app: :web_app,
      driver: Wallaby.Chrome,
      screenshot_dir: "wallaby_screenshots",
      screenshot_on_failure: true,
      max_wait_time: 5000,
      js_errors: true,
      js_logger: :stdio,
      chromedriver: [
        headless: true
      ]
    }
  ])

  {:ok, _} = Application.ensure_all_started(:wallaby)
  Application.put_env(:wallaby, :base_url, ConnectWeb.Endpoint.url())

from wallaby.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.