module.exports = {
  'Load home page': function(client) {
    client.url('http://localhost:8080?seed=150').pause(1000);
    client.expect.element('#content').to.be.present;
  },

  'Start solitaire': function(client) {
    client
      .waitForElementVisible('#solitaire_button', 1000)
      .click('#solitaire_button');
    client.expect.element('#cards').to.be.present.after(1000);
    client.expect.element('#found-so-far').to.be.present;

    [
      'one-blue-solid-diamonds',
      'three-blue-solid-diamonds',
      'one-blue-striped-squiggles',
      'two-blue-striped-ovals',
      'one-red-solid-diamonds',
      'three-green-solid-squiggles',
      'three-red-solid-ovals',
      'three-blue-solid-squiggles',
      'two-green-solid-squiggles',
      'three-blue-striped-diamonds',
      'two-red-solid-squiggles',
      'two-blue-solid-ovals'
    ].forEach((str) => {
      client.expect.element(`.card img[src*=${str}]`).to.be.present;
    });
  },

  'Choose three cards that make a set': function(client) {
    client.useXpath();

    client.click('//*[@id="cards"]/ul/li/div/img[contains(@src, "one-blue-striped-squiggles")]');
    client.expect.element('//*[@id="cards"]/ul/li/div/img[contains(@src, "one-blue-striped-squiggles")]/..')
      .to.have.attribute('class').which.contains('selected');

    client.click('//*[@id="cards"]/ul/li/div/img[contains(@src, "two-blue-striped-ovals")]');
    client.expect.element('//*[@id="cards"]/ul/li/div/img[contains(@src, "two-blue-striped-ovals")]/..')
      .to.have.attribute('class').which.contains('selected');

    client
      .click('//*[@id="cards"]/ul/li/div/img[contains(@src, "three-blue-striped-diamonds")]')
      .waitForElementVisible('//*[@id="found-so-far"]/ul[1]', 1000);

    client.expect.element('//*[@id="found-so-far"]/ul[1]/li/div/img[contains(@src, "one-blue-striped-squiggles")]')
      .to.be.visible;
    client.expect.element('//*[@id="found-so-far"]/ul[1]/li/div/img[contains(@src, "two-blue-striped-ovals")]')
      .to.be.visible;
    client.expect.element('//*[@id="found-so-far"]/ul[1]/li/div/img[contains(@src, "three-blue-striped-diamonds")]')
      .to.be.visible;

    client.end();
  }
}

@@ -1024,240 +1024,360 @@
    c
-lient.useXpath();%0A%0A    client.click('//*%5B@id=%22cards%22%5D/ul/li/div/img%5Bcontains(@src, %22one-blue-striped-squiggles%22)%5D');%0A    client.expect.element('//*%5B@id=%22cards%22%5D/ul/li/div/img%5Bcontains(@src, %22one-blue-striped-squiggles%22)%5D/..')%0A      
+onst one = 'one-blue-striped-squiggles',%0A          two = 'two-blue-striped-ovals',%0A          three = 'three-blue-striped-diamonds';%0A    let xpath;%0A    xpath = (card) =%3E %7B%0A      return %60//*%5B@id=%22cards%22%5D/ul/li/div/img%5Bcontains(@src, %22$%7Bcard%7D%22)%5D%60;%0A    %7D;%0A%0A    client.useXpath();%0A%0A    client.click(xpath(one));%0A    client.expect.element(%60$%7Bxpath(one)%7D/..%60)
 .to.
@@ -1391,32 +1391,39 @@
 tribute('class')
+%0A      
 .which.contains(
@@ -1457,196 +1457,66 @@
 ick(
-'//*%5B@id=%22cards%22%5D/ul/li/div/img%5Bcontains(@src, %22two-blue-striped-ovals%22)%5D');%0A    client.expect.element('//*%5B@id=%22cards%22%5D/ul/li/div/img%5Bcontains(@src, %22two-blue-striped-ovals%22)%5D/..')%0A      
+xpath(two));%0A    client.expect.element(%60$%7Bxpath(two)%7D/..%60)
 .to.
@@ -1538,16 +1538,23 @@
 'class')
+%0A      
 .which.c
@@ -1603,87 +1603,20 @@
 ick(
-'//*%5B@id=%22cards%22%5D/ul/li/div/img%5Bcontains(@src, %22three-blue-striped-diamonds%22)%5D'
+xpath(three)
 )%0A  
@@ -1687,39 +1687,50 @@
 );%0A%0A    
-client.expect.element('
+xpath = (card) =%3E %7B%0A      return %60
 //*%5B@id=
@@ -1782,46 +1782,65 @@
 c, %22
-one-blue-striped-squiggles%22)%5D')
+$%7Bcard%7D%22)%5D%60;
 %0A    
-  
+%7D;%0A    client.expect.element(xpath(one))
 .to.
@@ -1881,239 +1881,74 @@
 ent(
-'//*%5B@id=%22found-so-far%22%5D/ul%5B1%5D/li/div/img%5Bcontains(@src, %22two-blue-striped-ovals%22)%5D')%0A      .to.be.visible;%0A    client.expect.element('//*%5B@id=%22found-so-far%22%5D/ul%5B1%5D/li/div/img%5Bcontains(@src, %22three-blue-striped-diamonds%22)%5D')%0A      
+xpath(two)).to.be.visible;%0A    client.expect.element(xpath(three))
 .to.

simplify integration test