Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test different hosts in locale environment #6

Closed
izziaraffaele opened this issue Aug 18, 2021 · 5 comments
Closed

Test different hosts in locale environment #6

izziaraffaele opened this issue Aug 18, 2021 · 5 comments

Comments

@izziaraffaele
Copy link

How do you test different host in development mode with this setup? Would be nice to add a URL param (like next is doing for i18n support) to switch from one host to the other

@acorcutt
Copy link
Owner

On macOS you can just use a subdomain to localhost e.g. http://a.localhost:3000/ http://b.localhost:3000/ or add domains to your /etc/hosts file.

I'm not sure about automated testing but the standard routes will be still be available. So if you are redirecting to /:host/page.js the path /my.host.com/page should work.

@izziaraffaele
Copy link
Author

I'm not sure about automated testing but the standard routes will be still be available. So if you are redirecting to /:host/page.js the path /my.host.com/page should work.

I'm not sure this will work with links in the page. For example, the href attribute will point to /page-2 and the :host parameter will be lost

@acorcutt
Copy link
Owner

Maybe next-page-tester could work, there is an example testing cookies so could this be modified to change the context.params?

@acorcutt
Copy link
Owner

I've just added cypress to the example there is an undocumented option to make *.localhost work in tests cypress-io/cypress#1488 (comment)

@izziaraffaele
Copy link
Author

Awesome! Maybe we can add the following on the readme as well

On macOS you can just use a subdomain to localhost e.g. http://a.localhost:3000/ http://b.localhost:3000/ or add domains to your /etc/hosts file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants