From a46c93f607b0d1f04acd7669fc698219278aee80 Mon Sep 17 00:00:00 2001 From: sebastianrad <65756657+sebastianrad@users.noreply.github.com> Date: Wed, 7 Apr 2021 13:55:01 +0300 Subject: [PATCH] test: add tests for sorting description --- .../integration/elife/manuscripts_page_spec.js | 18 +++++++++--------- .../integration/ncrc/manuscripts_page_spec.js | 15 ++++++++++++++- cypress/page-object/manuscripts-page.js | 6 +++--- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/cypress/integration/elife/manuscripts_page_spec.js b/cypress/integration/elife/manuscripts_page_spec.js index 694de1e2f6..381739659d 100644 --- a/cypress/integration/elife/manuscripts_page_spec.js +++ b/cypress/integration/elife/manuscripts_page_spec.js @@ -93,15 +93,15 @@ describe('Manuscripts page tests', () => { NewSubmissionPage.clickSubmitURL() SubmissionFormPage.fillInArticleld('def') Menu.clickManuscripts() - ManuscriptsPage.getArticleIdByRow(0).should('contain', 'def') - ManuscriptsPage.getArticleIdByRow(1).should('contain', 'abc') - ManuscriptsPage.getArticleIdByRow(2).should('contain', '456') - ManuscriptsPage.getArticleIdByRow(3).should('contain', '123') + ManuscriptsPage.getArticleTitleByRow(0).should('contain', 'def') + ManuscriptsPage.getArticleTitleByRow(1).should('contain', 'abc') + ManuscriptsPage.getArticleTitleByRow(2).should('contain', '456') + ManuscriptsPage.getArticleTitleByRow(3).should('contain', '123') ManuscriptsPage.clickTableHead(0) - ManuscriptsPage.getArticleIdByRow(0).should('contain', '123') - ManuscriptsPage.getArticleIdByRow(1).should('contain', '456') - ManuscriptsPage.getArticleIdByRow(2).should('contain', 'abc') - ManuscriptsPage.getArticleIdByRow(3).should('contain', 'def') + ManuscriptsPage.getArticleTitleByRow(0).should('contain', '123') + ManuscriptsPage.getArticleTitleByRow(1).should('contain', '456') + ManuscriptsPage.getArticleTitleByRow(2).should('contain', 'abc') + ManuscriptsPage.getArticleTitleByRow(3).should('contain', 'def') }) }) @@ -218,7 +218,7 @@ describe('Manuscripts page tests', () => { ManuscriptsPage.getTableHead(0).should('contain', 'Article Id') // eslint-disable-next-line jest/valid-expect-in-promise cy.fixture('submission_form_data').then(data => { - ManuscriptsPage.getArticleIdByRow(0).should('contain', data.articleId) + ManuscriptsPage.getArticleTitleByRow(0).should('contain', data.articleId) }) }) }) diff --git a/cypress/integration/ncrc/manuscripts_page_spec.js b/cypress/integration/ncrc/manuscripts_page_spec.js index b2155bdd1e..0f348d7319 100644 --- a/cypress/integration/ncrc/manuscripts_page_spec.js +++ b/cypress/integration/ncrc/manuscripts_page_spec.js @@ -172,12 +172,13 @@ describe('manuscripts page tests', () => { }) }) }) - context('filter by topics and sort by label', () => { + context('filter and sort articles', () => { beforeEach(() => { ManuscriptsPage.clickSubmit() NewSubmissionPage.clickSubmitURL() // eslint-disable-next-line jest/valid-expect-in-promise cy.fixture('form_option').then(data => { + SubmissionFormPage.fillInArticleDescription('123') SubmissionFormPage.clickElementFromFormOptionList(9) SubmissionFormPage.selectDropdownOption(0) SubmissionFormPage.clickTopicsCheckboxWithText( @@ -186,6 +187,7 @@ describe('manuscripts page tests', () => { Menu.clickManuscripts() ManuscriptsPage.clickSubmit() NewSubmissionPage.clickSubmitURL() + SubmissionFormPage.fillInArticleDescription('abc') SubmissionFormPage.clickElementFromFormOptionList(9) SubmissionFormPage.selectDropdownOption(1) SubmissionFormPage.clickTopicsCheckboxWithText( @@ -197,6 +199,7 @@ describe('manuscripts page tests', () => { Menu.clickManuscripts() ManuscriptsPage.clickSubmit() NewSubmissionPage.clickSubmitURL() + SubmissionFormPage.fillInArticleDescription('def') SubmissionFormPage.clickElementFromFormOptionList(9) SubmissionFormPage.selectDropdownOption(0) SubmissionFormPage.clickTopicsCheckboxWithText( @@ -239,5 +242,15 @@ describe('manuscripts page tests', () => { ManuscriptsPage.getLabelRow(1).should('contain', 'ready to evaluat') ManuscriptsPage.getLabelRow(2).should('contain', 'ready to evaluat') }) + it('sort article by Description', () => { + ManuscriptsPage.getTableHead(0).should('contain', 'Description') + ManuscriptsPage.getArticleTitleByRow(0).should('contain', 'def') + ManuscriptsPage.getArticleTitleByRow(1).should('contain', 'abc') + ManuscriptsPage.getArticleTitleByRow(2).should('contain', '123') + ManuscriptsPage.clickTableHead(0) + ManuscriptsPage.getArticleTitleByRow(0).should('contain', '123') + ManuscriptsPage.getArticleTitleByRow(1).should('contain', 'abc') + ManuscriptsPage.getArticleTitleByRow(2).should('contain', 'def') + }) }) }) diff --git a/cypress/page-object/manuscripts-page.js b/cypress/page-object/manuscripts-page.js index 50f1de6cdf..5532db8432 100644 --- a/cypress/page-object/manuscripts-page.js +++ b/cypress/page-object/manuscripts-page.js @@ -13,7 +13,7 @@ const CREATED_CARET = 'Carets__Caret' const AUTHOR_FIELD = 'UserCombo__Primary' const STATUS_FIELD = 'Badge__Status' const MANUSCRIPTS_TABLE_HEAD = '[class*=Table__Header] > tr >th' -const ARTICLE_ID = '[class*=Table__Row]>td:nth-child(1)' +const ARTICLE_TITLE = '[class*=Table__Row]>td:nth-child(1)' const ARTICLE_LABEL = 'style__StyledTableLabel' const ARTICLE_TOPIC = '[class*=Table__Cell] > [title]' const TABLE_ROW = 'Table__Row' @@ -65,8 +65,8 @@ export const ManuscriptsPage = { getTableHead(nth) { return cy.get(MANUSCRIPTS_TABLE_HEAD).eq(nth) }, - getArticleIdByRow(nth) { - return cy.get(ARTICLE_ID).eq(nth) + getArticleTitleByRow(nth) { + return cy.get(ARTICLE_TITLE).eq(nth) }, clickTableHead(nth) { this.getTableHead(nth).click() -- GitLab