Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Sumit Soman
    @Sumit-Soman
    client = await remote(WDIO_OPTIONS)
    Erwin Heitzman
    @erwinheitzman
    How are you running webdriverio? Are you running standalone?
    Sumit Soman
    @Sumit-Soman
    i am not using remote
    yes via wdio config file
    "@wdio/selenium-standalone-service
    "@wdio/selenium-standalone-service": "^5.12.1",
    Erwin Heitzman
    @erwinheitzman
    Ah right, that's different from running webdriverio as standalone so this is easy to fix :)
    If you install and add the service as described here: https://github.com/erwinheitzman/wdio-wiremock-service#configuration
    Then no async/await is required
    This would be all you need. I do use async/await to wait for the request as an example though
    So just the Using the WDIO testrunner in synch mode
    If you don't have any mocks setup yet, it will complain that it cannot find any mock files
    If you do have them setup like described here: https://github.com/erwinheitzman/wdio-wiremock-service#usage then it will mock the api calls correctly :)
    Sumit Soman
    @Sumit-Soman
    services: ['devtools', 'selenium-standalone', 'wiremock', { port: 8181, rootDir: 'mock' }],
    Erwin Heitzman
    @erwinheitzman
    that should be good yes
    Sumit Soman
    @Sumit-Soman
    i have created a mock folder structure as explained
    at what place or time i need to launch the wiremock...after the chrome browser is instantiated?
    Erwin Heitzman
    @erwinheitzman
    it should automatically start it :)
    you do not need to instantiate it unless you aren't using the wdio testrunner
    Sumit Soman
    @Sumit-Soman
    ok
    got it
    no need to call onPrepare
    correct?
    Erwin Heitzman
    @erwinheitzman
    no :)
    it's very simple, that 's the beauty of it
    Sumit Soman
    @Sumit-Soman
    let me try that
    I am getting this error
    Error loading file /Users/ssoman/emirates/projects/rendering-template-loyalty/templates/tests/e2e/./mock/mappings/my-statement.json:
    services: ['devtools', 'selenium-standalone', 'wiremock', { port: 8181, rootDir: 'mock' }],
    its taking ./ by default
    after e2e
    Erwin Heitzman
    @erwinheitzman
    It takes the scope of the execution yes
    Sumit Soman
    @Sumit-Soman
    how can I remove the ./
    rest is correct
    Erwin Heitzman
    @erwinheitzman
    You can change the mock to point to tests/e2e/mock, I think that should work but I am not sure. If this is an issue I haven't thought of I can look into it and push a fix though
    Sumit Soman
    @Sumit-Soman
    even if i provide the path in the service it still takes "e2e/./mock/mappings/my-statement.json:" by default
    Exception in thread "main" com.github.tomakehurst.wiremock.standalone.MappingFileException: Error loading file /Users/ssoman/emirates/projects/rendering-template-loyalty/templates/tests/e2e/./mock/mappings/my-statement.json:
    Unrecognized field "results" (class com.github.tomakehurst.wiremock.http.ResponseDefinition), not marked as ignorable
    at com.github.tomakehurst.wiremock.standalone.JsonFileMappingsSource.loadMappingsInto(JsonFileMappingsSource.java:121)
    at com.github.tomakehurst.wiremock.core.WireMockApp.loadMappingsUsing(WireMockApp.java:199)
    at com.github.tomakehurst.wiremock.core.WireMockApp.loadDefaultMappings(WireMockApp.java:195)
    at com.github.tomakehurst.wiremock.core.WireMockApp.<init>(WireMockApp.java:103)
    at com.github.tomakehurst.wiremock.WireMockServer.<init>(WireMockServer.java:72)
    at com.github.tomakehurst.wiremock.standalone.WireMockServerRunner.run(WireMockServerRunner.java:65)
    at com.github.tomakehurst.wiremock.standalone.WireMockServerRunner.main(WireMockServerRunner.java:125)
    Wiremock exited with code 1
    sorry for the big error message.. though this could help you understand the issue better
    Erwin Heitzman
    @erwinheitzman
    I see, that's a issue I haven't taken into account then. Let me take a look and I will push a fix as soon as I can
    Sumit Soman
    @Sumit-Soman
    thanks Erwin for your time. appreciate it
    Erwin Heitzman
    @erwinheitzman
    You're welcome and thank you for sharing and using the service
    Sumit Soman
    @Sumit-Soman
    :)
    Erwin Heitzman
    @erwinheitzman
    Currently looking into it, I might be able to do a quick fix but to deliver a good fix is going to be a bit more work. I'll see what I do :)
    Erwin Heitzman
    @erwinheitzman
    @Sumit-Soman I have just released a new version with a fix, could you try it out?
    it should now automatically create the path if it does not exist yet and it should support relative paths
    so in your case this I believe this would be test/e2e/mock
    it will resolve the path from the directory in which you are executing the process
    Erwin Heitzman
    @erwinheitzman
    I just tested it in a personal project and it seems to be working as expected :)
    Would love your feedback on the changes made
    Erwin Heitzman
    @erwinheitzman
    @Sumit-Soman did you manage to get it up and running?