Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Karma firefox test failing with Cannot find module 'Firefox.app/Contents/MacOS/firefox' #296

Closed

Description

@gregmagolan

After the last update of rules_webtesting in rules_typescript, ts_web_test_suite targets that test against the @io_bazel_rules_webtesting//browsers:firefox-local browser fail with Cannot find module 'Firefox.app/Contents/MacOS/firefox'.

This is true for OSX at least. I haven't checked if it fails on Linux or Windows.

//cc @filipesilva @alexeagle

Activity

  1. alexeagle commented on Oct 4, 2018

    @alexeagle
    Contributor

    Fails on Linux too.

  2. filipesilva commented on Oct 5, 2018

    @filipesilva
    Contributor

    Does this happen only on local machines? CI seems to be green.

  3. gregmagolan commented on Oct 5, 2018

    @gregmagolan
    ContributorAuthor

    Does this happen only on local machines? CI seems to be green.

    The firefox tests have been commented out on CI

  4. filipesilva commented on Oct 5, 2018

    @filipesilva
    Contributor

    Oh that's right. On the Windows CI they seem to be running though: https://github.com/bazelbuild/rules_typescript/blob/master/.bazelci/presubmit.yml

    If both firefox and chrome tests are commented out for linux/osx, does that mean that ts_web_test is not being tested there at all? I think those are the only browsers that are available.

  5. gregmagolan commented on Oct 5, 2018

    @gregmagolan
    ContributorAuthor

    Chrome is still tested in CircleCI linux at least. But yes, I think we need to get more testing up for these.

  6. gregmagolan commented on Oct 11, 2018

    @gregmagolan
    ContributorAuthor

    A little more information on this. rules_webtesting provides a path to the chromium executable in the test environment:

    {
      "capabilities": {
        "browserName": "chromium",
        "goog:chromeOptions": {
          "args": [
            "--headless",
            "--use-gl=swiftshader-webgl"
          ],
          "binary": "%FILE:CHROMIUM%"
        },
        "google:wslConfig": {
          "args": [
            "--port=%WSLPORT:WSL%"
          ],
          "binary": "%FILE:CHROMEDRIVER%",
          "port": "%WSLPORT:WSL%",
          "shutdown": true,
          "status": true
        }
      },
      "environment": "local",
      "browserLabel": "@io_bazel_rules_webtesting//browsers:chromium-local",
      "webTestFiles": [
        {
          "namedFiles": {
            "CHROMEDRIVER": "io_bazel_rules_webtesting/third_party/chromedriver/chromedriver.out/chromedriver",
            "CHROMIUM": "io_bazel_rules_webtesting/third_party/chromium/chromium.out/chrome-mac/Chromium.app/Contents/MacOS/chromium",
            "WEBDRIVER_SERVER_LIGHT": "io_bazel_rules_webtesting/go/wsl/main/darwin_amd64_stripped/main"
          }
        }
      ],
      "extension": {}
    }
    

    but for Firefox it now provides an archiveFile and the path for firefox that is provided is for the archive contents. This change is what broke the firefox tests.

    {
      "capabilities": {
        "browserName": "firefox",
        "google:wslConfig": {
          "args": [
            "--port=%WSLPORT:WSL%",
            "--host=%WSL:HOST_IP%",
            "--marionette-port=%WSLPORT:MARIONETTE%"
          ],
          "binary": "%FILE:GECKODRIVER%",
          "port": "%WSLPORT:WSL%",
          "shutdown": false,
          "status": true
        },
        "moz:firefoxOptions": {
          "args": [
            "--headless"
          ],
          "binary": "%FILE:FIREFOX%"
        }
      },
      "environment": "local",
      "browserLabel": "@io_bazel_rules_webtesting//browsers:firefox-local",
      "webTestFiles": [
        {
          "namedFiles": {
            "EXTRACT_EXE": "io_bazel_rules_webtesting/web/internal/extract.sh",
            "GECKODRIVER": "io_bazel_rules_webtesting/third_party/geckodriver/geckodriver.out/geckodriver",
            "WEBDRIVER_SERVER_LIGHT": "io_bazel_rules_webtesting/go/wsl/main/darwin_amd64_stripped/main"
          }
        },
        {
          "archiveFile": "org_mozilla_firefox/file/Firefox-61.0.2.zip",
          "namedFiles": {
            "FIREFOX": "Firefox.app/Contents/MacOS/firefox"
          }
        }
      ],
      "extension": {}
    }
    

    There is a io_bazel_rules_webtesting/web/internal/extract.sh file in the runfiles for the firefox test which isn't in the chromium runfiles. Its also listed in namedFiles under EXTRACT_EXE. It looks like the test runner meant to run extract.sh on the firefox archive now.

  7. gregmagolan commented on Oct 11, 2018

    @gregmagolan
    ContributorAuthor

    Running an sh file from within node won't work on Windows. Perhaps using a native node zip extractor such as extract-zip for this is the best solution.

  8. gregmagolan commented on Oct 11, 2018

    @gregmagolan
    ContributorAuthor
  9. filipesilva commented on Oct 12, 2018

    @filipesilva
    Contributor

    Extracting the firefox archive and providing a final path for the executable sounds like that kind of thing that should be happening inside rules_webtesting. I don't think we should be trying to extract internal rules_webtesting downloaded archives and processing their files.

  10. gregmagolan commented on Oct 12, 2018

    @gregmagolan
    ContributorAuthor

    So it looks like this rules_webtesting added a feature where a web_test_archive can be extracted at either build time or runtime: bazelbuild/rules_webtesting#222.

    And firefox was change to be extracted at run here: bazelbuild/rules_webtesting#293

    Later a comment got added that Firefox needs to be in a writeable directory (I assume that means that it must be extracted in the runfiles directory when the test runs):

    web_test_archive(
        name = "firefox",
        archive = "@org_mozilla_firefox//file",
        # Firefox needs to be in a writable directory.
        extract = "run",
    
  11. gregmagolan commented on Oct 12, 2018

    @gregmagolan
    ContributorAuthor

    Some more context:

        doc = """Specifies an archive file with named files in it.
    
            If extract=="run", then the archive will only be extracted if WTL wants one
            of the named files in it.""",
    

    The extract is handled automatically by the .go code but in our case we may have to handle it ourselves.

  12. gregmagolan commented on Dec 11, 2018

    @gregmagolan
    ContributorAuthor

    Fixed with #299

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions