drastically simplify the link tests

This commit is contained in:
Loren Norman
2017-05-19 13:07:54 -04:00
parent 01c7769cbe
commit c9b053ed72
+11 -40
View File
@@ -1,15 +1,3 @@
getLinks = ->
@links ?= do ->
cy.visit('/guides/getting-started/why-cypress.html')
{
gettingStarted: cy.get('a[href^="/guides/getting-started/"]')
cypressBasics: cy.get('a[href^="/guides/cypress-basics/"]')
integratingCypress: cy.get('a[href^="/guides/integrating-cypress/"]')
advancedCypress: cy.get('a[href^="/guides/advanced-cypress/"]')
appendices: cy.get('a[href^="/guides/appendices/"]')
}
describe "Guides", ->
it "menu item goes straight to 'Why Cypress?'", ->
cy.visit('/')
@@ -18,33 +6,16 @@ describe "Guides", ->
.click()
.contains('h1', "Why Cypress?")
context "sections: ", ->
context "Getting Started", ->
it "all links work", ->
getLinks().gettingStarted
.each (element) ->
cy.request(element[0].href)
it "all section links work", ->
cy.visit('/guides/getting-started/why-cypress.html')
context "Cypress Basics", ->
it "all links work", ->
getLinks().cypressBasics
.each (element) ->
cy.request(element[0].href)
requestAllLinks = (selector) ->
cy.get(selector)
.each (element) ->
cy.request(element[0].href)
context "Integrating Cypress", ->
it "all links work", ->
getLinks().integratingCypress
.each (element) ->
cy.request(element[0].href)
context "Advanced Cypress", ->
it "all links work", ->
getLinks().advancedCypress
.each (element) ->
cy.request(element[0].href)
context "Appendices", ->
it "all links work", ->
getLinks().appendices
.each (element) ->
cy.request(element[0].href)
requestAllLinks('a[href^="/guides/getting-started/"]')
requestAllLinks('a[href^="/guides/cypress-basics/"]')
requestAllLinks('a[href^="/guides/integrating-cypress/"]')
requestAllLinks('a[href^="/guides/advanced-cypress/"]')
requestAllLinks('a[href^="/guides/appendices/"]')