Use server origin by default
See original GitHub issue🚀 Feature Proposal
I would love to be able to do page.goto('/')
instead of page.goto('http://localhost:3000/')
. Currently if I try that I get
Protocol error (Page.navigate): Cannot navigate to invalid URL
1 | describe('MyApp: /', () => {
2 | beforeAll(async () => {
> 3 | await page.goto('/')
| ^
4 | })
Motivation
Not having to specify the protocol, host, and port in each test makes tests easier to write. It also makes it easier to change the way all tests are run, e.g. changing http:
to https:
.
Example
// jest-puppeteer.config.js:
module.exports = {
server: {
command: 'yarn run start',
port: 3000,
},
}
// if no origin is provided, use the one from the jest-puppeteer config:
await page.goto('/')
// but you can always tell the browser to go elsewhere if needed:
await page.goto('https://some-third-party-provider.com')
Pitch
Jest Puppeteer already knows about the protocol, host, and port from jest-puppeteer.config.js
. It can use this information to make writing tests easier.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Configure the Origin Server behavior
Origin Server is a mandatory behavior in the Default Rule. An error message is revealed if you delete it, and you need to...
Read more >What is an origin server? | Origin server definition
The purpose of an origin server is to process and respond to incoming Internet requests from Internet clients.
Read more >Origin - HTTP - MDN Web Docs
The domain name or the IP address of the origin server. ... If no port is given, the default port for the requested...
Read more >15.12 Tuning Connections to Origin Servers
Idle timeout: This parameter specifies the maximum duration, in seconds, for which a connection to the origin server can remain idle. The default...
Read more >Changing origins based on user location | Fastly Help Guides
First, create a header for the default origin server to serve content to the majority of users. Follow these instructions to create the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
hi @jamesarosen
Very useful feature and a very nice solution. Could you take a PR to do this?
I can do this with a custom environment: