From d260d4e70ef5145cbb96c442b04a3038db15dd36 Mon Sep 17 00:00:00 2001 From: Kris Baillargeon Date: Wed, 21 Aug 2019 23:15:48 -0400 Subject: [PATCH 1/2] Removal of deprecated functions Issues: - `browser.field('referrer').value` has been deprecated and changed to `browser.referrer` - `browser.clickLink()` has been deprecated and changed to `browser.link()` - You must put `done()` at the end of all tests due to their async nature --- ch05/qa/tests-crosspage.js | 67 ++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 36 deletions(-) diff --git a/ch05/qa/tests-crosspage.js b/ch05/qa/tests-crosspage.js index 6bdf8aa..73fca09 100644 --- a/ch05/qa/tests-crosspage.js +++ b/ch05/qa/tests-crosspage.js @@ -1,42 +1,37 @@ -var Browser = require('zombie'), - assert = require('chai').assert; - +var Browser = require('zombie'), assert = require('chai').assert; var browser; - suite('Cross-Page Tests', function(){ + setup(function(){ + browser = new Browser(); + }); + test('requesting a group rate quote from the hood river tour page' + 'should populate the referrer field', function(done){ + var referrer = 'http://localhost:3000/tours/hood-river'; + browser.visit(referrer, function(){ + browser.link('.requestGroupRate', function(){ + assert(browser.referrer === referrer); + done(); + }); + }); + done(); + }); + test('requesting a group rate from the oregon coast tour page should ' + 'populate the referrer field', function(done){ + var referrer = 'http://localhost:3000/tours/oregon-coast'; + browser.visit(referrer, function(){ + browser.link('.requestGroupRate', function(){ + console.log(referrer); + done(); + }); + }); + done(); + }); - setup(function(){ - browser = new Browser(); - }); - - test('requesting a group rate quote from the hood river tour page should ' + - 'populate the hidden referrer field correctly', function(done){ - var referrer = 'http://localhost:3000/tours/hood-river'; - browser.visit(referrer, function(){ - browser.clickLink('.requestGroupRate', function(){ - assert(browser.field('referrer').value === referrer); - done(); - }); - }); - }); - - test('requesting a group rate from the oregon coast tour page should ' + - 'populate the hidden referrer field correctly', function(done){ - var referrer = 'http://localhost:3000/tours/oregon-coast'; - browser.visit(referrer, function(){ - browser.clickLink('.requestGroupRate', function(){ - assert(browser.field('referrer').value === referrer); - done(); - }); - }); - }); + test('visiting the "request group rate" page directly should result ' + 'in an empty referrer field', function(done){ + browser.visit('http://localhost:3000/tours/request-group-rate', function(){ + assert(browser.referrer == null) + done(); + }); + done(); + }); - test('visiting the "request group rate" page dirctly should result ' + - 'in an empty value for the referrer field', function(done){ - browser.visit('http://localhost:3000/tours/request-group-rate', function(){ - assert(browser.field('referrer').value === ''); - done(); - }); - }); }); From 48c07dd97680f2cbadfa200b74e11fdf34a9f2c0 Mon Sep 17 00:00:00 2001 From: Kris Baillargeon Date: Wed, 21 Aug 2019 23:16:10 -0400 Subject: [PATCH 2/2] Update tests-crosspage.js Issues: - `browser.field('referrer').value` has been deprecated and changed to `browser.referrer` - `browser.clickLink()` has been deprecated and changed to `browser.link()` - You must put `done()` at the end of all tests due to their async nature --- ch05/qa/tests-crosspage.js | 67 ++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 36 deletions(-) diff --git a/ch05/qa/tests-crosspage.js b/ch05/qa/tests-crosspage.js index 6bdf8aa..73fca09 100644 --- a/ch05/qa/tests-crosspage.js +++ b/ch05/qa/tests-crosspage.js @@ -1,42 +1,37 @@ -var Browser = require('zombie'), - assert = require('chai').assert; - +var Browser = require('zombie'), assert = require('chai').assert; var browser; - suite('Cross-Page Tests', function(){ + setup(function(){ + browser = new Browser(); + }); + test('requesting a group rate quote from the hood river tour page' + 'should populate the referrer field', function(done){ + var referrer = 'http://localhost:3000/tours/hood-river'; + browser.visit(referrer, function(){ + browser.link('.requestGroupRate', function(){ + assert(browser.referrer === referrer); + done(); + }); + }); + done(); + }); + test('requesting a group rate from the oregon coast tour page should ' + 'populate the referrer field', function(done){ + var referrer = 'http://localhost:3000/tours/oregon-coast'; + browser.visit(referrer, function(){ + browser.link('.requestGroupRate', function(){ + console.log(referrer); + done(); + }); + }); + done(); + }); - setup(function(){ - browser = new Browser(); - }); - - test('requesting a group rate quote from the hood river tour page should ' + - 'populate the hidden referrer field correctly', function(done){ - var referrer = 'http://localhost:3000/tours/hood-river'; - browser.visit(referrer, function(){ - browser.clickLink('.requestGroupRate', function(){ - assert(browser.field('referrer').value === referrer); - done(); - }); - }); - }); - - test('requesting a group rate from the oregon coast tour page should ' + - 'populate the hidden referrer field correctly', function(done){ - var referrer = 'http://localhost:3000/tours/oregon-coast'; - browser.visit(referrer, function(){ - browser.clickLink('.requestGroupRate', function(){ - assert(browser.field('referrer').value === referrer); - done(); - }); - }); - }); + test('visiting the "request group rate" page directly should result ' + 'in an empty referrer field', function(done){ + browser.visit('http://localhost:3000/tours/request-group-rate', function(){ + assert(browser.referrer == null) + done(); + }); + done(); + }); - test('visiting the "request group rate" page dirctly should result ' + - 'in an empty value for the referrer field', function(done){ - browser.visit('http://localhost:3000/tours/request-group-rate', function(){ - assert(browser.field('referrer').value === ''); - done(); - }); - }); });