Have you ever created a new scratch org with sfdx but seem to have trouble access visualforce pages? This seems to be a know issue and can take 0-18 minutes before the org is fully operational. This random delay can cause havoc on e2e/integration testing as well as unit test. So after many attempts to fix or delay CI/CD I believe I have finally found a solution.
First let's talk about the actual issue, spinning up a new scratch org. After running sfdx force:org:create
you will receive a success
message along with login/password info for your org. The core sfdc features of the org are almost ready instantly but if you have a
managed package with namespace it takes 0-18 minutes. Navigating to one of these pages(vf pages) will not error with a 404 nor will they timeout.
However it will load a blank screen so let's dig in a bit 😺