:wave: Hello, team! I am new to Wiremock. I would ...
# help
c
👋 Hello, team! I am new to Wiremock. I would like to ask if there is any documentation or tips on how to best integrate the mock data provided by Wiremock and be consumed in different playwright ui tests. Thanks in advance!
r
hi there, im not sure i understand your question or goal. if youve configured your wiremock server to return html, you can point your playwright tests to your wiremock server and run the tests.
c
Apologies for not explaining my goal clearly. I'm new to Wiremock, so I'm sure I don't know all the tricks. I'm already doing the above. there is pointing my playwright tests to the Wiremock server. What I would like to know is what is the best way for structuring mappings and _files to be consumed by different test scenarios. For instance after successfully logged in I have some test data returned in html. The next scenarion is to navigate to a Top menu, let's say "My profile" and there I have test data in json format. I hope I have explained my goal a bit better.
r
im still not sure i understand. it sounds like youre trying to serve both html and json from wiremock. are you configuring wiremock to act as a spa and a backend for the spa simultaneously?
c
Apologies for the late response, we are moving to SSR method, that is why I would like to use Wiremock to mock the data.
r
so you are mocking a spa. im still not clear what you're trying to achieve. wiremock is an http server that allows you to stub different http responses based on the content of http requests. the content of these responses can be anything you configure. if you want one stub to return json and another to return html you can configure that. beyond that, the interactions between client and server are up to you
c
I think I have it running somehow were I'm stubbing one response in html and the other in json. What I'm looking for is to hear other experiences when integrating Wiremock with Playwright.
r
i see. that sounds like quite a niche use case. ive not heard of anyone using wiremock to mock their spa before
c
Oh dear. I was looking forward to exchange information.