Coder Social home page Coder Social logo

flakeless's Introduction

Flakeless - light touch, flake free browser testing in scala

What is it?

  • A lightweight library that wraps WebDriver for easy integration into both new and existing projects

Why would I use it?

  • You want to write your tests in blissful ignorance of async/ajax browser updates
  • You never want to write another sleep, explicit, implicit or fluent wait
  • You value zero tolerance to flaky tests
  • You value strong assertions (i.e. 'assert Element Not Found' is the most useless assertion one could possibly write - so Flakeless does not have it)
  • You want zero-effort test reporting

How?

  • No big bang migration, Flakeless lets you gradually migrate your tests one interaction at a time
  • Replace each browser action/assertion with one of Flakeless' simple Tell Dont Ask style primitives
  • Unable to find a primitive for X - raise an Issue
  • Gradually migrate from primitives to Page Objects using FluentDriver

Sounds good, how do I start eradicating my existing flaky tests?

Sounds good, how do I start using flakeless on a new project?

I'm using it, how do I better understand my test suite?

  • Read the Reports Guide (coming soon)

Installing

Add the following lines to your build.sbt (click on the 'build passing' link above to get the version number or go here)

resolvers += "Sonatype Repo" at "http://oss.sonatype.org/content/groups/public/"

libraryDependencies += "im.mange" %% "flakeless" % "latest-version"

Copyright © 2016-2018 Spabloshi Ltd

flakeless's People

Contributors

alltonp avatar rhyskeepence avatar

Watchers

 avatar  avatar

flakeless's Issues

No Record for flightnumber

Upgrading from 0.0.129 to 0.0.166 produces the following for all tests.

Thought I'd post it in case it rings any bells.

Starting ChromeDriver 2.37.544315 (730aa6a5fdba159ac9f4c1e8cbc59bf1b5ce12b7) on port 11901
Only local connections are allowed.
Jun 12, 2018 8:31:02 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS

No Record for flightnumber: 1
java.lang.RuntimeException: No Record for flightnumber: 1
	at im.mange.flakeless.innards.FlightDataRecorder.$anonfun$data$1(FlightDataRecorder.scala:36)
	at scala.Option.getOrElse(Option.scala:121)
	at im.mange.flakeless.innards.FlightDataRecorder.data(FlightDataRecorder.scala:36)
	at im.mange.flakeless.innards.FlightDataRecorder.stop(FlightDataRecorder.scala:21)
	at im.mange.flakeless.Flakeless.$anonfun$stopFlight$1(Flakeless.scala:16)
	at scala.runtime.java8.JFunction1$mcVI$sp.apply(JFunction1$mcVI$sp.java:12)
	at scala.Option.foreach(Option.scala:257)
	at im.mange.flakeless.Flakeless.stopFlight(Flakeless.scala:16)
	at [snip].BrowserTestSuite.testInBrowser(BrowserTestSuite.scala:19)

Where

abstract class BrowserTestSuite extends MyTestSuite {
  def testInBrowser(testBody: SystemUnderTest => Unit): Unit = {
    val sut = PooledServer.acquire

    try {
      sut.flakeless.startFlight(suite, currentTestName)
      sut.reset()
      testBody(sut)
    } catch {
      case t: Throwable =>
        sut.reportFailure(t)
        throw t
    } finally {
      sut.flakeless.stopFlight()
      PooledServer.release(sut)
    }
  }
}

Joda time

We're seeing problems with Joda time being excluded:

Exception in thread "shutdownHook3" Exception in thread "shutdownHook2" java.lang.NoClassDefFoundError: org/joda/time/DateTime
	at im.mange.flakeless.innards.FlightDataRecorder.record(FlightDataRecorder.scala:31)
	at im.mange.flakeless.Flakeless.$anonfun$record$1(Flakeless.scala:20)
	at scala.runtime.java8.JFunction1$mcVI$sp.apply(JFunction1$mcVI$sp.java:12)
	at scala.Option.foreach(Option.scala:257)
	at im.mange.flakeless.Flakeless.record(Flakeless.scala:20)
	at im.mange.flakeless.innards.Execute$.$anonfun$apply$3(Execute.scala:13)
	at im.mange.flakeless.innards.Execute$.$anonfun$apply$3$adapted(Execute.scala:13)
	at scala.Option.foreach(Option.scala:257)
	at im.mange.flakeless.innards.Execute$.apply(Execute.scala:13)
	at im.mange.flakeless.innards.WithoutElement$.apply(WithoutElement.scala:10)
	at im.mange.flakeless.Close.execute(Close.scala:17)
	at im.mange.flakeless.Close$.apply(Close.scala:9)
	at [snip]$2(PooledServer.scala:27)
	at scala.sys.ShutdownHookThread$$anon$1.run(ShutdownHookThread.scala:34)
java.lang.NoClassDefFoundError: org/joda/time/DateTime

How about switching from Joda time to Java 8's time? Can you see any problems in doing that?

It'd also make Circe/Argonaut straightforward as neither ship with a Joda time codec AFAIK.

What happened to ClearInputAndSendKeys?

Trawling through the commits, did ClearInputAndSendKeys get replaced with vanilla SendKeys?

So,

ClearInputAndSendKeys(driver, path, List(value, Keys.END))

becomes

SendKeys(driver, path, clear = true, List(value, Keys.END))

?

...and any uses of SendKeys now needs a value?

So,

SendKeys(driver, dealLogIdPath, Keys.TAB)

becomes

SendKeys(driver, dealLogIdPath, clear = false, Keys.TAB)

?

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.