diff --git a/cypress/integration/pageobjects/germplasm-lists/germplasm-lists-page.ts b/cypress/integration/pageobjects/germplasm-lists/germplasm-lists-page.ts index 439ad05..e6911c1 100644 --- a/cypress/integration/pageobjects/germplasm-lists/germplasm-lists-page.ts +++ b/cypress/integration/pageobjects/germplasm-lists/germplasm-lists-page.ts @@ -142,6 +142,35 @@ export default class GermplasmListPage { this.openGermplasmListAction("cloneListButton"); } + addDisplayedColumn(columnName: string) { + getIframeBody().then(($iframe) => { + cy.wrap($iframe).find('#columnMenu').should('exist').click(); + cy.wrap($iframe).find('label.form-check-label').contains(columnName).click(); + cy.intercept('GET', `**/search?*`).as('filterList'); + cy.wrap($iframe).find('[data-test="displayColumnApplyButton"]').click(); + + cy.wait('@filterList').then((interception) => { + expect(interception.response.statusCode).to.be.equal(200); + }); + this.addEntryDetailsContext.variableName = columnName; + }); + } + + selectExpansionLevel() { + getIframeBody().then(($iframe) => { + cy.wrap($iframe).find('[data-test="specifyExpansionLevelButton"]').should('exist').click(); + cy.wrap($iframe).find('#generationLevel').should('exist').select("2"); + cy.intercept('PUT', `**/pedigree-generation-level?*`).as('pedigreeGenerationLevelUpdate'); + cy.wrap($iframe).find('[data-test="crossExpansionApplyButton"]').click(); + }); + } + + checkCrossExpansionUpdate() { + cy.wait('@pedigreeGenerationLevelUpdate').then((interception) => { + expect(interception.response.statusCode).to.equal(200); + }) + } + /* Returns a radom value in range from 1 to 10 */ diff --git a/cypress/integration/pageobjects/studies/import-crosses-page.ts b/cypress/integration/pageobjects/studies/import-crosses-page.ts index ab44515..c94ded0 100644 --- a/cypress/integration/pageobjects/studies/import-crosses-page.ts +++ b/cypress/integration/pageobjects/studies/import-crosses-page.ts @@ -68,4 +68,12 @@ export default class ImportCrossesPage { getIframeBody().find('[data-test="crossesPreviewNextButton"]').should('be.visible').click(); } -} \ No newline at end of file + processAutomaticNamingCrossesImport() { + this.specifyBreedingMethod(); + this.goToNamingAndHarvestDetails(); + this.specifyAutomaticNaming(); + this.specifyHarvestDetails(); + this.goToPreviewCrosses(); + this.goToSaveList(); + } +} diff --git a/cypress/integration/tests/manage-lists/fill-list-with-cross-expansion.feature2 b/cypress/integration/tests/manage-lists/fill-list-with-cross-expansion.feature similarity index 79% rename from cypress/integration/tests/manage-lists/fill-list-with-cross-expansion.feature2 rename to cypress/integration/tests/manage-lists/fill-list-with-cross-expansion.feature index ec5b747..25e9600 100644 --- a/cypress/integration/tests/manage-lists/fill-list-with-cross-expansion.feature2 +++ b/cypress/integration/tests/manage-lists/fill-list-with-cross-expansion.feature @@ -7,7 +7,9 @@ As a user I should be able to add cross column to a germplasm list and fill with cross expansion Background: - Given a cross list already exists + Given I am on the Manage Studies page of specified program + And I opened a study with RCBD design + And I imported a cross and created a cross list And I am on the Germplasm Lists page of specified program @TestCaseKey=IBP-T4154 diff --git a/cypress/integration/tests/manage-lists/fill-list-with-cross-expansion/fill-list-with-cross-expansion-step-defs.ts b/cypress/integration/tests/manage-lists/fill-list-with-cross-expansion/fill-list-with-cross-expansion-step-defs.ts new file mode 100644 index 0000000..22bdefc --- /dev/null +++ b/cypress/integration/tests/manage-lists/fill-list-with-cross-expansion/fill-list-with-cross-expansion-step-defs.ts @@ -0,0 +1,50 @@ +import { And, Then, When } from 'cypress-cucumber-preprocessor/steps'; +import CreateStudyPage from '../../../pageobjects/studies/create-study-page'; +import ImportCrossesPage from '../../../pageobjects/studies/import-crosses-page'; +import SaveListTreeModalPage from '../../../pageobjects/studies/save-list-tree-modal-page'; +import GermplasmListsBetaPage from '../../../pageobjects/germplasm-lists/germplasm-lists-beta-page'; +import AddEntryDetailsContext from '../add-entry-details/add-entry-details.context'; +import GermplasmListPage from '../../../pageobjects/germplasm-lists/germplasm-lists-page'; + +const createStudyPage = new CreateStudyPage(); +const importCrossesPage = new ImportCrossesPage(); +const saveListTreeModalPage = new SaveListTreeModalPage(); +const searchPage = new GermplasmListsBetaPage(); + +const addEntryDetailsContext = new AddEntryDetailsContext(); +const germplasmListPage = new GermplasmListPage(addEntryDetailsContext); + +let listName = 'Cross-' + Date.now(); + +And('I imported a cross and created a cross list', () => { + let studyName = Cypress.env('rcbdStudy'); + createStudyPage.clickStudyAction('Export crossing template', 'Crossing options'); + cy.verifyDownload(`CrossingTemplate-${studyName}.xls`); + createStudyPage.clickStudyAction("Import Crosses", "Crossing options"); + + importCrossesPage.uploadFile(`CrossingTemplate-${studyName}.xls`); + importCrossesPage.processAutomaticNamingCrossesImport(); + + saveListTreeModalPage.setListName(listName); + saveListTreeModalPage.save(); +}); + +When('I open the cross list', () => { + searchPage.selectListFilteredByListName(listName); +}); + +And('I add cross column', () => { + germplasmListPage.addDisplayedColumn('CROSS'); +}); + +And('I fill the column with cross expansion', () => { + germplasmListPage.selectExpansionLevel(); +}); + +Then('I should see the cross expansion value of the entries', () => { + germplasmListPage.checkCrossExpansionUpdate(); +}); + + + +