-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
68165f4
commit 3378314
Showing
21 changed files
with
1,266 additions
and
190 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
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 |
---|---|---|
|
@@ -37,7 +37,7 @@ describe('From a fixed app', () => { | |
cy.dataCy('input-title') | ||
.type('A') | ||
cy.visit('/authors') | ||
cy.dataCy('btn-add-author') | ||
cy.dataCy('btn-add-person') | ||
.click() | ||
cy.visit('/finish') | ||
}) | ||
|
@@ -74,20 +74,20 @@ describe('From a fixed app', () => { | |
cy.checkThatAppValidityIs(false) | ||
cy.dataCy('banner-error-messages') | ||
.should('contain.text', 'Add at least one author') | ||
cy.dataCy('btn-add-author') | ||
cy.dataCy('btn-add-person') | ||
.click() | ||
cy.checkThatAppValidityIs(true) | ||
}) | ||
it('should validate duplicate authors', () => { | ||
cy.dataCy('btn-remove') | ||
.click() | ||
cy.dataCy('btn-add-author') | ||
cy.dataCy('btn-add-person') | ||
.click() | ||
cy.dataCy('input-given-names') | ||
.type('A') | ||
cy.dataCy('btn-done') | ||
.click() | ||
cy.dataCy('btn-add-author') | ||
cy.dataCy('btn-add-person') | ||
.click() | ||
cy.dataCy('input-given-names') | ||
.type('A') | ||
|
@@ -104,10 +104,34 @@ describe('From a fixed app', () => { | |
.click() | ||
cy.checkThatAppValidityIs(true) | ||
}) | ||
it('should validate authors\' fields', () => { | ||
it('should validate person and entity being equal', () => { | ||
cy.dataCy('input-email') | ||
.type('[email protected]') | ||
cy.dataCy('input-orcid') | ||
.type('1234123412341234') | ||
cy.dataCy('btn-done') | ||
.click() | ||
cy.dataCy('btn-add-entity') | ||
.click() | ||
cy.dataCy('input-email') | ||
.type('[email protected]') | ||
cy.dataCy('input-orcid') | ||
.type('1234123412341234') | ||
cy.dataCy('btn-done') | ||
.click() | ||
|
||
cy.dataCy('card-author0') | ||
.should('have.class', 'red-border') | ||
cy.dataCy('card-author1') | ||
.should('have.class', 'red-border') | ||
cy.checkThatAppValidityIs(false) | ||
cy.dataCy('banner-error-messages') | ||
.should('contain.text', 'There are duplicate authors') | ||
}) | ||
it('should validate person\'s fields', () => { | ||
cy.dataCy('btn-remove') | ||
.click() | ||
cy.dataCy('btn-add-author') | ||
cy.dataCy('btn-add-person') | ||
.click() | ||
cy.dataCy('input-email') | ||
.type('a') | ||
|
@@ -128,6 +152,65 @@ describe('From a fixed app', () => { | |
.should('not.have.class', 'q-field--error') | ||
cy.checkThatAppValidityIs(true) | ||
}) | ||
it('should validate entity\'s fields', () => { | ||
cy.dataCy('btn-remove') | ||
.click() | ||
cy.dataCy('btn-add-entity') | ||
.click() | ||
cy.dataCy('input-name') | ||
.type('Entity name') | ||
|
||
const fields = [ | ||
{ name: 'date-start', bad: '2021-01-0', fix: '1', checkInput: false }, | ||
{ name: 'date-end', bad: '2021-01-0', fix: '1', checkInput: false }, | ||
{ name: 'email', bad: 'a', fix: '@a.com', checkInput: true }, | ||
{ name: 'orcid', bad: '1', fix: '234123412341234', checkInput: true } | ||
] | ||
for (const field of fields) { | ||
cy.dataCy(`input-${field.name}`) | ||
.type(field.bad) | ||
cy.checkThatInputValidityIs(false, field.name) | ||
cy.checkThatAppValidityIs(false) | ||
cy.dataCy(`input-${field.name}`) | ||
.type(field.fix) | ||
if (field.checkInput) { | ||
cy.checkThatInputValidityIs(true, field.name) | ||
} else { | ||
cy.dataCy(`input-${field.name}`) | ||
.parents('.q-field') | ||
.should('not.have.class', 'q-field--error') | ||
} | ||
cy.checkThatAppValidityIs(true) | ||
} | ||
}) | ||
it('should error when it is inferrable that it is an entity without name', () => { | ||
cy.dataCy('btn-remove') | ||
.click() | ||
cy.dataCy('btn-add-entity') | ||
.click() | ||
|
||
const fields = [ | ||
{ name: 'date-start', value: '2021-01-01' }, | ||
{ name: 'date-end', value: '2021-01-01' }, | ||
{ name: 'location', value: 'Here' } | ||
] | ||
for (const field of fields) { | ||
cy.dataCy(`input-${field.name}`) | ||
.type(field.value) | ||
|
||
cy.checkThatInputValidityIs(false, 'name') | ||
cy.checkThatAppValidityIs(false) | ||
cy.dataCy('input-name') | ||
.type('Fixed') | ||
cy.checkThatInputValidityIs(true, 'name') | ||
cy.checkThatAppValidityIs(true) | ||
|
||
cy.dataCy('input-name') | ||
.clear() | ||
cy.dataCy(`input-${field.name}`) | ||
.clear() | ||
} | ||
}) | ||
}) | ||
|
||
describe('On screen Identifiers', () => { | ||
|
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
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
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 |
---|---|---|
|
@@ -20,6 +20,22 @@ const fullValidCff = { | |
email: '[email protected]', | ||
affiliation: 'UU', | ||
orcid: 'https://orcid.org/1234-1234-1234-123X' | ||
}, { | ||
address: 'Some street', | ||
alias: 'NLeSC', | ||
city: 'Amsterdam', | ||
country: 'NL', | ||
'date-end': '2022-01-01', | ||
'date-start': '2021-01-01', | ||
email: '[email protected]', | ||
fax: '+31 02 1234 1234', | ||
location: 'Science Park', | ||
name: 'Netherlands eScience Center', | ||
orcid: 'https://orcid.org/1234-1234-1234-1234', | ||
'post-code': '1234AM', | ||
region: 'Oost', | ||
tel: '+31 02 1234 5678', | ||
website: 'https://nlesc.org' | ||
}], | ||
identifiers: [ | ||
{ type: 'doi', value: '10.1234/x', description: 'Some DOI' }, | ||
|
@@ -43,6 +59,8 @@ const fullValidCff = { | |
type: 'article' | ||
} | ||
} | ||
const downloadsFolder = Cypress.config('downloadsFolder') | ||
const cfffile = `${downloadsFolder}/CITATION.cff` | ||
|
||
describe('Basic usage', () => { | ||
it('is working for the minimum information', () => { | ||
|
@@ -68,7 +86,7 @@ describe('Basic usage', () => { | |
|
||
// Author screen | ||
cy.url().should('include', '/authors') | ||
cy.dataCy('btn-add-author') | ||
cy.dataCy('btn-add-person') | ||
.click() | ||
cy.dataCy('btn-done') | ||
.click() | ||
|
@@ -110,7 +128,7 @@ describe('Basic usage', () => { | |
|
||
// Author screen | ||
cy.url().should('include', '/authors') | ||
cy.dataCy('btn-add-author') | ||
cy.dataCy('btn-add-person') | ||
.click() | ||
cy.dataCy('input-given-names') | ||
.type('John') | ||
|
@@ -128,6 +146,44 @@ describe('Basic usage', () => { | |
.type('123412341234123X') | ||
cy.dataCy('btn-done') | ||
.click() | ||
cy.dataCy('btn-add-entity') | ||
.click() | ||
cy.dataCy('input-name') | ||
.type('Netherlands eScience Center') | ||
cy.dataCy('input-address') | ||
.type('Some street') | ||
cy.dataCy('input-city') | ||
.type('Amsterdam') | ||
|
||
cy.dataCy('select-country') | ||
.first() | ||
.type('NL') | ||
.click() | ||
.get('.q-item__label') | ||
.eq(0) | ||
.click() | ||
cy.dataCy('input-post-code') | ||
.type('1234AM') | ||
cy.dataCy('input-location') | ||
.type('Science Park') | ||
cy.dataCy('input-region') | ||
.type('Oost') | ||
cy.dataCy('input-alias') | ||
.type('NLeSC') | ||
cy.dataCy('input-email') | ||
.type('[email protected]') | ||
cy.dataCy('input-date-start') | ||
.type('2021-01-01') | ||
cy.dataCy('input-date-end') | ||
.type('2022-01-01') | ||
cy.dataCy('input-tel') | ||
.type('+31 02 1234 5678') | ||
cy.dataCy('input-fax') | ||
.type('+31 02 1234 1234') | ||
cy.dataCy('input-website') | ||
.type('https://nlesc.org') | ||
cy.dataCy('input-orcid') | ||
.type('1234123412341234') | ||
cy.dataCy('btn-next') | ||
.click() | ||
|
||
|
@@ -242,9 +298,6 @@ describe('Basic usage', () => { | |
cy.dataCy('btn-download') | ||
.click() | ||
|
||
const downloadsFolder = Cypress.config('downloadsFolder') | ||
const cfffile = `${downloadsFolder}/CITATION.cff` | ||
|
||
cy.readFile(cfffile, 'binary', { timeout: 400 }) | ||
.then((str) => { | ||
expect(yaml.load(str)).to.deep.equal(fullValidCff) | ||
|
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
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
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 |
---|---|---|
|
@@ -10,6 +10,21 @@ authors: | |
email: [email protected] | ||
affiliation: UU | ||
orcid: 'https://orcid.org/1234-1234-1234-123X' | ||
- address: Some street | ||
alias: NLeSC | ||
city: Amsterdam | ||
country: NL | ||
date-end: '2022-01-01' | ||
date-start: '2021-01-01' | ||
email: [email protected] | ||
fax: +31 02 1234 1234 | ||
location: Science Park | ||
name: Netherlands eScience Center | ||
orcid: 'https://orcid.org/1234-1234-1234-1234' | ||
post-code: 1234AM | ||
region: Oost | ||
tel: +31 02 1234 5678 | ||
website: 'https://nlesc.org' | ||
identifiers: | ||
- type: doi | ||
value: 10.1234/x | ||
|
@@ -37,8 +52,8 @@ commit: '123' | |
version: v1.2.3 | ||
date-released: '2022-01-01' | ||
preferred-citation: | ||
- authors: | ||
- given-names: John | ||
family-names: Doe | ||
title: My Paper | ||
type: article | ||
authors: | ||
- given-names: John | ||
family-names: Doe | ||
title: My Paper | ||
type: article |
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 |
---|---|---|
@@ -1 +1 @@ | ||
Property 'family-name: Doe' inside 'authors' was ignored. Check if the key is correct. | ||
Could not add author. It is not a Person due to fields name and not an Entity due to fields given-names. Skipping |
Oops, something went wrong.