Git Product home page Git Product logo

Comments (14)

bashmish avatar bashmish commented on June 25, 2024

I found that we do support HTTPS by using http2 flag.

Can you try adding http2: true to your config, and sslKey and sslCert if needed.

// @web/test-runner-core/src/config/TestRunnerCoreConfig.ts
export interface TestRunnerCoreConfig {
  // ...
  http2?: boolean;
  sslKey?: string;
  sslCert?: string;
  // ...
}

This is documented only in WDS though:
https://modern-web.dev/docs/dev-server/cli-and-configuration/

And not in WTR:
https://modern-web.dev/docs/test-runner/cli-and-configuration/

from web.

robertsLando avatar robertsLando commented on June 25, 2024

Ok I confirm this is working, I only report that the addresses printed on console are still using http and if you set the open to true it opens the http url resulting to a 404. If I manually fix http --> https it works BTW. I think may be worth adding this to docs too

from web.

robertsLando avatar robertsLando commented on June 25, 2024

Ok I think part of #2540 is also related to this, when http2 is enabled and playwright browsers are lunched the url is wrong there too:

test/browser/test.js:

 ❌ page.goto: net::ERR_EMPTY_RESPONSE at http://localhost:8001/?wtr-session-id=uqh67wN1nTY5Ieug0bLwQ
=========================== logs ===========================
navigating to "http://localhost:8001/?wtr-session-id=uqh67wN1nTY5Ieug0bLwQ", waiting until "load"
============================================================  (failed on Chromium)
    page.goto: net::ERR_EMPTY_RESPONSE at http://localhost:8001/?wtr-session-id=uqh67wN1nTY5Ieug0bLwQ
    =========================== logs ===========================
    navigating to "http://localhost:8001/?wtr-session-id=uqh67wN1nTY5Ieug0bLwQ", waiting until "load"
    ============================================================
        at PlaywrightLauncherPage.runSession (/home/daniel/GitProjects/MQTT.js/node_modules/@web/test-runner-playwright/dist/PlaywrightLauncherPage.js:26:35)
        at async PlaywrightLauncher.startSession (/home/daniel/GitProjects/MQTT.js/node_modules/@web/test-runner-playwright/dist/PlaywrightLauncher.js:45:9)

If I disalble http2 error goes away but still not working because of https errors

from web.

bashmish avatar bashmish commented on June 25, 2024

Can you please make a smallest possible reproduction of this issue?

from web.

robertsLando avatar robertsLando commented on June 25, 2024

Just checkout this: mqttjs/MQTT.js#1722

uncomment this lines: https://github.com/mqttjs/MQTT.js/pull/1722/files#diff-7bfdd444e5650854e7536869ef3973956e89fbfc8562197c7c13f99cfb3047bfR41-R43

Then run:

npm install
npx wtr

from web.

bashmish avatar bashmish commented on June 25, 2024

By smallest possible reproduction I mean smth that contains minimum code that is required to show the error, e.g. minimal config and 1 test file with 1 test, not the whole project.

from web.

bashmish avatar bashmish commented on June 25, 2024

Btw, auto-open which doesn't respect http2 flag should definitely be fixed. I'm wondering more about the other error you are running into.

from web.

robertsLando avatar robertsLando commented on June 25, 2024

I will create a small repo to reproduce this, in the meanwhile if you want you can try doing what i described in my comment (would save me effort in creating a repro of the issue).

In general seems like http2 flah is completely ignored code wise when building the url, so you see the url wrong everywhere: in console, open, playwright goTo page and so on....

from web.

robertsLando avatar robertsLando commented on June 25, 2024

Here is the smallest possible repro: https://github.com/robertsLando/wtr-bug-test

from web.

bashmish avatar bashmish commented on June 25, 2024

Makes sense indeed, thanks for your time analysing this and providing this repro. I saw code that is handling the flag http2 for the URL construction, so I assumed it was working fine, but apparently not in all contexts and not for all features. So looks like it needs more work for WTR. I'd say you probably know enough now to make a fix PR, so give it a shot if you have time.

from web.

robertsLando avatar robertsLando commented on June 25, 2024

Ok so seems the missing piece was this setting:

protocol: 'https:',

When this is set everything else is ok. Not sure if this is expected BTW...

from web.

bashmish avatar bashmish commented on June 25, 2024

@robertsLando is http2 still needed then?

I feel like some docs is missing to explain all this. Would be good to work on this improvement, so I'll keep this issue open.

from web.

robertsLando avatar robertsLando commented on June 25, 2024

still needed then

Yeah seems without that something else is broken, I see in some places it uses http2 to build the url and others use protocol

from web.

klasjersevi avatar klasjersevi commented on June 25, 2024

I'm missing some of the built-in certificate options, specifically .pfx and .passphrase as I'm using pfx certificate instead of pem.

It would be nice if you could expose these as well.

More details:
https://nodejs.org/docs/v8.6.0/api/http2.html#http2_http2_createsecureserver_options_onrequesthandler
https://nodejs.org/docs/v8.6.0/api/tls.html#tls_tls_createsecurecontext_options

from web.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.