diff --git a/cypress/fixtures/submission_form_data.json b/cypress/fixtures/submission_form_data.json index d4ae6f771dfc12b23dca778c02997be5b0b04509..6d310f547f441d847d230a1119d3ff963216e262 100644 --- a/cypress/fixtures/submission_form_data.json +++ b/cypress/fixtures/submission_form_data.json @@ -21,5 +21,9 @@ "text1": "SPM", "text2": "FSL" }, - "newTitle": "My Fixed URL Submission" + "newTitle": "My Fixed URL Submission", + "articleId": "123", + "description": "This is my description", + "evaluationContent": "This is my evaluation content", + "evaluationType": "Peer Review" } \ No newline at end of file diff --git a/cypress/integration/elife/manuscripts_page_spec.js b/cypress/integration/elife/manuscripts_page_spec.js index 23bd7cbd49e0ecc48be023b01fa021c3004223ba..e9ec04d5f3a72c5f91693c73832136b24a94eb52 100644 --- a/cypress/integration/elife/manuscripts_page_spec.js +++ b/cypress/integration/elife/manuscripts_page_spec.js @@ -1,46 +1,114 @@ import { ManuscriptsPage } from '../../page-object/manuscripts-page' -import { Menu } from '../../page-object/page-component/menu' import { NewSubmissionPage } from '../../page-object/new-submission-page' import { SubmissionFormPage } from '../../page-object/submission-form-page' -import { dashboard } from '../../support/routes' +import { manuscripts } from '../../support/routes' describe('Manuscripts page tests', () => { - beforeEach(() => { - // task to restore the database as per the dumps/initialState.sql - cy.task('restore', 'initialState') + context('Elements visibility', () => { + beforeEach(() => { + // task to restore the database as per the dumps/initialState.sql + cy.task('restore', 'initialState') - // login as admin - cy.fixture('role_names').then(name => { - cy.login(name.role.admin, dashboard) + // login as admin + // eslint-disable-next-line jest/valid-expect-in-promise + cy.fixture('role_names').then(name => { + cy.login(name.role.admin, manuscripts) + }) }) - Menu.clickManuscripts() - }) - it('check Submit button is visible', () => { - ManuscriptsPage.getSubmitButton().should('be.visible') + it('check Submit button is visible', () => { + ManuscriptsPage.getSubmitButton().should('be.visible') + }) }) - it('After submit an article user is redirect to Manuscripts page', () => { - ManuscriptsPage.getEvaluationButton().should('not.exist') - ManuscriptsPage.clickSubmit() + context('', () => { + beforeEach(() => { + // task to restore the database as per the dumps/initialState.sql + cy.task('restore', 'initialState') - NewSubmissionPage.clickSubmitURL() + // login as admin + // eslint-disable-next-line jest/valid-expect-in-promise + cy.fixture('role_names').then(name => { + cy.login(name.role.admin, manuscripts) - // fill the submit form and submit it - return cy.fixture('form_option').then(data => { - SubmissionFormPage.fillInArticleld(data.field1) - SubmissionFormPage.fillInArticleUrl(data.field2) - SubmissionFormPage.fillInDescription(data.field3) - SubmissionFormPage.fillInEvaluationContent(data.field4) - SubmissionFormPage.clickElementFromFormOptionList(4) - SubmissionFormPage.selectDropdownOption(1) - SubmissionFormPage.clickSubmitResearch() - SubmissionFormPage.clickSubmitManuscript() + ManuscriptsPage.getEvaluationButton().should('not.exist') + ManuscriptsPage.clickSubmit() + NewSubmissionPage.clickSubmitURL() + + // fill the submit form and submit it + // eslint-disable-next-line jest/valid-expect-in-promise + cy.fixture('submission_form_data').then(data => { + SubmissionFormPage.fillInArticleld(data.articleId) + SubmissionFormPage.fillInArticleUrl(data.doi) + SubmissionFormPage.fillInDescription(data.description) + SubmissionFormPage.fillInEvaluationContent(data.evaluationContent) + SubmissionFormPage.clickElementFromFormOptionList(4) + SubmissionFormPage.selectDropdownOption(1) + SubmissionFormPage.fillInCreator(name.role.admin) + SubmissionFormPage.clickSubmitResearch() + SubmissionFormPage.clickSubmitManuscript() + }) + }) + }) + it('after submitting an article, user is redirect to Manuscripts page', () => { // asserts on the manuscripts page ManuscriptsPage.getManuscriptsPageTitle().should('be.visible') ManuscriptsPage.getEvaluationButton().should('be.visible') ManuscriptsPage.getControlButton().should('not.exist') }) + it('evaluate article and check status is changed', () => { + ManuscriptsPage.getStatus(0).should('eq', 'Submitted') + ManuscriptsPage.clickEvaluation(0) + SubmissionFormPage.clickSubmitResearch() + ManuscriptsPage.getStatus(0).should('eq', 'evaluated') + ManuscriptsPage.getEvaluationButton().should('be.visible') + }) + it('submission details should be visible', () => { + ManuscriptsPage.getStatus(0).should('eq', 'Submitted') + ManuscriptsPage.clickEvaluation(0) + // eslint-disable-next-line jest/valid-expect-in-promise + cy.fixture('submission_form_data').then(data => { + SubmissionFormPage.getArticleld().should('have.value', data.articleId) + SubmissionFormPage.getArticleUrl().should('have.value', data.doi) + // eslint-disable-next-line + SubmissionFormPage.getDescription().should('have.value', data.description) + SubmissionFormPage.getEvaluationContent() + .find('p') + .should('contain', data.evaluationContent) + // eslint-disable-next-line + SubmissionFormPage.getFormOptionValue(-1).should('contain', data.evaluationType) + }) + }) + it('evaluation changes should be visible', () => { + // eslint-disable-next-line jest/valid-expect-in-promise + cy.fixture('submission_form_data').then(data => { + // eslint-disable-next-line jest/valid-expect-in-promise + cy.fixture('role_names').then(name => { + ManuscriptsPage.getAuthor(0).should('eq', name.role.admin) + ManuscriptsPage.getStatus(0).should('eq', 'Submitted') + }) + ManuscriptsPage.clickEvaluation(0) + SubmissionFormPage.fillInArticleld('123 - Evaluated') + SubmissionFormPage.fillInArticleUrl('new url') + SubmissionFormPage.fillInDescription('new description') + SubmissionFormPage.fillInEvaluationContent('new content') + SubmissionFormPage.clickElementFromFormOptionList(4) + SubmissionFormPage.selectDropdownOption(-1) + SubmissionFormPage.fillInCreator('creator') + SubmissionFormPage.clickSubmitResearch() + ManuscriptsPage.clickEvaluation() + // eslint-disable-next-line + SubmissionFormPage.getArticleld().should('not.have.value', data.articleId) + SubmissionFormPage.getArticleUrl().should('not.have.value', data.doi) + // eslint-disable-next-line + SubmissionFormPage.getDescription().should('not.have.value', data.description) + SubmissionFormPage.getEvaluationContent() + .find('p') + .should('not.contain', data.evaluationContent) + // eslint-disable-next-line + SubmissionFormPage.getFormOptionValue(-1).should('not.contain', data.evaluationType) + }) + }) }) }) diff --git a/cypress/page-object/manuscripts-page.js b/cypress/page-object/manuscripts-page.js index 21ffbd2efd18267836eac0c548cc09589e9b0abd..c3f1e10f7f0937f4d6e65c9459ea36f66502b16a 100644 --- a/cypress/page-object/manuscripts-page.js +++ b/cypress/page-object/manuscripts-page.js @@ -10,6 +10,8 @@ const MANUSCRIPTS_PAGE_TITLE = '[class*=General__Heading-sc]' const EVALUATION_BUTTON = '[href*=evaluation]' const CONTROL_BUTTON = '[href*=control]' const CREATED_CARET = 'Carets__Caret' +const AUTHOR_FIELD = 'UserCombo__Primary' +const STATUS_FIELD = 'Badge__Status' export const ManuscriptsPage = { getManuscriptsOptionsList() { @@ -39,5 +41,17 @@ export const ManuscriptsPage = { getCreatedCaret(nth) { return cy.getByContainsClass(CREATED_CARET).eq(nth) }, + getAuthorField(nth) { + return cy.getByContainsClass(AUTHOR_FIELD).eq(nth) + }, + getAuthor(nth) { + return this.getAuthorField(nth).invoke('text') + }, + getStatusField(nth) { + return cy.getByContainsClass(STATUS_FIELD).eq(nth) + }, + getStatus(nth) { + return this.getStatusField(nth).invoke('text') + }, } export default ManuscriptsPage diff --git a/cypress/page-object/submission-form-page.js b/cypress/page-object/submission-form-page.js index a40386d9aacc0618819c769af93182ac53f12660..81cc5c75e9112ae6081f22282d9b33fc69acc470 100644 --- a/cypress/page-object/submission-form-page.js +++ b/cypress/page-object/submission-form-page.js @@ -5,239 +5,252 @@ * It contains various input fields & dropdowns, * listed in the same order they appear on the page. */ -const ADD_A_LINK_BUTTON = 'li > button'; -const ENTER_URL_FIELD = 'submission.links.'; -const TITLE_FIELD = 'meta.title'; -const NAME_FIELD = 'submission.name'; -const AFFILIATION_FIELD = 'submission.affiliation'; -const CONTACT_FIELD = 'submission.contact'; -const COVER_FIELD = 'submission.cover'; -const DATA_CODE_FIELD = 'submission.datacode'; -const ETHICS_FIELD = 'submission.ethics'; -const TYPE_OF_RESEARCH_DROPDOWN = 'Type of Research Object'; -const DROPDOWN_OPTION_LIST = '[class*=MenuList] > [id*=option]'; -const SUGGESTED_FIELD = 'submission.suggested'; -const FILE_DROPZONE = 'dropzone'; -const KEYWORDS_FIELD = 'submission.keywords'; -const HEALTHY_SUBJECTS_STUDY_DROPDOWN = 'healthy subjects only or patients'; -const INVOLVED_HUMAN_SUBJECTS_DROPDOWN = 'involved human subjects'; -const ANIMAL_RESEARCH_APPROVED_DROPDOWN = 'animal research approved'; -const METHODS_USED_CHECKBOX = 'submission.methods'; -const OTHER_METHODS_FIELD = 'submission.otherMethods'; -const FILED_STRENGTH_DROPDOWN = 'what field strength'; -const HUMAN_MRI_OTHER_FIELD = 'submission.humanMRIother'; -const PROCESSING_PACKAGES_CHECKBOX_LIST = 'submission.packages'; -const OTHER_PACKAGES_FIELD = 'submission.otherPackages'; -const REFERENCES_FIELD = 'submission.references'; -const SUBMIT_RESEARCH_BUTTON = 'form > div > button'; -const SUBMIT_MANUSCRIPT_BUTTON = 'button[type=submit]'; -const VALIDATION_ERROR_MESSAGE = 'ValidatedField__MessageWrapper'; -const CONTENT_ETIDABLE_VALUE = '[contenteditable="true"]'; +const ADD_A_LINK_BUTTON = 'li > button' +const ENTER_URL_FIELD = 'submission.links.' +const TITLE_FIELD = 'meta.title' +const NAME_FIELD = 'submission.name' +const AFFILIATION_FIELD = 'submission.affiliation' +const CONTACT_FIELD = 'submission.contact' +const COVER_FIELD = 'submission.cover' +const DATA_CODE_FIELD = 'submission.datacode' +const ETHICS_FIELD = 'submission.ethics' +const TYPE_OF_RESEARCH_DROPDOWN = 'Type of Research Object' +const DROPDOWN_OPTION_LIST = '[class*=MenuList] > [id*=option]' +const SUGGESTED_FIELD = 'submission.suggested' +const FILE_DROPZONE = 'dropzone' +const KEYWORDS_FIELD = 'submission.keywords' +const HEALTHY_SUBJECTS_STUDY_DROPDOWN = 'healthy subjects only or patients' +const INVOLVED_HUMAN_SUBJECTS_DROPDOWN = 'involved human subjects' +const ANIMAL_RESEARCH_APPROVED_DROPDOWN = 'animal research approved' +const METHODS_USED_CHECKBOX = 'submission.methods' +const OTHER_METHODS_FIELD = 'submission.otherMethods' +const FILED_STRENGTH_DROPDOWN = 'what field strength' +const HUMAN_MRI_OTHER_FIELD = 'submission.humanMRIother' +const PROCESSING_PACKAGES_CHECKBOX_LIST = 'submission.packages' +const OTHER_PACKAGES_FIELD = 'submission.otherPackages' +const REFERENCES_FIELD = 'submission.references' +const SUBMIT_RESEARCH_BUTTON = 'form > div > button' +const SUBMIT_MANUSCRIPT_BUTTON = 'button[type=submit]' +const VALIDATION_ERROR_MESSAGE = 'ValidatedField__MessageWrapper' +const CONTENT_ETIDABLE_VALUE = '[contenteditable="true"]' -const FORM_OPTION_LIST = '[class*=style__Section]'; -const ARTICLE_ID = 'submission.articleId'; -const ARTICLE_URL = 'submission.articleURL'; -const DESCRIPTION = 'submission.description'; -const EVALUATION_CONTENT = 'submission.evaluationContent'; +const FORM_OPTION_LIST = '[class*=style__Section]' +const FORM_OPTION_VALUE = 'singleValue' +const ARTICLE_ID_FIELD = 'submission.articleId' +const ARTICLE_URL_FIELD = 'submission.articleURL' +const DESCRIPTION_FIELD = 'submission.description' +const EVALUATION_CONTENT_FIELD = 'submission.evaluationContent' +const CREATOR_FIELD = 'submission.creator' export const SubmissionFormPage = { - getAddLinkButton() { - return cy.get(ADD_A_LINK_BUTTON); - }, - clickAddLink() { - this.getAddLinkButton().click(); - }, - getEnterUrlField(nth) { - return cy.getByContainsName(ENTER_URL_FIELD).eq(nth); - }, - fillInUrl(nth, url) { - this.getEnterUrlField(nth).fillInput(url); - }, - getTitleField() { - return cy.getByDataTestId(TITLE_FIELD); - }, - fillInTitle(title) { - this.getTitleField().fillInput(title); - }, - getNameField() { - return cy.getByDataTestId(NAME_FIELD); - }, - fillInName(name) { - this.getNameField().fillInput(name); - }, - getAffiliationField() { - return cy.getByDataTestId(AFFILIATION_FIELD); - }, - fillInAffiliation(affiliation) { - this.getAffiliationField().fillInput(affiliation); - }, - getContactField() { - return cy.getByDataTestId(CONTACT_FIELD); - }, - fillInContact(contact) { - this.getContactField().fillInput(contact); - }, - getCoverField() { - return cy.getByDataTestId(COVER_FIELD); - }, - fillInCover(cover) { - this.getCoverField().find(CONTENT_ETIDABLE_VALUE).fillInput(cover); - }, - getDataCodeField() { - return cy.getByDataTestId(DATA_CODE_FIELD); - }, - fillInDataCode(dataCode) { - this.getDataCodeField().find(CONTENT_ETIDABLE_VALUE).fillInput(dataCode); - }, - getEthicsField() { - return cy.getByDataTestId(ETHICS_FIELD); - }, - fillInEthicsField(ethics) { - this.getEthicsField().find(CONTENT_ETIDABLE_VALUE).fillInput(ethics); - }, - getTypeOfResearchDropdown() { - return cy.getByContainsAreaLabel(TYPE_OF_RESEARCH_DROPDOWN); - }, - clickTypeOfResearchDropdown() { - this.getTypeOfResearchDropdown().click({ force: true }); - }, - selectDropdownOption(nth) { - return cy.get(DROPDOWN_OPTION_LIST).eq(nth).click(); - }, - getSuggestedField() { - return cy.getByDataTestId(SUGGESTED_FIELD); - }, - fillInSuggested(suggested) { - this.getSuggestedField().fillInput(suggested); - }, - getFileDropzone() { - return cy.getByDataTestId(FILE_DROPZONE); - }, - attachFile(file) { - this.getFileDropzone().attachFile(file, - // { - // fileContent, - // fileName: 'test-pdf.pdf', - // encoding: 'base64', - // mimeType: 'application/pdf', - // }, - { subjectType: 'drag-n-drop' }) - }, - getKeywordsField() { - return cy.getByDataTestId(KEYWORDS_FIELD); - }, - fillInKeywords(keywords) { - this.getKeywordsField().fillInput(keywords); - }, - getHealthySubjectsStudyDropdown() { - return cy.getByContainsAreaLabel(HEALTHY_SUBJECTS_STUDY_DROPDOWN); - }, - clickHealthySubjectsStudyDropdown() { - this.getHealthySubjectsStudyDropdown().click({ force: true }); - }, - getInvolvedHumanSubjectsDropdown() { - return cy.getByContainsAreaLabel(INVOLVED_HUMAN_SUBJECTS_DROPDOWN); - }, - clickInvolvedHumanSubjectsDropdown() { - this.getInvolvedHumanSubjectsDropdown().click({ force: true }); - }, - getAnimalResearchApprovedDropdown() { - return cy.getByContainsAreaLabel(ANIMAL_RESEARCH_APPROVED_DROPDOWN); - }, - clickAnimalResearchApprovedDropdown() { - this.getAnimalResearchApprovedDropdown().click({ force: true }); - }, - getMethodsUsedCheckboxWithText(value) { - return cy.getByNameAndValue(METHODS_USED_CHECKBOX, value); - }, - clickMethodsUsedCheckboxWithText(value) { - this.getMethodsUsedCheckboxWithText(value).click(); - }, - getOtherMethodsField() { - return cy.getByDataTestId(OTHER_METHODS_FIELD); - }, - fillInOtherMethods(text) { - this.getOtherMethodsField().fillInput(text); - }, - getFieldSthrenghtDropdown() { - return cy.getByContainsAreaLabel(FILED_STRENGTH_DROPDOWN); - }, - clickFieldSthrenghtDropdown() { - this.getFieldSthrenghtDropdown().click({ force: true }); - }, - getHumanMriOtherField() { - return cy.getByDataTestId(HUMAN_MRI_OTHER_FIELD); - }, - fillInHumanMriOther(other) { - this.getHumanMriOtherField().fillInput(other); - }, - getProcessingPackagesCheckboxWithText(text) { - return cy.getByNameAndValue(PROCESSING_PACKAGES_CHECKBOX_LIST, text); - }, - clickProcessingPackageWithText(text) { - this.getProcessingPackagesCheckboxWithText(text).click(); - }, - getOtherPackagesField() { - return cy.getByDataTestId(OTHER_PACKAGES_FIELD); - }, - fillInOtherPackages(otherPackages) { - this.getOtherPackagesField().fillInput(otherPackages); - }, - getReferencesField() { - return cy.getByDataTestId(REFERENCES_FIELD); - }, - fillReferences(references) { - this.getReferencesField().find(CONTENT_ETIDABLE_VALUE).fillInput(references); - }, - getSubmitResearchButton() { - return cy.get(SUBMIT_RESEARCH_BUTTON); - }, - clickSubmitResearch() { - this.getSubmitResearchButton().click(); - }, - getSubmitManuscriptButton() { - return cy.get(SUBMIT_MANUSCRIPT_BUTTON); - }, - clickSubmitManuscript() { - this.getSubmitManuscriptButton().click(); - }, - getValidationErrorMessage(error) { - return cy.getByContainsClass(VALIDATION_ERROR_MESSAGE).contains(error); - }, - - - getFormOptionList(nth) { - return cy.get(FORM_OPTION_LIST).eq(nth) - }, - clickElementFromFormOptionList(nth) { - cy.get(FORM_OPTION_LIST).eq(nth).click() - }, - getDropdownOption(nth) { - return cy.get(DROPDOWN_OPTION_LIST).eq(nth); - }, - getArticleld() { - return cy.getByDataTestId(ARTICLE_ID); - }, - fillInArticleld(articleId) { - this.getArticleld().fillInput(articleId); - }, - getArticleUrl() { - return cy.getByDataTestId(ARTICLE_URL); - }, - fillInArticleUrl(articleUrl) { - this.getArticleUrl().fillInput(articleUrl); - }, - getDescription() { - return cy.getByDataTestId(DESCRIPTION); - }, - fillInDescription(description) { - this.getDescription().fillInput(description); - }, - getEvaluationContent() { - return cy.getByDataTestId(EVALUATION_CONTENT); - }, - fillInEvaluationContent(evaluationContent) { - this.getEvaluationContent().find(CONTENT_ETIDABLE_VALUE).fillInput(evaluationContent); - } + getAddLinkButton() { + return cy.get(ADD_A_LINK_BUTTON) + }, + clickAddLink() { + this.getAddLinkButton().click() + }, + getEnterUrlField(nth) { + return cy.getByContainsName(ENTER_URL_FIELD).eq(nth) + }, + fillInUrl(nth, url) { + this.getEnterUrlField(nth).fillInput(url) + }, + getTitleField() { + return cy.getByDataTestId(TITLE_FIELD) + }, + fillInTitle(title) { + this.getTitleField().fillInput(title) + }, + getNameField() { + return cy.getByDataTestId(NAME_FIELD) + }, + fillInName(name) { + this.getNameField().fillInput(name) + }, + getAffiliationField() { + return cy.getByDataTestId(AFFILIATION_FIELD) + }, + fillInAffiliation(affiliation) { + this.getAffiliationField().fillInput(affiliation) + }, + getContactField() { + return cy.getByDataTestId(CONTACT_FIELD) + }, + fillInContact(contact) { + this.getContactField().fillInput(contact) + }, + getCoverField() { + return cy.getByDataTestId(COVER_FIELD) + }, + fillInCover(cover) { + this.getCoverField().find(CONTENT_ETIDABLE_VALUE).fillInput(cover) + }, + getDataCodeField() { + return cy.getByDataTestId(DATA_CODE_FIELD) + }, + fillInDataCode(dataCode) { + this.getDataCodeField().find(CONTENT_ETIDABLE_VALUE).fillInput(dataCode) + }, + getEthicsField() { + return cy.getByDataTestId(ETHICS_FIELD) + }, + fillInEthicsField(ethics) { + this.getEthicsField().find(CONTENT_ETIDABLE_VALUE).fillInput(ethics) + }, + getTypeOfResearchDropdown() { + return cy.getByContainsAreaLabel(TYPE_OF_RESEARCH_DROPDOWN) + }, + clickTypeOfResearchDropdown() { + this.getTypeOfResearchDropdown().click({ force: true }) + }, + selectDropdownOption(nth) { + return cy.get(DROPDOWN_OPTION_LIST).eq(nth).click() + }, + getSuggestedField() { + return cy.getByDataTestId(SUGGESTED_FIELD) + }, + fillInSuggested(suggested) { + this.getSuggestedField().fillInput(suggested) + }, + getFileDropzone() { + return cy.getByDataTestId(FILE_DROPZONE) + }, + attachFile(file) { + this.getFileDropzone().attachFile( + file, + // { + // fileContent, + // fileName: 'test-pdf.pdf', + // encoding: 'base64', + // mimeType: 'application/pdf', + // }, + { subjectType: 'drag-n-drop' }, + ) + }, + getKeywordsField() { + return cy.getByDataTestId(KEYWORDS_FIELD) + }, + fillInKeywords(keywords) { + this.getKeywordsField().fillInput(keywords) + }, + getHealthySubjectsStudyDropdown() { + return cy.getByContainsAreaLabel(HEALTHY_SUBJECTS_STUDY_DROPDOWN) + }, + clickHealthySubjectsStudyDropdown() { + this.getHealthySubjectsStudyDropdown().click({ force: true }) + }, + getInvolvedHumanSubjectsDropdown() { + return cy.getByContainsAreaLabel(INVOLVED_HUMAN_SUBJECTS_DROPDOWN) + }, + clickInvolvedHumanSubjectsDropdown() { + this.getInvolvedHumanSubjectsDropdown().click({ force: true }) + }, + getAnimalResearchApprovedDropdown() { + return cy.getByContainsAreaLabel(ANIMAL_RESEARCH_APPROVED_DROPDOWN) + }, + clickAnimalResearchApprovedDropdown() { + this.getAnimalResearchApprovedDropdown().click({ force: true }) + }, + getMethodsUsedCheckboxWithText(value) { + return cy.getByNameAndValue(METHODS_USED_CHECKBOX, value) + }, + clickMethodsUsedCheckboxWithText(value) { + this.getMethodsUsedCheckboxWithText(value).click() + }, + getOtherMethodsField() { + return cy.getByDataTestId(OTHER_METHODS_FIELD) + }, + fillInOtherMethods(text) { + this.getOtherMethodsField().fillInput(text) + }, + getFieldSthrenghtDropdown() { + return cy.getByContainsAreaLabel(FILED_STRENGTH_DROPDOWN) + }, + clickFieldSthrenghtDropdown() { + this.getFieldSthrenghtDropdown().click({ force: true }) + }, + getHumanMriOtherField() { + return cy.getByDataTestId(HUMAN_MRI_OTHER_FIELD) + }, + fillInHumanMriOther(other) { + this.getHumanMriOtherField().fillInput(other) + }, + getProcessingPackagesCheckboxWithText(text) { + return cy.getByNameAndValue(PROCESSING_PACKAGES_CHECKBOX_LIST, text) + }, + clickProcessingPackageWithText(text) { + this.getProcessingPackagesCheckboxWithText(text).click() + }, + getOtherPackagesField() { + return cy.getByDataTestId(OTHER_PACKAGES_FIELD) + }, + fillInOtherPackages(otherPackages) { + this.getOtherPackagesField().fillInput(otherPackages) + }, + getReferencesField() { + return cy.getByDataTestId(REFERENCES_FIELD) + }, + fillReferences(references) { + this.getReferencesField().find(CONTENT_ETIDABLE_VALUE).fillInput(references) + }, + getSubmitResearchButton() { + return cy.get(SUBMIT_RESEARCH_BUTTON) + }, + clickSubmitResearch() { + this.getSubmitResearchButton().click() + }, + getSubmitManuscriptButton() { + return cy.get(SUBMIT_MANUSCRIPT_BUTTON) + }, + clickSubmitManuscript() { + this.getSubmitManuscriptButton().click() + }, + getValidationErrorMessage(error) { + return cy.getByContainsClass(VALIDATION_ERROR_MESSAGE).contains(error) + }, + getFormOptionValue(nth) { + return cy.getByContainsClass(FORM_OPTION_VALUE).eq(nth) + }, + getFormOptionList(nth) { + return cy.get(FORM_OPTION_LIST).eq(nth) + }, + clickElementFromFormOptionList(nth) { + cy.get(FORM_OPTION_LIST).eq(nth).click() + }, + getDropdownOption(nth) { + return cy.get(DROPDOWN_OPTION_LIST).eq(nth) + }, + getArticleld() { + return cy.getByDataTestId(ARTICLE_ID_FIELD) + }, + fillInArticleld(articleId) { + this.getArticleld().fillInput(articleId) + }, + getArticleUrl() { + return cy.getByDataTestId(ARTICLE_URL_FIELD) + }, + fillInArticleUrl(articleUrl) { + this.getArticleUrl().fillInput(articleUrl) + }, + getDescription() { + return cy.getByDataTestId(DESCRIPTION_FIELD) + }, + fillInDescription(description) { + this.getDescription().fillInput(description) + }, + getEvaluationContent() { + return cy.getByDataTestId(EVALUATION_CONTENT_FIELD) + }, + fillInEvaluationContent(evaluationContent) { + this.getEvaluationContent() + .find(CONTENT_ETIDABLE_VALUE) + .fillInput(evaluationContent) + }, + getCreatorField() { + return cy.getByDataTestId(CREATOR_FIELD) + }, + fillInCreator(creator) { + this.getCreatorField().fillInput(creator) + }, } export default SubmissionFormPage