Docker Cheat Sheet (pdf)

A quick reference cheat sheet on Docker commands for installation, containers, images and more.

REST Assured - How can I determine if a JSON response path exists or doesn't exist?

One of the most common problem: determine if a JSON response path exists or doesn't exist?

Solution:
Imagine that we have a resource called "/json" that returns the following JSON response:

{
   "done": true,
   "records": [
       {
           "Name": "Bob",
           "Phone": null,
           "CreatedDate": "2013-07-02T14:25:06Z",
           "Id": "0ca00000piscd1bj"
       }
   ],
   "size": 1
}

To verify that the records list contains the attribute Phone (even though it's null) we can do like this:

get("/json").then().assertThat().body("records.any { it.containsKey('Phone') }", is(true));

Likewise we can check that records doesn't contain an attribute called x:

get("/json").then().assertThat().body("records.any { it.containsKey('x') }", is(false));

To verify that a JSON object contains an element, for example to check that "size" is defined in the example above you can do like this:

get("/json").then().assertThat().body("any { it.key == 'size' }", is(true));

Selenium 4.0 Alpha 6 Release- Added support for Chrome DevTools protocol!

SeleniumHQ has release 4.0 Alpha 6 on 2020-05-28. Awesome contributors have added the support for Chrome DevTools Protocol!

We would like to thank them for making our life easy.

Key changes include:
  • Full remoting of the CDP protocol across the Grid
  • The skeleton of our GraphQL support
  • Better configuration options, especially for Nodes, via TOML
  • A bajillion improvements & fixes



Chrome:
1. Added DevTools classes and methods generated from the CDP specification. It currently supports commands and events and provides Rubyish API:
      driver.devtools.page.navigate(url: 'http://google.com')
      driver.devtools.console.clear_messages
      driver.devtools.page.enable
      driver.devtools.page.on(:load_event_fired) do |params|
        puts("Page loaded in #{params['timestamp']}")
      end
Check https://chromedevtools.github.io/devtools-protocol/ for more information about possible commands and events. Please note that this API is considered to be experimental and may change any time before stable 4.0 release.

2. Fixed an issue when passing :prompt_for_download (or similar snake_cased
    symbols) in Options#prefs would be ignored by Chrome because Selenium
    would internally convert it to camelCased format (:promptForDownload).
    Now :prefs are left intact.

Edge:
1. Fixed an issue when Driver#execute_cdp would not work for Chromium-based Edge browser.

Ruby:
1. Deprecated passing :desired_capabilities and :options to driver initialization in favor of :capabilities. They now can be combined in an array to make custom capabilities requirements:

      caps = Selenium::WebDriver::Remote::Capabilities.chrome
      opts = Selenium::WebDriver::Chrome::Options.new
      Selenium::WebDriver.for(:remote, capabilities: :chrome)
      Selenium::WebDriver.for(:remote, capabilities: caps)
      Selenium::WebDriver.for(:remote, capabilities: opts)
      Selenium::WebDriver.for(:remote, capabilities: [caps, opts])

2. Deprecated passing Hash to :capabilities in favor of Remote::Capabilities object.
3. Updated minimum require Ruby version to 2.5.
4. Improved keyword arguments handling to avoid warnings in Ruby 2.7.

Automating Tactically and Strategically with Alan Richardson

From Sausecon 2020: 
One of the biggest concepts that has made a difference to my programming and automating in recent years is the concept of “Tactical vs. Strategic.” Automating tactically might be for a specific purpose, possibly small, possibly a bit rough around the edges, not necessarily completely robust for everyone, etc. And strategic automation is more critical to long-term aims, maintained and maintainable, etc. In this talk, Alan Richardson provides examples of automating both Strategically and Tactically for activities as diverse as supporting testing, marketing and general life. We will also consider how and when to move from automating tactically to strategically, and how the concept has helped Alan change his programming style and how to write better code.