Skip to content

Add static site extensions #116

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

Closed
bahmutov opened this issue Feb 9, 2021 · 1 comment · Fixed by #117
Closed

Add static site extensions #116

bahmutov opened this issue Feb 9, 2021 · 1 comment · Fixed by #117
Labels
enhancement New feature or request released

Comments

@bahmutov
Copy link
Contributor

bahmutov commented Feb 9, 2021

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.

@bahmutov bahmutov added the enhancement New feature or request label Feb 9, 2021
@bahmutov
Copy link
Contributor Author

bahmutov commented Feb 9, 2021

🎉 This issue has been resolved in version 1.10.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant