0

I am using https://github.com/scala-js/scala-js-env-selenium for in-browser testing, so far tests are running fine in local browser. Now i want to run my tests in remote browsers (https://app.crossbrowsertesting.com)

I created new CrossBrowser

import org.openqa.selenium.remote.{DesiredCapabilities, RemoteWebDriver}
import org.scalajs.jsenv.selenium.{BrowserDriver, SeleniumBrowser}
import java.net.URL

object CrossBrowser {
  def apply(): CrossBrowser = new CrossBrowser

  val username = "email"
  // Your username
  val authkey = "xxxxxxxxxx" // Your authkey

}

class CrossBrowser private() extends SeleniumBrowser {
  def name: String = "RemoteBrowser"

  def newDriver: BrowserDriver = new CrossDriver

  private class CrossDriver extends BrowserDriver {
    protected def newDriver(): RemoteWebDriver = {
      val caps = new DesiredCapabilities()

      caps.setCapability("name", "Selenium Test Example")
      caps.setCapability("build", "1.0")
      caps.setCapability("browser_api_name", "IE10")
      caps.setCapability("os_api_name", "Win7x64-C2")
      caps.setCapability("screen_resolution", "1024x768")
      caps.setCapability("record_video", "true")
      caps.setCapability("record_network", "true")

      new RemoteWebDriver(new URL("http://" + CrossBrowser.username + ":" + CrossBrowser.authkey + "@hub.crossbrowsertesting.com:80/wd/hub"), caps)
    }
  }

}

and updated build settings

 jsEnv  := new org.scalajs.jsenv.selenium.SeleniumJSEnv(CrossBrowser()),
 jsEnv in Test := new org.scalajs.jsenv.selenium.SeleniumJSEnv(CrossBrowser())

when i ran test command i got following output

[trace] Stack trace suppressed: run last client/test:loadedTestFrameworks for the full output. [error] (client/test:loadedTestFrameworks) org.openqa.selenium.WebDriverException: [fc92901a-f56a-4e4b-9d75-953402cbfe35] Test has timed out after 199 seconds [error] Command duration or timeout: 199.20 seconds [error] Build info: version: '2.53.0', revision: '35ae25b1534ae328c771e0856c93e187490ca824', time: '2016-03-15 10:43:46' [error] System info: host: 'Chandras-MacBook-Pro.local', ip: 'xx.xx.xxx.x', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.3', java.version: '1.8.0_25' [error] Driver info: org.openqa.selenium.remote.RemoteWebDriver [error] Capabilities [{browserAttachTimeout=0, enablePersistentHover=true, ie.forceCreateProcessApi=false, pageLoadStrategy=normal, ie.usePerProcessProxy=false, ignoreZoomSetting=false, handlesAlerts=true, version=10, platform=WINDOWS, nativeEvents=true, ie.ensureCleanSession=false, elementScrollBehavior=0, ie.browserCommandLineSwitches=, webdriver.remote.sessionid=fc92901a-f56a-4e4b-9d75-953402cbfe35, requireWindowFocus=false, browserName=internet explorer, initialBrowserUrl=http://localhost:33793/, takesScreenshot=true, javascriptEnabled=true, ignoreProtectedModeSettings=false, enableElementCacheCleanup=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=dismiss}] [error] Session ID: fc92901a-f56a-4e4b-9d75-953402cbfe35

Reason for time out is , test-runner tried to load file:/var/folders/n0/c0fyqlqx0gg15mv4t5mchgj80000gn/T/1464125278337-0/scalajsRun.html on remote machine which doesn't exist.

is it possible to do this kind of testing ..?(copy files to some server and load that url ..)

invariant
  • 8,758
  • 9
  • 47
  • 61

1 Answers1

1

Selenium will need access to your files if you are running local tests. That's usually done via proxies. There seems to be support for local testing though (https://crossbrowsertesting.com/local-testing), you could try to contact them to set this up.

adrobisch
  • 316
  • 1
  • 3