mirror of
https://github.com/cypress-io/cypress.git
synced 2026-05-23 08:50:20 -05:00
drastically simplify the link tests
This commit is contained in:
@@ -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/"]')
|
||||
|
||||
Reference in New Issue
Block a user