{"size": 2045, "ext": "js", "max_stars_repo_path": "cypress/integration/app.spec.js", "max_stars_repo_name": "WTMCRobotics/wtmcrobotics-website", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "cypress/integration/app.spec.js", "max_issues_repo_name": "WTMCRobotics/wtmcrobotics-website", "max_issues_repo_issues_event_min_datetime": "2020-10-24T08:32:49.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-24T02:59:53.000Z", "max_forks_repo_path": "cypress/integration/app.spec.js", "max_forks_repo_name": "WTMCRobotics/wtmcrobotics-website", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 9, "max_forks_count": null, "avg_line_length": 23.7790697674, "max_line_length": 127, "alphanum_fraction": 0.4239608802}
/// <reference types="cypress" />

beforeEach(() => {
    cy.visit('http://localhost:5000/DNE')
})

describe('Header', () => {
    it('has a title', () => {
        cy.get('header').contains('WTMCRobotics')
            .should('have.attr', 'href', "/")
    })
})

describe('Nav', () => {
    const paths = [
        {
            name: 'home',
            path: '/'
        },
        {
            name: 'gallery',
            path: '/gallery'
        },
        {
            name: 'sponsor',
            path: '/sponsor'
        },
        {
            name: 'join',
            path: '/join'
        },
        {
            name: 'blog',
            path: '/blog'
        },
        {
            name: 'contact',
            path: '/contact'
        }
    ]
    const platforms = [{
        platform: 'mobile',
        screen: [400, 800]
    }, {
        platform: 'desktop',
        screen: [1600, 900]
    }]

    platforms.forEach(({ platform, screen }) => {
        it(`has correct nav links (${platform})`, () => {
            cy.viewport(...screen)
            if (screen[0] < 960) {
                cy.get('.v-app-bar__nav-icon').click()
            }
            paths.forEach(({ name, path }) => {
                cy.contains('a:visible', name, { matchCase: false })
                    .should('have.attr', 'href', path)
            })
        })
    })
})

describe('Footer', () => {
    it('has a copyright', () => {
        cy.get('footer').contains('©')
    })

    it('links to GitHub', () => {
        cy.get('footer').contains('GitHub').should('have.attr', 'href', 'https://github.com/WTMCRobotics/wtmcrobotics-website')
    })
})

describe('top button', () => {
    beforeEach(() => {
        cy.viewport(200, 200);
    })

    it('appears and goes to top', () => {
        cy.get('[aria-label="Scroll to top"]').should('not.be.visible')
        cy.scrollTo(0, '250px')
        cy.get('[aria-label="Scroll to top"]').should('be.visible')
            .click()
        cy.window().its('scrollY').should('eq', 0)
    })

})