-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
They might prove useful in the coming migrations. Or unmaintainable. We'll see.
- Loading branch information
Showing
12 changed files
with
2,310 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { defineConfig } from 'cypress' | ||
|
||
export default defineConfig({ | ||
e2e: { | ||
baseUrl: 'http://127.0.0.1:1607' | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module.exports = { | ||
env: { | ||
mocha: true | ||
}, | ||
|
||
extends: [ | ||
'plugin:cypress/recommended' | ||
], | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
describe('Home page', () => { | ||
it('Show the home page', () => { | ||
cy.visit('/') | ||
cy.assertTitle('Home') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
describe('Series', () => { | ||
it('Create a series', () => { | ||
// Create the series | ||
cy.visit('/series/new') | ||
cy.getInputByLabel('Name').type('Sample series') | ||
cy.get('button[type="submit"]').click() | ||
|
||
// Ensure the page was reloaded | ||
cy.url().should('match', /series\/\d+\/view/) | ||
// Ensure that the encoded data is correct | ||
cy.assertTitle('Sample series') | ||
cy.contains('This series is ongoing').should('exist') | ||
}) | ||
|
||
it('Deletes an empty series', () => { | ||
cy.visit('/series/2/view') | ||
cy.openQuickTasks() | ||
cy.contains('Delete this series').click() | ||
cy.get('.v-dialog .v-btn.accent').click() | ||
cy.url().should('match', /series$/) | ||
cy.contains('Empty series').should('not.exist') | ||
}) | ||
|
||
// TODO: https://github.com/The4thLaw/demyo/issues/93 | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
describe('Albums', () => { | ||
// See https://github.com/The4thLaw/demyo/issues/6 | ||
it('Show 0-numbered albums', () => { | ||
cy.visit('/albums/2/view') | ||
cy.contains('0 - Album with number 0').should('exist') | ||
}) | ||
|
||
// See https://github.com/The4thLaw/demyo/issues/16 | ||
it('Show authors when there is only an inker', () => { | ||
cy.visit('/albums/3/view') | ||
cy.contains('Sample Inker').should('exist') | ||
}) | ||
|
||
// See https://github.com/The4thLaw/demyo/issues/16 | ||
it('Show authors when there is only a translator', () => { | ||
cy.visit('/albums/4/view') | ||
cy.contains('Sample Translator').should('exist') | ||
}) | ||
|
||
// See https://github.com/The4thLaw/demyo/issues/77 | ||
it('Show an error message when creating without a publisher', () => { | ||
cy.visit('/albums/new') | ||
cy.get('.v-btn.accent').click() | ||
cy.contains('Publisher').parents('.v-input').contains('This field cannot be empty') | ||
}) | ||
|
||
// See https://github.com/The4thLaw/demyo/issues/88 | ||
it('Prevents deletion of an album with a derivative', () => { | ||
cy.visit('/albums/1/view') | ||
cy.openQuickTasks() | ||
cy.contains('Delete this album').should('not.exist') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
describe('Authors', () => { | ||
it('Create an author', () => { | ||
// Create the author | ||
cy.visit('/authors/new') | ||
cy.getInputByLabel('First name').type('John') | ||
cy.getInputByLabel('Name').type('Doe') | ||
cy.get('button[type="submit"]').click() | ||
|
||
// Ensure the page was reloaded | ||
cy.url().should('match', /authors\/\d+\/view/) | ||
// Ensure that the encoded data is correct | ||
cy.assertTitle('John Doe') | ||
cy.contains('You have no albums by this author').should('exist') | ||
cy.contains('You have no derivatives by this author').should('exist') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
describe('Tags', () => { | ||
it('List the tags', () => { | ||
cy.visit('/tags') | ||
// Tags should be listed without error | ||
cy.get('.d-Tag').should('have.length', 1) | ||
// The SF tag should have one occurrence | ||
cy.contains('science-fiction').find('.d-Tag__count').should('have.text', '1') | ||
}) | ||
}) |
Binary file added
BIN
+3.96 KB
source/demyo-vue-frontend/cypress/fixtures/demyo-cypress-data-set.dea
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
Cypress.Commands.add('initDatabase', () => { | ||
return cy.fixture('demyo-cypress-data-set.dea', 'binary') | ||
.then(binary => Cypress.Blob.binaryStringToBlob(binary)) | ||
.then(blob => { | ||
var formdata = new FormData() | ||
formdata.append('importFile', blob, 'demyo-cypress.dea') | ||
|
||
cy.request({ | ||
url: '/api/manage/import', | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'multipart/form-data' | ||
}, | ||
body: formdata | ||
}).its('status').should('be.equal', 200) | ||
}) | ||
}) | ||
|
||
Cypress.Commands.add('selectReader', () => { | ||
return cy.request({ | ||
method: 'GET', | ||
url: '/api/readers/1' | ||
}) | ||
.then(resp => { | ||
console.log('Cypress reader is', resp.body) | ||
window.localStorage.setItem('currentReader', JSON.stringify(resp.body)) | ||
}) | ||
}) | ||
|
||
Cypress.Commands.add('getInputByLabel', (label) => { | ||
return cy.contains(label).parents('.v-input').find('input') | ||
}) | ||
|
||
Cypress.Commands.add('openQuickTasks', () => { | ||
cy.get('.v-app-bar i.mdi-dots-vertical').click() | ||
}) | ||
|
||
Cypress.Commands.add('assertTitle', (title) => { | ||
cy.title().should('include', title) | ||
cy.get('.v-toolbar__title').should('have.text', title) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// This file is processed and oaded automatically before all test files. | ||
// | ||
// This is a great place to put global configuration and behavior that modifies Cypress. | ||
|
||
import './commands' | ||
|
||
before(() => { | ||
cy.initDatabase().then(() => { | ||
cy.selectReader() | ||
}) | ||
}) | ||
|
||
// TODO: https://github.com/The4thLaw/demyo/issues/20 |
Oops, something went wrong.