GithubHelp home page GithubHelp logo

bazelbuild / rules_webtesting Goto Github PK

View Code? Open in Web Editor NEW
94.0 13.0 56.0 1.18 MB

Bazel rules to allow testing against a browser with WebDriver.

License: Apache License 2.0

Python 1.52% Go 58.86% Shell 2.00% Java 1.41% Scala 0.19% Starlark 36.02%
bazel-rules selenium webdriver java go python

rules_webtesting's Introduction

Bazel Web Testing Rules

Build status

Bazel rules and supporting code to allow testing against a browser with WebDriver.

Configure your Bazel project

For all languages, you need to add the following to your WORKSPACE file:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "io_bazel_rules_webtesting",
    sha256 = "<version-specific-sha>",
    urls = [
        "https://github.com/bazelbuild/rules_webtesting/releases/download/<version>/rules_webtesting.tar.gz",
    ],
)

load("@io_bazel_rules_webtesting//web:repositories.bzl", "web_test_repositories")

web_test_repositories()

We maintain predefined versioned browsers in @io_bazel_rules_webtesting//web/versioned:browsers-<version>.bzl that can be referenced from @io_bazel_rules_webtesting//browsers. Note: these versions in these files are not locked in until the corresponding release has been created.

To use, add the following to your WORKSPACE file:

load("@io_bazel_rules_webtesting//web/versioned:browsers-<version>.bzl", "browser_repositories")

browser_repositories(chromium=True, firefox=True)

Then you should add the appropriate dependencies depending on what language you are writing your tests in:

Java

load("@io_bazel_rules_webtesting//web:java_repositories.bzl", "java_repositories")

java_repositories()

Using rules_jvm_external?

If you're using rules_jvm_external to manage your dependencies, you can add the required artifacts directly to your maven_install instead of using java_repositories.

load("@io_bazel_rules_webtesting//web:java_repositories.bzl", "RULES_WEBTESTING_ARTIFACTS")

maven_install(
    artifacts = [
      # Your artifacts
    ] + RULES_WEBTESTING_ARTIFACTS,
    # Enabling compatability support is required.
    generate_compat_repositories = True,
)

Scala

load("@io_bazel_rules_webtesting//web:java_repositories.bzl", "java_repositories")

java_repositories()

rule_scala_version = "e4560ac332e9da731c1e50a76af2579c55836a5c"

http_archive(
    name = "io_bazel_rules_scala",
    sha256 = "ccf19e8f966022eaaca64da559c6140b23409829cb315f2eff5dc3e757fb6ad8",
    strip_prefix = "rules_scala-%s" % rules_scala_version,
    type = "zip",
    url = "https://github.com/bazelbuild/rules_scala/archive/%s.zip" % rules_scala_version,
)

# Stores Scala version and other configuration
# 2.12 is a default version, other versions can be use by passing them explicitly:
# scala_config(scala_version = "2.11.12")
load("@io_bazel_rules_scala//:scala_config.bzl", "scala_config")
scala_config()

load("@io_bazel_rules_scala//scala:scala.bzl", "scala_repositories")
scala_repositories()

load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
rules_proto_dependencies()
rules_proto_toolchains()

load("@io_bazel_rules_scala//scala:toolchains.bzl", "scala_register_toolchains")
scala_register_toolchains()

# optional: setup ScalaTest toolchain and dependencies
load("@io_bazel_rules_scala//testing:scalatest.bzl", "scalatest_repositories", "scalatest_toolchain")
scalatest_repositories()
scalatest_toolchain()

Python

load("@io_bazel_rules_webtesting//web:py_repositories.bzl", "py_repositories")

py_repositories()

Go

http_archive(
    name = "io_bazel_rules_go",
    sha256 = "b7a62250a3a73277ade0ce306d22f122365b513f5402222403e507f2f997d421",
    urls = [
        "https://github.com/bazelbuild/rules_go/releases/download/0.16.3/rules_go-0.16.3.tar.gz",
    ],
)

http_archive(
    name = "bazel_gazelle",
    sha256 = "6e875ab4b6bf64a38c352887760f21203ab054676d9c1b274963907e0768740d",
    urls = [
        "https://github.com/bazelbuild/bazel-gazelle/releases/download/0.15.0/bazel-gazelle-0.15.0.tar.gz",
    ],
)

load("@io_bazel_rules_go//go:def.bzl", "go_register_toolchains", "go_rules_dependencies")

go_rules_dependencies()

go_register_toolchains()

load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")

gazelle_dependencies()

load("@io_bazel_rules_webtesting//web:go_repositories.bzl", "go_repositories")

go_repositories()

Write your tests

Write your test in the language of your choice, but use our provided Browser API to get an instance of WebDriver.

Example Java Test

import com.google.testing.web.WebTest;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.openqa.selenium.WebDriver;

@RunWith(JUnit4.class)
public class BrowserTest {
  private WebDriver driver;

  @Before public void createDriver() {
    driver = new WebTest().newWebDriverSession();
  }

  @After public void quitDriver() {
    try {
      driver.quit();
     } finally {
      driver = null;
     }
   }

  // your tests here
}

Example Python Test

import unittest
from testing.web import webtest


class BrowserTest(unittest.TestCase):
  def setUp(self):
    self.driver = webtest.new_webdriver_session()

  def tearDown(self):
    try:
      self.driver.quit()
    finally:
      self.driver = None

  # Your tests here

if __name__ == "__main__":
  unittest.main()

Example Go Test

import (
    "testing"

    "github.com/tebeka/selenium"
    "github.com/bazelbuild/rules_webtesting/go/webtest"
)

func TestWebApp(t *testing.T) {
    wd, err := webtest.NewWebDriverSession(selenium.Capabilities{})
    if err != nil {
        t.Fatal(err)
    }

    // your test here

    if err := wd.Quit(); err != nil {
        t.Logf("Error quitting webdriver: %v", err)
    }
}

BUILD file

In your BUILD files, load the correct language specific build rule and create a test target using it:

load("@io_bazel_rules_webtesting//web:py.bzl", "py_web_test_suite")

py_web_test_suite(
    name = "browser_test",
    srcs = ["browser_test.py"],
    browsers = [
        "@io_bazel_rules_webtesting//browsers:chromium-local",
    ],
    local = True,
    deps = ["@io_bazel_rules_webtesting//testing/web"],
)

rules_webtesting's People

Contributors

comius avatar davidstanke avatar devversion avatar drmarcii avatar dslomov avatar gregmagolan avatar hermione521 avatar hlopko avatar jart avatar jjudd avatar jmhodges avatar joshbruning avatar juangj avatar katre avatar katrina95 avatar limdor avatar meistert avatar meteorcloudy avatar mollyibot avatar mtrea avatar nshahan avatar pawelz avatar philwo avatar ptmphuong avatar sgammon avatar systemlogic avatar tdsmith avatar vertexwahn avatar vladmos avatar zellyn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rules_webtesting's Issues

busted bazel_skylib build

I'm building rules_webtesting HEAD (980c8ab) with bazel 0.10rc7 and it's broken with the error:

(06:47:26) ERROR: /home/travis/bazel/outbase/external/io_bazel_rules_webtesting/web/repositories.bzl:19:1: file '@bazel_skylib//:lib.bzl' does not contain symbol 'versions'
(06:47:26) ERROR: error loading package '': Extension file 'web/repositories.bzl' has errors
(06:47:26) ERROR: error loading package '': Extension file 'web/repositories.bzl' has errors

Break end-user dependency on rules_go

In rules_typescript we are working to make Bazel work better for a broad user base of Angular developers. One major problem with the first-time user experience is a very large download of the Go SDK.

Our solution is to release rules_typescript with pre-compiled go binaries for each platform. Then the rules_go dependency only appears for us in development, and we strip such load() statements from the starlark code we publish. This should allow our users to drop the rules_go dependency from their WORKSPACE files.

However, rules_typescript depends on rules_webtesting, which still requires the transitive dependency on rules_go. We're happy to help cut this dependency so that Angular developers aren't compiling Go programs from sources.

Allow custom browser configuration

Hey, I realize that there is no official documentation (yet). Though, we want to overwrite the chromium browser by specifying another launch argument.

  • --window-size=1024,768

I've tried creating my own target that uses the browser rule. Unfortunately I cannot just refer to /third_party/chromium because those are marked as internal.

It feels a bit odd if people would need to bring in the whole browser archive on their own, if they just want to overwrite a browser metadata/configuration.

Would it be possible to expose the third_party browser archives? or better, is there any official & better solution?

README's WORKSPACE example is wrong

The url provided in the README in the http_archive doesn't have the right formatting for where the assets would be for a version and also forgets to the quotation marks around it.

building rules_webtesting for go tooling seems busted

I've getting errors when trying to build any go target including go_web_test_suite when I call the rules_webtesting *_repositories functions in my WORKSPACE.

The errors I get are

ERROR: /private/var/tmp/_bazel_jmhodges/ee957dabdee1b1a9e1f2fe90369cf80f/external/io_bazel_rules_webtesting/web/repositories.bzl:146:3: //external:com_github_gorilla_mux: no such attribute 'url' in 'go_repository' rule.
ERROR: /private/var/tmp/_bazel_jmhodges/ee957dabdee1b1a9e1f2fe90369cf80f/external/io_bazel_rules_webtesting/web/repositories.bzl:157:3: //external:com_github_tebeka_selenium: no such attribute 'url' in 'go_repository' rule.
ERROR: error loading package '': Encountered error while reading extension file 'package_manager/package_manager.bzl': no such package '@distroless//package_manager': error loading package 'external': Could not load //external package.

In my WORKSPACE is:


load("@io_bazel_rules_webtesting//web:repositories.bzl",
    "browser_repositories",
    "web_test_repositories")

web_test_repositories()

browser_repositories(
    chromium = True,
)

and

git_repository(
    name = "io_bazel_rules_go",
    remote = "https://github.com/bazelbuild/rules_go.git",
    commit = "072a319be76f2c20b10c5c8b6f8cb8f3508f8196",
)

load("@io_bazel_rules_go//go:def.bzl", "go_repositories", "new_go_repository")

As soon as I comment out the web_test_repositories and browser_repositories lines, all of my Go targets (that are not rules_webtesting ones, of course) work again.

Both of the rules_* repos above are set to the current HEAD of their respective git repos. The current HEAD of rules_go I also tried this with tag = 0.5.0 for the rules_go repo and got the same errors but that's to be expected as that version had not yet combined new_go_repository with go_repository. I'm on bazel 0.5.1 on OS X.

(I suspect the rules_go external that rules_webtesting defines is either incorrect or colliding with the ones defined in my own WORKSPACE somehow but this is all very strange to me.)

dart_web_test_suite fails on Mac

Running the WebDriver tests from: https://github.com/google/webdriver.dart

The dart_vm_test targets work fine, the generation works fine, but the dart_web_test_suites seem to die around Go:

staats-macbookair:webdriver.dart staats$ bazel test test:alert_test_io
Extracting Bazel installation...
...........
ERROR: /private/var/tmp/_bazel_staats/a5854b8c51697a7bcf462b387687c967/external/io_bazel_rules_go/go/toolchain/BUILD:10:1: no such package '@io_bazel_rules_go_toolchain//': Not a file: /private/var/tmp/_bazel_staats/a5854b8c51697a7bcf462b387687c967/external/golang_darwin_amd64/BUILD and referenced by '@io_bazel_rules_go//go/toolchain:go_tool'.
ERROR: Analysis of target '//test:alert_test_io_chromium-native' failed; build aborted.
INFO: Elapsed time: 35.289s
ERROR: Couldn't start the build. Unable to run tests.

This might be ultimately a Go issue, but also a problem for anyone working on Mac.

data race in HEAD

Just got this in my CI. It's a data race inside of rules_webtesting.

Looks cmd.Wait is accessed in multiple goroutines in an unsafe way at https://github.com/bazelbuild/rules_webtesting/blob/master/go/wsl/driver/driver.go#L100 and then again at https://github.com/bazelbuild/rules_webtesting/blob/master/go/wsl/hub/hub.go#L231

(cmd.Wait actually does writes to the cmd struct, which is surprising to lots of folks, and a fairly common mistake)

WARNING: DATA RACE
Read at 0x00c4201a44f0 by goroutine 13:
  os/exec.(*Cmd).Wait()
      GOROOT/src/os/exec/exec.go:456 +0x8c
  github.com/bazelbuild/rules_webtesting/go/wsl/hub.(*Hub).quitSession()
      external/io_bazel_rules_webtesting/go/wsl/hub/hub.go:231 +0x148
  github.com/bazelbuild/rules_webtesting/go/wsl/hub.(*Hub).ServeHTTP()
      external/io_bazel_rules_webtesting/go/wsl/hub/hub.go:74 +0x736
  net/http.(*ServeMux).ServeHTTP()
      GOROOT/src/net/http/server.go:2337 +0x9f
  net/http.serverHandler.ServeHTTP()
      GOROOT/src/net/http/server.go:2694 +0xb9
  net/http.(*conn).serve()
      GOROOT/src/net/http/server.go:1830 +0x7dc
Previous write at 0x00c4201a44f0 by goroutine 45:
  os/exec.(*Cmd).Wait()
      GOROOT/src/os/exec/exec.go:459 +0xb1
  github.com/bazelbuild/rules_webtesting/go/wsl/driver.New.func1()
      external/io_bazel_rules_webtesting/go/wsl/driver/driver.go:100 +0x50
Goroutine 13 (running) created at:
  net/http.(*Server).Serve()
      GOROOT/src/net/http/server.go:2795 +0x364
  net/http.(*Server).ListenAndServe()
      GOROOT/src/net/http/server.go:2711 +0xc4
  github.com/bazelbuild/rules_webtesting/go/wsl.startServer.func1()
      external/io_bazel_rules_webtesting/go/wsl/wsl.go:52 +0xcb
Goroutine 45 (running) created at:
  github.com/bazelbuild/rules_webtesting/go/wsl/driver.New()
      external/io_bazel_rules_webtesting/go/wsl/driver/driver.go:99 +0x4fe
  github.com/bazelbuild/rules_webtesting/go/wsl/hub.(*Hub).newSessionJWPCaps()
      external/io_bazel_rules_webtesting/go/wsl/hub/hub.go:203 +0x18c
  github.com/bazelbuild/rules_webtesting/go/wsl/hub.(*Hub).newSession()
      external/io_bazel_rules_webtesting/go/wsl/hub/hub.go:123 +0x5b9
  github.com/bazelbuild/rules_webtesting/go/wsl/hub.(*Hub).ServeHTTP()
      external/io_bazel_rules_webtesting/go/wsl/hub/hub.go:58 +0xa23
  net/http.(*ServeMux).ServeHTTP()
      GOROOT/src/net/http/server.go:2337 +0x9f
  net/http.serverHandler.ServeHTTP()
      GOROOT/src/net/http/server.go:2694 +0xb9
  net/http.(*conn).serve()
      GOROOT/src/net/http/server.go:1830 +0x7dc

Go chromium testing failing in travis ci

All of a sudden, my Go chromium webdriver tests are not able to boot at all on Linux in Travis CI. Tried adding all of the logging on to get more out, but it's happening at . I thought it happened when I upgraded rules_go, but I've got a patch that updates rules_webtesting to the same rules_go and it still failed. Upgraded the tebeka/selenium lib and it still failed. Thought it might be the version of Trusty that Travis CI started using, but downgrading that didn't help, either.

I'm left thinking that the chromium version is so out of date that it's refusing to start for some security reason, maybe? Haven't been able to figure out what might be a stable build to upgrade to, though. Would love some pointers on that.

I see there's another similar issue, but not sure if it's the same.

Debugging a failing test.

Is there a way to have a browser open while actually running the test so it would be easier to debug a failing test? Ideally, the browser would wait for the user to press crtl-c or something before closing. Especially useful for JS webcomponent_tester tests
Thanks!

Documentation - Why use rules_webtesting?

At my company we have selenium test suites run using junit and using the standard java_test rules. They to instantiate the Firefox webdriver in a shared library class, which I think is only a few lines of code. One thing I can't tell from reading the materials about this are what benefits moving to rules_webtesting brings over what we're doing today?
Thank you!
Rob

meaning of noci?

(Sorry that this is a question, not a ticket. Do you have another preferred way of getting questions?)

What's the meaning of the noci tag in rules_webtesting? I was using it elsewhere in my own repo for a specific problem and wanted to make sure I'm not stomping on this use case too hard.

Skylib change of API

This commit changes the bazel_skylib API. Specifically, it removes the top level lib.bzl index import, which is used in this repo (e.g. here).

The resulting error is the following:

ERROR: error loading package '': Extension file not found. Unable to load file '@bazel_skylib//:lib/types.bzl': file doesn't exist or isn't a file

Not sure why I even got this error since seem to pin a skylib release. In any case, using a released version of rules_webtesting (0.2.1 to be exact) worked for me.

libX11.so.6 is dynamically linked

I am getting

20:36:13.640:ERROR [launcher]: Cannot start ChromeHeadless
/Users/chlove/.cache/bazel/_bazel_chlove/d2cf91f570d86c1699adc2085f7e4aeb/sandbox/processwrapper-sandbox/3/execroot/gke_bazel_example/bazel-out/k8-fastbuild/bin/js-client/src/hello-world/test_chromium-local.runfiles/io_bazel_rules_webtesting/third_party/chromium/chromium.out/chrome-linux/chrome: error while loading shared libraries: libX11.so.6: cannot open shared object file: No such file or directory

While running this inside a container. Looks like chrome install is not quite huermetic. Ideas?

Please help me update the webtesting rules

I'm attempting to get a large change in to reorganize Bazel's execution root (see bazelbuild/bazel#1681 for more details). Basically, instead of external repositories being children of the main repository (execroot/main_repo/external/remote_repo) they are all siblings (execroot/remote_repo and execroot/main_repo).

I'd like to get all of the projects that depend on the old behavior to be forward and backward compatible before I submit the change. However, I'm having trouble getting the webtesting tests to pass, in particular, //dart:webtest_test_chromium-native fails with:

2017/02/01 18:01:41 launching server at: localhost:54587
Unhandled exception:
Could not import "package:test/test.dart" from "file:///home/kchodorow/.cache/bazel/_bazel_kchodorow/2f53ce1e4fad28a08e1bb04034180ff8/execroot/rules_web/bazel-out/local-fastbuild/bin/dart/webtest_test_chromium-native.runfiles/io_bazel_rules_webtesting/dart/test/webtest_test.dart": FileSystemException: Cannot open file, path = '/home/kchodorow/.cache/bazel/_bazel_kchodorow/2f53ce1e4fad28a08e1bb04034180ff8/execroot/rules_web/bazel-out/local-fastbuild/bin/dart/webtest_test_chromium-native.runfiles/io_bazel_rules_webtesting/lib/test.dart' (OS Error: No such file or directory, errno = 2)
null
2017/02/01 18:01:41 test failed exit status 255

I've been trying to debug this, but I am not familiar with dart and not sure how to fix. It seems like an import path issue, but I'm not sure how to change it. I think it should be looking in webtest_test_chromium-native.runfiles/org_dartlang_pub_test/lib/test.dart for this dart file, but I don't understand how to make it do so.

If you'd like to try it out, you'll need a version of Bazel with my execroot change: https://github.com/kchodorow/bazel/tree/execroot (bazel build //src:bazel) and update the version of the go rules rules_webtesting is using (feel free to use my fork: https://github.com/kchodorow/rules_webtesting).

This is the last issue I know of blocking the rollout of bazelbuild/bazel#1681, so any help would be appreciated!

rules_webtesting test timeout on Bazel CI server

In the bazel-watcher project, I have been trying to make my integration tests more realistic. To this end I moved them to operate a real browser against the SUT. Unfortunately the test is timing out and I'm not sure what has gone wrong. Do you have anything you could point me to to help me debug this?

TIMEOUT: //e2e/live_reload:go_default_test_chromium-native (Summary)
      /private/var/tmp/_bazel_ci/2524ef1d14c6c9bacede7aa4fd0df798/execroot/__main__/bazel-out/darwin-fastbuild/testlogs/e2e/live_reload/go_default_test_chromium-native/test.log
INFO: From Testing //e2e/live_reload:go_default_test_chromium-native:
==================== Test output for //e2e/live_reload:go_default_test_chromium-native:
GTEST_TMP_DIR=/private/var/tmp/_bazel_ci/2524ef1d14c6c9bacede7aa4fd0df798/execroot/__main__/_tmp/0fe57cab7d42fe3819b5cccb0209c585
TEST_INFRASTRUCTURE_FAILURE_FILE=/private/var/tmp/_bazel_ci/2524ef1d14c6c9bacede7aa4fd0df798/execroot/__main__/bazel-out/darwin-fastbuild/testlogs/e2e/live_reload/go_default_test_chromium-native/test.infrastructure_failure
TEST_SRCDIR=/private/var/tmp/_bazel_ci/2524ef1d14c6c9bacede7aa4fd0df798/execroot/__main__/bazel-out/darwin-fastbuild/bin/e2e/live_reload/go_default_test_chromium-native.runfiles
RUNFILES_MANIFEST_FILE=/private/var/tmp/_bazel_ci/2524ef1d14c6c9bacede7aa4fd0df798/execroot/__main__/bazel-out/darwin-fastbuild/bin/e2e/live_reload/go_default_test_chromium-native.runfiles/MANIFEST
WEB_TEST_METADATA=__main__/e2e/live_reload/go_default_test_chromium-native.gen.json
JAVA_RUNFILES=/private/var/tmp/_bazel_ci/2524ef1d14c6c9bacede7aa4fd0df798/execroot/__main__/bazel-out/darwin-fastbuild/bin/e2e/live_reload/go_default_test_chromium-native.runfiles
TMPDIR=/var/folders/sp/kj32dh7s4r748mbkl2bvkz640000gn/T/
TEST_UNUSED_RUNFILES_LOG_FILE=/private/var/tmp/_bazel_ci/2524ef1d14c6c9bacede7aa4fd0df798/execroot/__main__/bazel-out/darwin-fastbuild/testlogs/e2e/live_reload/go_default_test_chromium-native/test.unused_runfiles_log
TEST_LOGSPLITTER_OUTPUT_FILE=/private/var/tmp/_bazel_ci/2524ef1d14c6c9bacede7aa4fd0df798/execroot/__main__/bazel-out/darwin-fastbuild/testlogs/e2e/live_reload/go_default_test_chromium-native/test.raw_splitlogs/test.splitlogs
TEST_BINARY=e2e/live_reload/go_default_test_chromium-native
USER=ci
TEST_UNDECLARED_OUTPUTS_DIR=/private/var/tmp/_bazel_ci/2524ef1d14c6c9bacede7aa4fd0df798/execroot/__main__/bazel-out/darwin-fastbuild/testlogs/e2e/live_reload/go_default_test_chromium-native/test.outputs
RUNFILES_DIR=/private/var/tmp/_bazel_ci/2524ef1d14c6c9bacede7aa4fd0df798/execroot/__main__/bazel-out/darwin-fastbuild/bin/e2e/live_reload/go_default_test_chromium-native.runfiles
TEST_TIMEOUT=900
__CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0
PATH=.:/Users/ci/node/node-v8.9.4-darwin-x64/bin:/usr/bin:/bin:/usr/sbin:/sbin
TEST_TEMPDIR=test_tempdir.iCKTTb
PWD=/private/var/tmp/_bazel_ci/2524ef1d14c6c9bacede7aa4fd0df798/execroot/__main__/bazel-out/darwin-fastbuild/bin/e2e/live_reload/go_default_test_chromium-native.runfiles/__main__
TEST_WARNINGS_OUTPUT_FILE=/private/var/tmp/_bazel_ci/2524ef1d14c6c9bacede7aa4fd0df798/execroot/__main__/bazel-out/darwin-fastbuild/testlogs/e2e/live_reload/go_default_test_chromium-native/test.warnings
TZ=UTC
TEST_UNDECLARED_OUTPUTS_ANNOTATIONS_DIR=/private/var/tmp/_bazel_ci/2524ef1d14c6c9bacede7aa4fd0df798/execroot/__main__/bazel-out/darwin-fastbuild/testlogs/e2e/live_reload/go_default_test_chromium-native/test.outputs_manifest
SHLVL=2
DISABLE_X_DISPLAY=1
RUN_UNDER_RUNFILES=1
TEST_SIZE=large
TEST_TMPDIR=/private/var/tmp/_bazel_ci/2524ef1d14c6c9bacede7aa4fd0df798/execroot/__main__/_tmp/0fe57cab7d42fe3819b5cccb0209c585
TEST_WORKSPACE=__main__
XML_OUTPUT_FILE=/private/var/tmp/_bazel_ci/2524ef1d14c6c9bacede7aa4fd0df798/execroot/__main__/bazel-out/darwin-fastbuild/testlogs/e2e/live_reload/go_default_test_chromium-native/test.xml
PYTHON_RUNFILES=/private/var/tmp/_bazel_ci/2524ef1d14c6c9bacede7aa4fd0df798/execroot/__main__/bazel-out/darwin-fastbuild/bin/e2e/live_reload/go_default_test_chromium-native.runfiles
TEST_PREMATURE_EXIT_FILE=/private/var/tmp/_bazel_ci/2524ef1d14c6c9bacede7aa4fd0df798/execroot/__main__/bazel-out/darwin-fastbuild/testlogs/e2e/live_reload/go_default_test_chromium-native/test.exited_prematurely
BASH_FUNC_rlocation%%=() {  if is_absolute "$1"; then
 echo "$1";
 else
 echo "$(dirname $RUNFILES_MANIFEST_FILE)/$1";
 fi
}
BASH_FUNC_is_absolute%%=() {  [[ "$1" = /* ]] || [[ "$1" =~ ^[a-zA-Z]:[/\\].* ]]
}
_=/usr/bin/printenv
2018/02/01 18:28:43 launching HTTP server at: localhost:54347
Starting ChromeDriver 2.33.506106 (8a06c39c4582fbfbab6966dbb1c38a9173bfb1a2) on port 54346
Only local connections are allowed.
2018/02/01 18:28:58 Creating session

2018/02/01 18:29:00 Caps: {OSSCaps:map[chromeOptions:map[args:[--no-sandbox] binary:/private/var/tmp/_bazel_ci/2524ef1d14c6c9bacede7aa4fd0df798/execroot/__main__/_tmp/0fe57cab7d42fe3819b5cccb0209c585/chrome-mac.zip483332071/chrome-mac/Chromium.app/Contents/MacOS/chromium] browserName:chrome webdriver.logging.profiler.enabled:true] Always:map[browserName:chrome chromeOptions:map[args:[--no-sandbox] binary:/private/var/tmp/_bazel_ci/2524ef1d14c6c9bacede7aa4fd0df798/execroot/__main__/_tmp/0fe57cab7d42fe3819b5cccb0209c585/chrome-mac.zip483332071/chrome-mac/Chromium.app/Contents/MacOS/chromium]] First:[]}
Terminated: 15
================================================================================

https://ci.bazel.build/blue/organizations/jenkins/PR%2Fbazel-watcher/detail/bazel-watcher/179/

Support windows

At least half the Angular ecosystem runs on Windows machines.

currently trying the simple python example from the README I get

ERROR: C:/users/angular/appdata/local/temp/_bazel_angular/zyn_1rhm/external/io_bazel_rules_webtesting/browsers/BUILD:67:
1: Configurable attribute "environment" doesn't match this configuration (would a default condition help?).
Conditions checked:
 @io_bazel_rules_webtesting//browsers:linux
 @io_bazel_rules_webtesting//browsers:mac.
ERROR: Analysis of target '//:browser_test_chromium-native' failed; build aborted.

Bazel CI failure in //go/launcher/webdriver:go_default_test_chrome55-win10

Bazel CI is failing for rules_webtesting. The error message isn't clear, but I also see a failure running locally with the latest Bazel release
rules_webtesting.log
:

$ bazel test //go/launcher/webdriver:go_default_test_chrome55-win10
2017/10/30 16:33:41 Caps: {OSSCaps:map[tags:[sauce //go/launcher/webdriver:go_default_test_wrapped_test //browsers/sauce:chrome55-win10 //web:default_config] tunnel-identifier: version:55.0 browserName:chrome build: name://go/launcher/webdriver:go_default_test_chrome55-win10 platform:Windows 10] Always:map[name://go/launcher/webdriver:go_default_test_chrome55-win10 platform:Windows 10 tags:[sauce //go/launcher/webdriver:go_default_test_wrapped_test //browsers/sauce:chrome55-win10 //web:default_config] tunnel-identifier: version:55.0 browserName:chrome build:] First:[]}
--- FAIL: TestSetWindowRect (0.77s)
	webdriver_test.go:418: [Go WebDriver Client] (session not created) [Go WebDriver Client]: invalid character 'S' looking for beginning of value unmarshalling &{Status:<nil> SessionID: Value:<nil> Error: Message: StackTrace:<nil>}
FAIL

Full log is attached.

Bazel --incompatible_depset_is_not_iterable

Hi,

It looks like this project cannot build with the Bazel flag --incompatible_depset_is_not_iterable.
Logs (https://buildkite.com/bazel/bazelisk-plus-incompatible-flags/builds/28#2d632a4f-bd90-4e5d-be99-954b500efb8d):

ERROR: /var/lib/buildkite-agent/builds/bk-docker-d6ch/bazel-downstream-projects/rules_webtesting/testdata/BUILD.bazel:29:1: in web_test_files rule //testdata:keys:
--
  | Traceback (most recent call last):
  | File "/var/lib/buildkite-agent/builds/bk-docker-d6ch/bazel-downstream-projects/rules_webtesting/testdata/BUILD.bazel", line 29
  | web_test_files(name = 'keys')
  | File "/var/lib/buildkite-agent/builds/bk-docker-d6ch/bazel-downstream-projects/rules_webtesting/web/internal/web_test_files.bzl", line 29, in _web_test_files_impl
  | len(target.files)
  | depset is not iterable. You may use `len(<depset>.to_list())` instead. Use --incompatible_depset_is_not_iterable=false to temporarily disable this check.

Could you take a look?
Depset documentation: https://docs.bazel.build/versions/master/skylark/depsets.html

Let me know if you need any help

rules_web broken on ci.bazel.build

Hello,

I see an error on our ci that seems to be unrelated to bazel (I hope :)

http://ci.bazel.io/view/Dashboard/job/rules_web/

FATAL: Error launching Sauce Connect
com.saucelabs.ci.sauceconnect.AbstractSauceTunnelManager$SauceConnectDidNotStartException: Error launching Sauce Connect
	at com.saucelabs.ci.sauceconnect.AbstractSauceTunnelManager.openConnection(AbstractSauceTunnelManager.java:335)
	at hudson.plugins.sauce_ondemand.SauceOnDemandBuildWrapper$SauceConnectHandler.call(SauceOnDemandBuildWrapper.java:930)
	at hudson.plugins.sauce_ondemand.SauceOnDemandBuildWrapper$SauceConnectHandler.call(SauceOnDemandBuildWrapper.java:831)
	at hudson.remoting.UserRequest.perform(UserRequest.java:153)
	at hudson.remoting.UserRequest.perform(UserRequest.java:50)
	at hudson.remoting.Request$2.run(Request.java:336)
	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at hudson.remoting.Engine$1$1.run(Engine.java:94)
	at java.lang.Thread.run(Thread.java:748)
	at ......remote call to JNLP4-connect connection from 104.132.34.109/104.132.34.109:41894(Native Method)
	at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1545)
	at hudson.remoting.UserResponse.retrieve(UserRequest.java:253)
	at hudson.remoting.Channel.call(Channel.java:830)
	at hudson.plugins.sauce_ondemand.SauceOnDemandBuildWrapper.setUp(SauceOnDemandBuildWrapper.java:378)
	at hudson.model.Build$BuildExecution.doRun(Build.java:157)
	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
	at hudson.model.Run.execute(Run.java:1728)
	at hudson.matrix.MatrixRun.run(MatrixRun.java:146)
	at hudson.model.ResourceController.execute(ResourceController.java:98)
	at hudson.model.Executor.run(Executor.java:405)

Any doc or example of using /browsers/sauce ?

angular/angular has switched to rules_webtesting
angular/angular#23859

The next thing we need is coverage on more browsers via SauceLabs. I've tried using the sauce Windows browser in this repo but I don't know how the variables in that file are meant to be interpolated.

Where should I be looking?
thx

README example is busted

When I add

git_repository(
    name = "io_bazel_rules_webtesting",
    remote = "https://github.com/bazelbuild/rules_webtesting.git",
    commit = "7e730b14fb5d2537ede28675eadad1e184c2f717", # current master
)

load("@io_bazel_rules_webtesting//web:repositories.bzl", "web_test_repositories")
load("//web/internal:platform_http_file.bzl", "platform_http_file")

to my WORKSPACE, and try to build, I get this error:

$  bazel build //go/svc/fe:dev
ERROR: error loading package '': Extension file not found. Unable to load package for '//web/internal:platform_http_file.bzl': BUILD file not found on package path
ERROR: error loading package '': Extension file not found. Unable to load package for '//web/internal:platform_http_file.bzl': BUILD file not found on package path

I'm not sure what the fix is here. I've tried a few different commits and they all fail with the same error.

This is with bazel 0.18 on macOS.

Consider renaming rules_web -> rules_webtesting

I was really confused when I first read this project. I thought it was going to be a one stop shop for web development. But according to the readme, this project seems to have a razor-sharp focus on having a positive impact on web testing. So maybe it would be better if this project was renamed rules_webtesting.

Thoughts @DrMarcII and @damienmg?

upgrading to HEAD fails Go builds that succeeded previously

After updating to b944304cd5065fc7d9b695fd1051a3d0a3f65af3, my go tests now fail where they succeeded before on macOS.

Using the chromium-local target in the browsers package, the process doesn't even seem to boot but my test code is still able to call things like FindElement. I'll try to get more debugging info, but nothing is returned from selenium's browser logs rpcs.

Using chrome-external, it immediately fails with [External WebDriver Environment]: environment variable "EXTERNAL_WEBDRIVER_SERVER_ADDRESS" not set. Going from the name (though it's not documented anywhere), it's maybe expected that there's another webdriver process running somewhere and the user is supposed to set that?

Need a release to support latest rules_go

WORKSPACE:

http_archive(
    name = "io_bazel_rules_webtesting",
    url = "https://github.com/bazelbuild/rules_webtesting/archive/v0.2.0.zip",
    strip_prefix = "rules_webtesting-0.2.0",
    sha256 = "cecc12f07e95740750a40d38e8b14b76fefa1551bef9332cb432d564d693723c",
)
http_archive(
    name = "io_bazel_rules_go",
    url = "https://github.com/bazelbuild/rules_go/releases/download/0.13.0/rules_go-0.13.0.tar.gz",
    sha256 = "ba79c532ac400cefd1859cbc8a9829346aa69e3b99482cd5a54432092cbc3933",
)

causes
https://circleci.com/gh/alexeagle/angular-bazel-example/650

ERROR: /usr/local/google/home/alexeagle/.cache/bazel/_bazel_alexeagle/5c0aaa094e7be03dbabccfd0d5d7e8a8/external/io_bazel_rules_webtesting/web/repositories.bzl:18:1: file '@io_bazel_rules_go//go:def.bzl' does not contain symbol 'go_repository'

https://github.com/bazelbuild/rules_go/blob/07ef9e307a8f0095e5b10a70e1d291eace65eb61/deprecation.rst#removed-features
says
Legacy go_repository and new_go_repository
Deprecated in: 0.12.0
Removed in: 0.13.0
The go_repository rule has moved from @io_bazel_rules_go to @bazel_gazelle. Gazelle is a core part of go_repository, and moving go_repository to that repository allows us to reduce rules_go's dependence on Gazelle.

Unable to run chromium in docker container


Starting browser ChromeHeadless
--
  | 16 12 2018 18:27:50.254:ERROR [launcher]: Cannot start ChromeHeadless
  | [1216/182749.973514:FATAL:zygote_host_impl_linux.cc(116)] No usable sandbox! Update your kernel or see https://chromium.googlesource.com/chromium/src/+/master/docs/linux_suid_sandbox_development.md for more information on developing with the SUID sandbox. If you want to live dangerously and need an immediate workaround, you can try using --no-sandbox.
  | #0 0x55d8b0c7f4ac base::debug::StackTrace::StackTrace()
  | #1 0x55d8b0bfa110 logging::LogMessage::~LogMessage()
  | #2 0x55d8b20e4740 service_manager::ZygoteHostImpl::Init()
  | #3 0x55d8b08c8ede content::ContentMainRunnerImpl::Initialize()
  | #4 0x55d8b08fc978 service_manager::Main()
  | #5 0x55d8b08c7721 content::ContentMain()
  | #6 0x55d8b4dae5ad headless::(anonymous namespace)::RunContentMain()
  | #7 0x55d8b4dae638 headless::HeadlessBrowserMain()
  | #8 0x55d8b08f9f6b headless::HeadlessShellMain()
  | #9 0x55d8aecc71ac ChromeMain
  | #10 0x7f7cbacbcb97 __libc_start_main
  | #11 0x55d8aecc702a _start


I tried adding the flags with a custom browser json

{
  "capabilities" : {
    "goog:chromeOptions" : {
      "args" : [
        "--no-sandbox",
        "--disable-setuid-sandbox",
        "--disable-gpu",
        "--disable-dev-shm-usage"
      ]
    }
  }
}

in my BUILD.bazel

custom_browser(
    name = "chromium-no-sandbox",
    browser = "@io_bazel_rules_webtesting//browsers:chromium-local",
    metadata = "chromium-no-sandbox.json",
    visibility = ["//frontend:__subpackages__"],
)

Then used as such:

ts_web_test_suite(
    name = "tests",
    srcs = ["@npm//node_modules/tslib:tslib.js"],
    bootstrap = [
        "@npm//node_modules/zone.js:dist/zone-testing-bundle.js",
        "@npm//node_modules/reflect-metadata:Reflect.js",
        ":module-id.js",
    ],
    browsers = [
        #"@io_bazel_rules_webtesting//browsers:chromium-local",
        "//:chromium-no-sandbox",
    ],
    deps = [
        "//frontend/testnet/src/app:test_lib",
    ],
)

Here's a full log:
prysm_build_2482_bazel-test-fe-preston.log

Browser installation spams the output

Typical bazel rules are silent unless there's an error.
When running a web test suite, I see many lines starting with

INFO: From Extracting ../org_chromium_chromedriver/file/chromedriver_linux64.zip:

Archive:  external/org_chromium_chromedriver/file/chromedriver_linux64.zip
  inflating: bazel-out/k8-fastbuild/bin/external/io_bazel_rules_webtesting/third_party/chromedriver/chromedriver.out/chromedriver  
INFO: From Extracting ../org_chromium_chromium/file/chrome-linux.zip:

Archive:  external/org_chromium_chromium/file/chrome-linux.zip
   creating: bazel-out/k8-fastbuild/bin/external/io_bazel_rules_webtesting/third_party/chromium/chromium.out/chrome-linux/
  inflating: bazel-out/k8-fastbuild/bin/external/io_bazel_rules_webtesting/third_party/chromium/chromium.out/chrome-linux/libEGL.so  
  inflating: bazel-out/k8-fastbuild/bin/external/io_bazel_rules_webtesting/third_party/chromium/chromium.out/chrome-linux/chrome_sandbox  
  inflating: bazel-out/k8-fastbuild/bin/external/io_bazel_rules_webtesting/third_party/chromium/chromium.out/chrome-linux/chrome  

see the bazel test section of https://circleci.com/gh/angular/angular/42747

Support Bazel IntelliJ Plugin

I noticed that rules_webtesting has some strange behavior when combined with https://github.com/bazelbuild/intellij

I created an simple example project, which imports to IntelliJ to make things easy to reproduce:
https://github.com/lucidsoftware/rules_webtesting_intellij_example

Normally with IntelliJ + Bazel, when you create a java_test there are icons in the gutter of your test file, that enable you to run the test:

When you create a java_web_test_suite, these same icons show up, but they don't do anyything:

After some digging I found that it is because of the manual tag set by default in constants.bzl
https://github.com/bazelbuild/rules_webtesting/blob/master/web/internal/constants.bzl#L16

If you set some tags on your java_web_test_suite. For example, java_test_tags = ["foo"] here https://github.com/lucidsoftware/rules_webtesting_intellij_example/blob/master/com/google/testing/web/BUILD.bazel#L26

Then the test fails with a MalformedURLException:

java.net.MalformedURLException
java.lang.RuntimeException: java.net.MalformedURLException
	at com.google.testing.web.WebTest.<init>(WebTest.java:60)

Thrown here: https://github.com/bazelbuild/rules_webtesting/blob/master/java/com/google/testing/web/WebTest.java#L60

After some more digging, I found that this is essentially what rules_webtesting is doing when you call java_web_test_suite:

The reason the test fails with a MalformedURLException is because the WEB_TEST_WEBDRIVER_SERVER is never set because instead of the java_test being run by the web_test, it is running independently. Accordingly, the Selenium server never starts, that environment variable is never set, and things fail.

I've been poking at the IntelliJ plugin and rules_webtesting without much progress. I tried to change rules_webtesting to do something like this, but I don't believe this is possible with Bazel:

I'm not familiar enough with the IntelliJ plugin to know if it is feasible to tell java_tests from java_web_test_suites to execute the web_test instead of the java_test.

I would love to get people's thoughts on whether this is possible, and if it is, then a potential path forward.

rules_webtesting not working with bazel 0.4.5

I set up my workspace like the readme says and copied the sample python test. When I try to run it I get:

ERROR: error loading package '': Encountered error while reading extension file 'web/repositories.bzl': no such package '@io_bazel_rules_webtesting//web': Invalid branch, tag, or commit: Ref tags/HEAD can not be resolved.

Bazel with --incompatible_no_transitive_loads

Build is failing when I run Bazel with --incompatible_no_transitive_loads. We plan to enable this flag by default soon. Could you please update your code?

I've seen this error message, which should go away if you update Gazelle. There may be other errors though.

ERROR: .../rules_webtesting/web/go_repositories.bzl:17:1: file '@bazel_gazelle//:deps.bzl' does not contain symbol 'go_repository'

master chromium-local is breaking unless`--no-sandbox` is applied

With the latest rules_webtesting, my Go selenium tests are crashing with errors like

session not created: [Go WebDriver Client] (session not created) unable to create session: [Go WebDriver Client] (session not created) session not created

and, at one point,

unable to discover open window in chrome

I verified that I had a recent chromedriver in place (2.43, using the rules_webtesting's own packages).

The problem went away when I added a custom_browser that added

{
  "capabilities" : {
    "goog:chromeOptions" : {
      "args" : [
        "--no-sandbox"
      ]
    }
  }
}

I'm not sure what's going on.

My test suite was defined as:

go_web_test_suite(
    name = "integration_test",
    srcs = [
        "accounts_integration_test.go",
        "background_reporter_test.go",
        "fake_subs_test.go",
        "integration_test.go",
        "mailer_test.go",
        "stripe_mock_test.go",
    ],
    browser_overrides = {
        "@io_bazel_rules_webtesting//browsers:chromium-local": {
            # this tag is a hack to avoid go_default_library and this test
            # writing to the howsmyssl_billing_test database at the same
            # time. Need a more robust solution which probably involves fixes to
            # setup.sh to create integration envs.
            "tags": ["exclusive"],
        },
    },
    browsers = [
        "@io_bazel_rules_webtesting//browsers:chromium-local",
    ],
    data = [":dev_config"],
    embed = [":go_default_library"],
    deps = [
        "@com_github_golang_mock//gomock:go_default_library",
        "@com_github_google_go_cmp//cmp:go_default_library",
        "@com_github_google_go_cmp//cmp/cmpopts:go_default_library",
        "@com_github_tebeka_selenium//:go_default_library",
        "@com_github_tebeka_selenium//chrome:go_default_library",
        "@com_github_tebeka_selenium//log:go_default_library",
        "@io_bazel_rules_webtesting//go/webtest:go_default_library",
    ],
)

Headless chrome

Pls help me understand this better.

I would like to use headless chrome as a browser. I see that the chrome-local browser definition passes the --headless flag. So is this headless chrome already? I believe not, since I'm getting annoying macos system dialogs when initializing a test case.

Therefore, how would I go about defining a new browser definition for headless chrome? The metadata json file format is a bit opaque.

Thanks!

Confused about usage

First of all this looks like a very useful project, thanks for building it. Note that if I clone rules_webtesting 8fca1d0 and bazel test //... within rules_webtesting itself, all tests pass. Great.

When I try to use it with another project, I'm loading @io_bazel_rules_webtesting and invoking web_test_repositories(java = True). Per README guidance, I have more or less the following web_test_suite:

java_test(
    name = "browser_test",
    size = "small",
    srcs = [
        "MyTest.java",
    ],
    test_class = "org.pubref.k8a.MyTest",
    tags = ["manual"],
    deps = [
        "//third_party:junit4",
        "@org_seleniumhq_java//:selenium",
        "@io_bazel_rules_web//java/com/google/testing/web",
    ],
)

web_test_suite(
    name = "browser_test_suite",
    browsers = [
        "@io_bazel_rules_web//browsers:chrome-native",
        #"@io_bazel_rules_web//browsers:chrome-external",
        #"@io_bazel_rules_web//browsers:phantomjs",
    ],
    #local = 1,
    #tags = ["requires-network"],
    test = ":browser_test",
)

However, when I try to bazel test :browser_test_suite using various browsers above, it fails with similar to The repository named 'org_chromium_chromedriver' could not be resolved and referenced by '@io_bazel_rules_webtesting//browsers:chromedriver'.

Although listed in //browsers, none of those platform workspaces exist, and they aren't loaded by virtue of web_test_repositories. Basically, I can't seem to get any of the platform_http_file repository rules to load by normal means. It does not appear that platform_http_file is intended to be used by end-user as it is package-private.

However, if I convert rules_webtesting to a local_repository, change the visibility to public, and use platform_http_file to load those resources in my own WORKSPACE (mimicing yours), it works:

load("@io_bazel_rules_webtesting//web/internal:platform_http_file.bzl", "platform_http_file")

platform_http_file(
    name = "org_chromium_chromedriver",
    amd64_sha256 = "0c01b05276da98f203dc7eb4236c2ee7fe799b432734e088549bd0aadc71958e",
    amd64_url = "http://chromedriver.storage.googleapis.com/2.24/chromedriver_linux64.zip",
    macos_sha256 = "d4f6e13d88ecf20735138f16ab1545e855a42bce41bebe73667a028871777790",
    macos_url = "http://chromedriver.storage.googleapis.com/2.24/chromedriver_mac64.zip",
)

platform_http_file(
    name = "com_google_chrome",
    amd64_sha256 = "6e26d74fd814c38cd419d1ffe87b3e81ad6cfe453e27c7a672ab3c452968e71d",
    amd64_url = "https://commondatastorage.googleapis.com/chrome-unsigned/desktop-5c0tCh/53.0.2785.116/precise64/chrome-precise64.zip",
    macos_sha256 = "84b3cf4f7a9f85fa90dda837b1e38820c83c383fcb6346bbec6448d5128dd7f9",
    macos_url = "https://commondatastorage.googleapis.com/chrome-unsigned/desktop-5c0tCh/53.0.2785.116/mac64/chrome-mac.zip",
)

platform_http_file(
    name = "org_phantomjs",
    amd64_sha256 = "86dd9a4bf4aee45f1a84c9f61cf1947c1d6dce9b9e8d2a907105da7852460d2f",
    amd64_url = "http://bazel-mirror.storage.googleapis.com/bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2",
    macos_sha256 = "538cf488219ab27e309eafc629e2bcee9976990fe90b1ec334f541779150f8c1",
    macos_url = "http://bazel-mirror.storage.googleapis.com/bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-macosx.zip",
)

What am I doing wrong? How are the browsers supposed to get loaded?

web_test_archive doesn't work outside of rules_webtesting repo

web_test_archive, the wrapper func, is defined with references to "//common/conditions:windows" which will error with no such package 'common/conditions' when used in another repo.

I had already copied over the //common/conditions targets into my own repo used them in my web_test_archive calls for chromedriver and chromium, but web_test_archive hardcodes that last windows one in its wrapper for the extract_exe parameters it passes in. Can't get those to stop being called.

For context, I'm using web_test_archive because there's no way to use custom_browser to remove things from array arguments in the JSON which led me to trying browser. But using browser for a chromium browser requires a dependency on //third_party/chromedriver and //third_party/chromium and those are not public. Attempting to recreate those targets locally led to trying web_test_archive.

rules_webtesting does not work with Bazel≥0.20.0

A backward-incompatible change in Bazel appears to have broken the build:

$ git rev-parse HEAD
95df2543eee901f5ec29bb99f9754f7d59692ae0
$ bazel-0.20.0-linux-x86_64 build //... 2>&1 | cat
INFO: Invocation ID: a932166c-bcfb-4980-8d48-8ccce0ccf30b
Loading:
Loading: 0 packages loaded
Analyzing: 125 targets (0 packages loaded, 0 targets configured)
ERROR: /usr/local/google/home/wchargin/.cache/bazel/_bazel_wchargin/6a3f93da08ca7e1fb787d2fbdf04f0ec/external/io_bazel_rules_go/BUILD.bazel:18:1: in go_context_data rule @io_bazel_rules_go//:go_context_data:
Traceback (most recent call last):
        File "/usr/local/google/home/wchargin/.cache/bazel/_bazel_wchargin/6a3f93da08ca7e1fb787d2fbdf04f0ec/external/io_bazel_rules_go/BUILD.bazel", line 18
                go_context_data(name = 'go_context_data')
        File "/usr/local/google/home/wchargin/.cache/bazel/_bazel_wchargin/6a3f93da08ca7e1fb787d2fbdf04f0ec/external/io_bazel_rules_go/go/private/context.bzl", line 310, in _go_context_data
                _filter_options((cpp.compiler_options(features) ...)), ...)
        File "/usr/local/google/home/wchargin/.cache/bazel/_bazel_wchargin/6a3f93da08ca7e1fb787d2fbdf04f0ec/external/io_bazel_rules_go/go/private/context.bzl", line 311, in _filter_options
                cpp.compiler_options(features)
Information about the C++ toolchain API is not accessible anymore through ctx.fragments.cpp (see --incompatible_disable_legacy_cpp_toolchain_skylark_api on http://docs.bazel.build/versions/master/skylark/backward-compatibility.html#disable-legacy-c-configuration-api for migration n
otes). Use CcToolchainInfo instead.
ERROR: Analysis of target '//go/webdriver:go_default_library' failed; build aborted: Analysis of target '@io_bazel_rules_go//:go_context_data' failed; build aborted
INFO: Elapsed time: 0.137s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded, 0 targets configured)
FAILED: Build did NOT complete successfully (0 packages loaded, 0 targets configured)
$ bazel-0.20.0-linux-x86_64 build //...  --incompatible_disable_legacy_cpp_toolchain_skylark_api=false 2>&1 | cat
INFO: Invocation ID: e897a8e5-d217-450b-8818-fe86fc0cea81
Loading:
Loading: 0 packages loaded
Analyzing: 125 targets (0 packages loaded, 0 targets configured)
ERROR: /usr/local/google/home/wchargin/.cache/bazel/_bazel_wchargin/6a3f93da08ca7e1fb787d2fbdf04f0ec/external/io_bazel_rules_go/BUILD.bazel:18:1: in go_context_data rule @io_bazel_rules_go//:go_context_data:
Traceback (most recent call last):
        File "/usr/local/google/home/wchargin/.cache/bazel/_bazel_wchargin/6a3f93da08ca7e1fb787d2fbdf04f0ec/external/io_bazel_rules_go/BUILD.bazel", line 18
                go_context_data(name = 'go_context_data')
        File "/usr/local/google/home/wchargin/.cache/bazel/_bazel_wchargin/6a3f93da08ca7e1fb787d2fbdf04f0ec/external/io_bazel_rules_go/go/private/context.bzl", line 310, in _go_context_data
                _filter_options((cpp.compiler_options(features) ...)), ...)
        File "/usr/local/google/home/wchargin/.cache/bazel/_bazel_wchargin/6a3f93da08ca7e1fb787d2fbdf04f0ec/external/io_bazel_rules_go/go/private/context.bzl", line 311, in _filter_options
                cpp.compiler_options(features)
Starlark APIs accessing compilation flags has been removed. Use the new API on cc_common (see --incompatible_disable_legacy_flags_cc_toolchain_api onhttps://docs.bazel.build/versions/master/skylark/backward-compatibility.html#disable-legacy-c-toolchain-api for migration notes).
ERROR: Analysis of target '//go/httphelper:go_default_library' failed; build aborted: Analysis of target '@io_bazel_rules_go//:go_context_data' failed; build aborted
INFO: Elapsed time: 0.226s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded, 6 targets configured)
FAILED: Build did NOT complete successfully (0 packages loaded, 6 targets configured)

0.19.2 works; 0.20.0 does not.

Abstract definition of browser tarballs

Per discussion in #19, it would be nice if the user didn't have to define the browser tarball urls by hand. If the goal is to have the user make a conscious decision about the browser version, then perhaps it would be better to have the browser version be a part of the target name. In that case, rules_web would still define the location of all the external urls. The user would simply pick a target for the browsers list.

Some repositories have no Windows version

On windows, the rules_typescript project fails to build:

$ bazel build //...

ERROR: C:/users/alexeagle/_bazel_alexeagle/hxhfuc3q/external/io_bazel_rules_webtesting/third_party/geckodriver/BUILD.bazel:25:1: no such package '@org_mozilla_geckodriver//file': ind
ex out of range (index is 0, but sequence has 0 elements) and referenced by '@io_bazel_rules_webtesting//third_party/geckodriver:geckodriver'                                         
ERROR: Analysis of target '//examples/protocol_buffers:test_firefox-local' failed; build aborted: Analysis failed                                                                     

Seems it's because

def org_mozilla_geckodriver():
platform_http_file(
name = "org_mozilla_geckodriver",
licenses = ["reciprocal"], # MPL 2.0
amd64_sha256 =
"7f55c4c89695fd1e6f8fc7372345acc1e2dbaa4a8003cee4bd282eed88145937",
amd64_urls = [
"https://mirror.bazel.build/github.com/mozilla/geckodriver/releases/download/v0.19.1/geckodriver-v0.19.1-linux64.tar.gz",
"https://github.com/mozilla/geckodriver/releases/download/v0.19.1/geckodriver-v0.19.1-linux64.tar.gz",
],
macos_sha256 =
"eb5a2971e5eb4a2fe74a3b8089f0f2cc96eed548c28526b8351f0f459c080836",
macos_urls = [
# TODO(fisherii): v0.19.1 is mirrored and ready to go.
"https://mirror.bazel.build/github.com/mozilla/geckodriver/releases/download/v0.16.1/geckodriver-v0.16.1-macos.tar.gz",
"https://github.com/mozilla/geckodriver/releases/download/v0.16.1/geckodriver-v0.16.1-macos.tar.gz",
],
)
is missing a windows case.

Go proxy doesn't boot on macOS 10.12.5

Discussed in #147, but it seemed different enough to #148, that it should be its own ticket.

The Go proxy here doesn't boot on macOS 10.12.5 because the domain returned by httphelpers.FQDN returns the os.Hostname result which does not actually map to any IP addresses.

This seems to happen on my machine when the hostname (as visible in the console, too) differs from the domain talked about in the Sharing section of the macOS System Preferences.

It seems we're trying to boot on a public net interface, but I don't know why.

The error:

2017/06/28 19:30:32 launching HTTP server at: JeffsPersonalMBP:63762
Starting ChromeDriver 2.29.461585 (0be2cd95f834e9ee7c46bcc7cf405b483f5ae83b) on port 63757
Only local connections are allowed.
2017/06/28 19:30:33 [WebDriver proxy]: context deadline exceeded waiting for healthy: [WebDriver proxy]: error getting http://JeffsPersonalMBP:63762/healthz: Get http://JeffsPersonalMBP:63762/healthz: dial tcp: lookup JeffsPersonalMBP: no such host

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.