Skip to content

Commit

Permalink
tests: add tests homepage and cookies (#446)
Browse files Browse the repository at this point in the history
  • Loading branch information
debs-obrien committed Jul 31, 2020
1 parent f6d2ff5 commit 20de286
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 15 deletions.
1 change: 1 addition & 0 deletions components/TheCookieBox.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<template>
<VueIfBot>
<CookieConsent
data-cy="cookie-box"
class="flex justify-center items-center text-light-onSurfaceSecondary dark:text-dark-onSurfaceSecondary border border-top border-light-border dark:border-dark-border xs:flex-col xs:pt-2 md:flex-row xs:text-center"
>
<template slot="message">
Expand Down
3 changes: 2 additions & 1 deletion components/partials/home/HomeWelcome.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
</div>
<div
class="flex flex-col sm:block text-light-onSurfaceSecondary dark:text-dark-onSurfaceSecondary"
data-cy="newsletter-link"
>
<a
href="#subscribe-to-newsletter"
Expand All @@ -72,7 +73,7 @@
</a>
</div>
</div>
<figure class="hidden lg:block lg:w-5/12">
<figure class="hidden lg:block lg:w-5/12" data-cy="video">
<AppMedia
src="https://player.vimeo.com/video/311756540"
class="mb-4"
Expand Down
8 changes: 8 additions & 0 deletions cypress/integration/cookie.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
describe('Checks if the accept cookies works', function() {
it('Successfully accepts the cookies', function() {
cy.visit('/')
cy.get('[data-cy="cookie-box"]').within(() => {
cy.get('button').click()
})
})
})
45 changes: 31 additions & 14 deletions cypress/integration/home.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,43 @@ describe('The Home Page links', () => {
cy.visit('/')
})
it('checks to see if the get started button links to guides', () => {
cy.get('a[data-cy="get-started"]').click()
cy.get('a[data-cy="get-started"]')
.click()
cy.url().should('include', '/guides/get-started/installation')
cy.visit('/guides/get-started/installation')
})

it('github stars links to the right page', () => {
cy.get('a[data-cy="github-stars"]')
.should('have.attr', 'href', 'https://github.com/nuxt/nuxt.js')
.click()
})

it('checks the newsletter message links to newsletter signup', () => {
cy.get('[data-cy="newsletter-link"]').within(() => {
cy.get('a').click()
cy.url().should('include', 'subscribe-to-newsletter')
})

})

it.only('checks the video is there', () => {
cy.get('[data-cy="video"]').within(() => {
cy.get('iframe').should('have.attr', 'src', 'https://player.vimeo.com/video/311756540')
})
})

it('checks to see if the try Nuxtjs button links to codesandbox', () => {
cy.get('a[data-cy="why"]')
.should('have.attr', 'href', 'https://template.nuxtjs.org')
.click()
})

it('checks to see if the sponsor button links to the sponsor page', () => {
cy.get('a[data-cy="sponsors"]').click()
cy.url().should('include', '/sponsor-nuxtjs')
cy.visit('/sponsor-nuxtjs')
})
it.skip('checks to see if the try Nuxtjs button links to ', () => {
cy.get('a[data-cy="why"]')
.click()
.its('url')
.should(
'eq',
'https://codesandbox.io/s/github/nuxt/codesandbox-nuxt/tree/master/'
)
})
it.skip('github stars links to the right page', () => {
cy.get('a[data-cy="github-stars"]').click()
cy.url().should('eq', 'https://github.com/nuxt/nuxt.js')
})


})

0 comments on commit 20de286

Please sign in to comment.