Merge branch 'admin-home-link'
This commit is contained in:
commit
4f8dce9c5e
4 changed files with 52 additions and 0 deletions
43
cypress/e2e/adminHomeLink.cy.js
Normal file
43
cypress/e2e/adminHomeLink.cy.js
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
describe('The admin home link', () => {
|
||||
beforeEach(() => {
|
||||
cy.exec('npm run db:seed')
|
||||
cy.loginAsAdmin()
|
||||
})
|
||||
afterEach(() => {
|
||||
cy.exec('npm run db:wipe')
|
||||
})
|
||||
|
||||
it('shows the home link on the admin page', () => {
|
||||
cy.visit('/admin')
|
||||
cy.get('#home-link')
|
||||
.should('be.visible')
|
||||
.and('have.attr', 'href', '/home')
|
||||
.and('contain', 'Home')
|
||||
})
|
||||
|
||||
it('shows the home link on the admin texts page', () => {
|
||||
cy.visit('/admin/texts')
|
||||
cy.get('#home-link')
|
||||
.should('be.visible')
|
||||
.and('have.attr', 'href', '/home')
|
||||
.and('contain', 'Home')
|
||||
})
|
||||
|
||||
it('shows the home link on an admin text page', () => {
|
||||
cy.visit('/admin/texts')
|
||||
cy.get('#newTextName').type('Home Link Text')
|
||||
cy.get('#submit').click()
|
||||
cy.get('a').contains('Home Link Text').click()
|
||||
cy.get('#home-link')
|
||||
.should('be.visible')
|
||||
.and('have.attr', 'href', '/home')
|
||||
.and('contain', 'Home')
|
||||
})
|
||||
|
||||
it('navigates to the home page when clicked', () => {
|
||||
cy.visit('/admin')
|
||||
cy.get('#home-link').click()
|
||||
cy.url().should('include', '/home')
|
||||
cy.get('h1').should('contain', 'Home')
|
||||
})
|
||||
})
|
||||
|
|
@ -11,6 +11,9 @@
|
|||
<div class="site-header-inner">
|
||||
<h1>Admin</h1>
|
||||
<div class="cluster">
|
||||
<a class="btn btn-secondary" href="/home" id="home-link">
|
||||
Home
|
||||
</a>
|
||||
<button id="logout" class="btn btn-danger">Logout</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -10,6 +10,9 @@
|
|||
<header class="site-header">
|
||||
<div class="site-header-inner">
|
||||
<div class="cluster">
|
||||
<a class="btn btn-secondary" href="/home" id="home-link">
|
||||
Home
|
||||
</a>
|
||||
<a class="btn btn-secondary" href="/admin/texts" id="back">
|
||||
Back to Texts
|
||||
</a>
|
||||
|
|
|
|||
|
|
@ -11,6 +11,9 @@
|
|||
<div class="site-header-inner">
|
||||
<h1>Texts</h1>
|
||||
<div class="cluster">
|
||||
<a class="btn btn-secondary" href="/home" id="home-link">
|
||||
Home
|
||||
</a>
|
||||
<a class="btn btn-secondary" href="/admin" id="back">
|
||||
Back to Admin
|
||||
</a>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue