Compare commits
3 commits
0faeb86ca7
...
4f8dce9c5e
| Author | SHA1 | Date | |
|---|---|---|---|
| 4f8dce9c5e | |||
| d5864ad526 | |||
| c9be1a5319 |
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">
|
<div class="site-header-inner">
|
||||||
<h1>Admin</h1>
|
<h1>Admin</h1>
|
||||||
<div class="cluster">
|
<div class="cluster">
|
||||||
|
<a class="btn btn-secondary" href="/home" id="home-link">
|
||||||
|
Home
|
||||||
|
</a>
|
||||||
<button id="logout" class="btn btn-danger">Logout</button>
|
<button id="logout" class="btn btn-danger">Logout</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,9 @@
|
||||||
<header class="site-header">
|
<header class="site-header">
|
||||||
<div class="site-header-inner">
|
<div class="site-header-inner">
|
||||||
<div class="cluster">
|
<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">
|
<a class="btn btn-secondary" href="/admin/texts" id="back">
|
||||||
Back to Texts
|
Back to Texts
|
||||||
</a>
|
</a>
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,9 @@
|
||||||
<div class="site-header-inner">
|
<div class="site-header-inner">
|
||||||
<h1>Texts</h1>
|
<h1>Texts</h1>
|
||||||
<div class="cluster">
|
<div class="cluster">
|
||||||
|
<a class="btn btn-secondary" href="/home" id="home-link">
|
||||||
|
Home
|
||||||
|
</a>
|
||||||
<a class="btn btn-secondary" href="/admin" id="back">
|
<a class="btn btn-secondary" href="/admin" id="back">
|
||||||
Back to Admin
|
Back to Admin
|
||||||
</a>
|
</a>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue