import { beEqualTo, beVisible, haveAttribute, haveFocus, haveText, html, notBeVisible, test } from '../../utils'
// Skipping these tests because the plugin has been moved to livewire/livewire until it's stablhese tests because the plugin has been moved to livewire/livewire until it's stable...
describe.skip('Navigate tests', function () {
it.skip('navigates pages without reload',
() => {
cy.intercept('/first', {
headers: { 'content-type': 'text/html' },
body: html`
Navigate
First Page
`})
cy.intercept('/second', {
headers: { 'content-type': 'text/html' },
body: html`
Second Page
`})
cy.visit('/first')
cy.window().its('fromFirstPage').should(beEqualTo(true))
cy.get('h2').should(haveText('First Page'))
cy.get('a').click()
cy.url().should('include', '/second')
cy.get('h2').should(haveText('Second Page'))
cy.window().its('fromFirstPage').should(beEqualTo(true))
},
)
it.skip('autofocuses autofocus elements',
() => {
cy.intercept('/first', {
headers: { 'content-type': 'text/html' },
body: html`
Navigate
`})
cy.intercept('/second', {
headers: { 'content-type': 'text/html' },
body: html`
`})
cy.visit('/first')
cy.get('a').click()
cy.url().should('include', '/second')
cy.get('input').should(haveFocus())
},
)
it.skip('scripts and styles are properly merged/run or skipped',
() => {
cy.intercept('/first', {
headers: { 'content-type': 'text/html' },
body: html`
First Page
Navigate
`})
cy.intercept('/head-script.js', {
headers: { 'content-type': 'text/js' },
body: `window.fromHeadScript = true`
})
cy.intercept('/body-script.js', {
headers: { 'content-type': 'text/js' },
body: `window.fromBodyScript = true`
})
cy.intercept('/head-style.css', {
headers: { 'content-type': 'text/css' },
body: `body { background: black !important; }`
})
cy.intercept('/second', {
headers: { 'content-type': 'text/html' },
body: html`
Second Page
`})
cy.visit('/first')
cy.get('a').click()
cy.url().should('include', '/second')
cy.title().should(beEqualTo('Second Page'))
cy.get('meta').should(haveAttribute('name', 'description'))
cy.get('meta').should(haveAttribute('content', 'second description'))
cy.window().its('fromHeadScript').should(beEqualTo(true))
cy.window().its('fromHeadScriptInline').should(beEqualTo(true))
cy.window().its('fromBodyScript').should(beEqualTo(true))
cy.window().its('fromBodyScriptInline').should(beEqualTo(true))
},
)
})