Closed
Description
In https://github.com/cypress-io/cypress-example-kitchensink we have the following page structure
app/
commands/
actions.html
...
waiting.html
The spec file has the command cy.visit('/commands/actions')
but fails to find it
11:04:07 AM: Running: examples/waiting.spec.js (1 of 2)
11:04:07 AM: Estimated: 1 second
11:04:11 AM:
11:04:11 AM: Waiting
11:04:11 AM: 1) "before each" hook for "cy.wait() - wait for a specific amount of time"
11:04:11 AM: 0 passing (422ms)
11:04:11 AM: 1 failing
11:04:11 AM: 1) Waiting
11:04:11 AM: "before each" hook for "cy.wait() - wait for a specific amount of time":
11:04:11 AM: CypressError: `cy.visit()` failed trying to load:
11:04:11 AM: http://localhost:8080/commands/waiting
11:04:11 AM: The response we received from your web server was:
11:04:11 AM: > 404: Not Found
11:04:11 AM: This was considered a failure because the status code was not `2xx`.
11:04:11 AM: If you do not want status codes to cause failures pass the option: `failOnStatusCode: false`
11:04:11 AM: Because this error occurred during a `before each` hook we are skipping the remaining tests in the current suite: `Waiting`
This is because https://github.com/lwsjs/local-web-server#readme does not serve .html
automatically for files that are not index.html
.
Proposal
LWS includes https://github.com/lwsjs/static so we can simply start it with
npx ws --directory app --static.extensions html
And then /commands/actions
or /commands/waiting
URLs work. We could include HTML extension as a courtesy.