From c36c8f453d7767b0335134a0eee041295ba1fe04 Mon Sep 17 00:00:00 2001 From: Nisarg Vadgama <31422051+ngunner15@users.noreply.github.com> Date: Fri, 4 Oct 2024 15:10:22 -0700 Subject: [PATCH] feat: 1454 smp success on parent step 5 (#1546) --- frontend/cypress.config.ts | 3 +- ...-seedlot-reg-form-collection-interim.cy.ts | 17 +- .../a-class-seedlot-reg-form-extraction.cy.ts | 6 + .../a-class-seedlot-reg-form-orchard.cy.ts | 35 +- .../a-class-seedlot-reg-form-ownership.cy.ts | 17 +- ...-seedlot-reg-form-parent-tree-part-1.cy.ts | 89 +++- ...-seedlot-reg-form-parent-tree-part-2.cy.ts | 444 ++++++++++++++++++ .../e2e/smoke-test/seedlot-dashboard.cy.ts | 1 - .../Seedlot_composition_template_02.csv | 3 + .../cypress/fixtures/aclass-reg-form.json | 4 +- 10 files changed, 583 insertions(+), 36 deletions(-) create mode 100644 frontend/cypress/e2e/smoke-test/a-class-seedlot-reg-form-parent-tree-part-2.cy.ts create mode 100644 frontend/cypress/fixtures/Seedlot_composition_template_02.csv diff --git a/frontend/cypress.config.ts b/frontend/cypress.config.ts index 7a18c32f3..a7e332058 100644 --- a/frontend/cypress.config.ts +++ b/frontend/cypress.config.ts @@ -29,7 +29,8 @@ export default defineConfig({ '**/a-class-seedlot-reg-form-ownership.cy.ts', '**/a-class-seedlot-reg-form-orchard.cy.ts', '**/a-class-seedlot-reg-form-extraction.cy.ts', - '**/a-class-seedlot-reg-form-parent-tree-part-1.cy.ts' + '**/a-class-seedlot-reg-form-parent-tree-part-1.cy.ts', + '**/a-class-seedlot-reg-form-parent-tree-part-2.cy.ts' ], chromeWebSecurity: false, retries: { diff --git a/frontend/cypress/e2e/smoke-test/a-class-seedlot-reg-form-collection-interim.cy.ts b/frontend/cypress/e2e/smoke-test/a-class-seedlot-reg-form-collection-interim.cy.ts index f03dd9d03..f1350ed31 100644 --- a/frontend/cypress/e2e/smoke-test/a-class-seedlot-reg-form-collection-interim.cy.ts +++ b/frontend/cypress/e2e/smoke-test/a-class-seedlot-reg-form-collection-interim.cy.ts @@ -183,6 +183,9 @@ describe('A Class Seedlot Registration form, Collection and Interim storage', () cy.get('#collection-location-code') .should('have.value', locationCode); + + // Save changes + cy.saveSeedlotRegFormProgress(); }); // Enter location code for linkage test @@ -306,6 +309,12 @@ describe('A Class Seedlot Registration form, Collection and Interim storage', () }); it('[Collection] Checkbox input', () => { + // Change inputs + cy.get('#collection-step-default-checkbox') + .focus() + .check({ force: true }) + .blur(); + cy.get('#cone-collection-method-checkbox-1') .focus() .check({ force: true }) @@ -316,6 +325,9 @@ describe('A Class Seedlot Registration form, Collection and Interim storage', () .type('Test comment') .blur(); + // Save changes + cy.saveSeedlotRegFormProgress(); + // Press next button cy.get('.seedlot-registration-button-row') .find('button.form-action-btn') @@ -350,7 +362,7 @@ describe('A Class Seedlot Registration form, Collection and Interim storage', () .should('have.value', testPopupAcronym); cy.get('#interim-location-code') - .should('have.value', '03'); + .should('have.value', '01'); cy.get('#interim-use-collection-agency') .should('be.checked'); @@ -450,6 +462,9 @@ describe('A Class Seedlot Registration form, Collection and Interim storage', () cy.get('#interim-location-code') .should('have.value', locationCode); + + // Save changes + cy.saveSeedlotRegFormProgress(); }); }); diff --git a/frontend/cypress/e2e/smoke-test/a-class-seedlot-reg-form-extraction.cy.ts b/frontend/cypress/e2e/smoke-test/a-class-seedlot-reg-form-extraction.cy.ts index 7181a2aaa..821edbaf3 100644 --- a/frontend/cypress/e2e/smoke-test/a-class-seedlot-reg-form-extraction.cy.ts +++ b/frontend/cypress/e2e/smoke-test/a-class-seedlot-reg-form-extraction.cy.ts @@ -196,6 +196,9 @@ describe('A Class Seedlot Registration form, Extraction and Storage', () => { cy.get('#ext-location-code') .should('have.value', locationCode); + + // Save changes + cy.saveSeedlotRegFormProgress(); }); }); @@ -338,6 +341,9 @@ describe('A Class Seedlot Registration form, Extraction and Storage', () => { cy.get('#str-location-code') .should('have.value', locationCode); + + // Save changes + cy.saveSeedlotRegFormProgress(); }); }); diff --git a/frontend/cypress/e2e/smoke-test/a-class-seedlot-reg-form-orchard.cy.ts b/frontend/cypress/e2e/smoke-test/a-class-seedlot-reg-form-orchard.cy.ts index 900968a12..b3deaff62 100644 --- a/frontend/cypress/e2e/smoke-test/a-class-seedlot-reg-form-orchard.cy.ts +++ b/frontend/cypress/e2e/smoke-test/a-class-seedlot-reg-form-orchard.cy.ts @@ -1,6 +1,7 @@ import prefix from '../../../src/styles/classPrefix'; import { THIRTY_SECONDS } from '../../constants'; import { SeedlotRegFixtureType } from '../../definitions'; +import { TYPE_DELAY } from '../../constants'; describe('A Class Seedlot Registration form, Orchard', () => { let regFormData: { @@ -362,6 +363,9 @@ describe('A Class Seedlot Registration form, Orchard', () => { .contains('219 - VERNON - S - PRD') .click(); + // Save changes + cy.saveSeedlotRegFormProgress(); + // Add additional orchard cy.get('.seedlot-orchard-add-orchard') .find('button') @@ -554,11 +558,14 @@ describe('A Class Seedlot Registration form, Orchard', () => { cy.get('#orchard-is-regional') .should('be.checked'); + + cy.get('#orchard-breading-perc-helper-text') + .should('have.text', regFormData.orchard.pollenHelperText); // Check pollen breeding % error msg cy.get('#orchard-breading-perc') .clear() - .type('-1') + .type('-1', { delay: TYPE_DELAY }) .blur(); cy.get('#orchard-breading-perc-error-msg') @@ -566,7 +573,7 @@ describe('A Class Seedlot Registration form, Orchard', () => { cy.get('#orchard-breading-perc') .clear() - .type('101') + .type('101', { delay: TYPE_DELAY }) .blur(); cy.get('#orchard-breading-perc-error-msg') @@ -574,42 +581,22 @@ describe('A Class Seedlot Registration form, Orchard', () => { cy.get('#orchard-breading-perc') .clear() - .type('21.1576') + .type('21.1576', { delay: TYPE_DELAY }) .blur(); cy.get('#orchard-breading-perc-error-msg') .should('have.text', regFormData.orchard.pollenError); - // Check '+' and '-' buttons for pollen breeding % cy.get('#orchard-breading-perc') .clear() - .type('5') + .type('5', { delay: TYPE_DELAY }) .blur(); - cy.get('#orchard-breading-perc-helper-text') - .should('have.text', regFormData.orchard.pollenHelperText); - - cy.get(`button.${prefix}--number__control-btn[title="Increment number"]`) - .click(); - - cy.get('#orchard-breading-perc') - .should('have.value', '15'); - - cy.get(`button.${prefix}--number__control-btn[title="Decrement number"]`) - .click(); - - cy.get('#orchard-breading-perc') - .should('have.value', '5'); - // Save changes cy.saveSeedlotRegFormProgress(); }); it('Step complete status', () => { - // Make sure value is loaded - cy.get('#orchard-breading-perc') - .should('have.value', '5'); - // Press next button cy.get('.seedlot-registration-button-row') .find('button.form-action-btn') diff --git a/frontend/cypress/e2e/smoke-test/a-class-seedlot-reg-form-ownership.cy.ts b/frontend/cypress/e2e/smoke-test/a-class-seedlot-reg-form-ownership.cy.ts index b3799c490..19c44eb66 100644 --- a/frontend/cypress/e2e/smoke-test/a-class-seedlot-reg-form-ownership.cy.ts +++ b/frontend/cypress/e2e/smoke-test/a-class-seedlot-reg-form-ownership.cy.ts @@ -66,6 +66,17 @@ describe('A Class Seedlot Registration form, Ownership', () => { .find('p') .should('have.text', regFormData.ownership.subtitle); + // Check the checkbox if unchecked + cy.get('#default-owner-checkbox') + .then($checkbox => { + if ($checkbox.is(':not(:checked)')) { + cy.get('#default-owner-checkbox').check({ force: true }); + // Save changes + cy.saveSeedlotRegFormProgress(); + } + }) + .should("be.checked"); + cy.get(`.${prefix}--accordion__title`) .find('.item-title-section') .should('have.text', initialAccordionTitle); @@ -207,10 +218,10 @@ describe('A Class Seedlot Registration form, Ownership', () => { cy.get('#ownership-location-code-0') .should('have.value', locationCode); - }); - // Save changes - cy.saveSeedlotRegFormProgress(); + // Save changes + cy.saveSeedlotRegFormProgress(); + }); }); it('Owner portion %, reserved % and surplus % display default values', () => { diff --git a/frontend/cypress/e2e/smoke-test/a-class-seedlot-reg-form-parent-tree-part-1.cy.ts b/frontend/cypress/e2e/smoke-test/a-class-seedlot-reg-form-parent-tree-part-1.cy.ts index c9a4dd4dc..a8ec97a73 100644 --- a/frontend/cypress/e2e/smoke-test/a-class-seedlot-reg-form-parent-tree-part-1.cy.ts +++ b/frontend/cypress/e2e/smoke-test/a-class-seedlot-reg-form-parent-tree-part-1.cy.ts @@ -34,6 +34,82 @@ describe('A Class Seedlot Registration form, Parent Tree and SMP part-1(Cone and }); }); + it('Check primary and secondary orchard values', () => { + // Press next button + cy.get('.seedlot-registration-button-row') + .find('button.form-action-btn') + .contains('Back') + .click(); + + // Check primary orchard + cy.get('#primary-orchard-selection') + .then($input => { + const value = $input.val(); + if (value === '') { + cy.log('Primary input is empty'); + // Do something if the input is empty + cy.get('#primary-orchard-selection') + .siblings(`button.${prefix}--list-box__menu-icon[title="Open"]`) + .click(); + + cy.get(`.${prefix}--list-box--expanded`) + .find('ul li') + .contains('219 - VERNON - S - PRD') + .click(); + + // Add additional orchard + cy.get('.seedlot-orchard-add-orchard') + .find('button') + .contains('Add additional orchard') + .click(); + + cy.get('#secondary-orchard-selection') + .siblings(`button.${prefix}--list-box__menu-icon[title="Open"]`) + .click(); + + cy.get(`.${prefix}--list-box--expanded`) + .find('ul li') + .contains('222 - VERNON - S - PRD') + .click(); + + // Save changes + cy.saveSeedlotRegFormProgress(); + } + }); + + // Check secondary orchard + cy.get('#secondary-orchard-selection') + .then($input => { + const value = $input.val(); + if (value === '') { + cy.log('Secondary input is empty'); + // Do something if the input is empty + cy.get('#secondary-orchard-selection') + .siblings(`button.${prefix}--list-box__menu-icon[title="Open"]`) + .click(); + + cy.get(`.${prefix}--list-box--expanded`) + .find('ul li') + .contains('222 - VERNON - S - PRD') + .click(); + + // Save changes + cy.saveSeedlotRegFormProgress(); + } + }); + + // Press next button + cy.get('.seedlot-registration-button-row') + .find('button.form-action-btn') + .contains('Next') + .click(); + + cy.get('#parentTreeNumber').scrollIntoView(); + + // Save changes + cy.saveSeedlotRegFormProgress(); + }); + it('Page title and subtitles', () => { cy.get('.title-row') .find('h2') @@ -115,7 +191,7 @@ describe('A Class Seedlot Registration form, Parent Tree and SMP part-1(Cone and // Wait for the table to load cy.wait('@parentTreesUnderVegCode', { timeout: THIRTY_SECONDS }).its('response.statusCode').should('equal', 200); - cy.get('#parentTreeNumber'); + cy.get('#parentTreeNumber').scrollIntoView(); // Check error message for negative Cone count cy.get('#212-coneCount-value-input') @@ -217,7 +293,7 @@ describe('A Class Seedlot Registration form, Parent Tree and SMP part-1(Cone and // Wait for the table to load cy.wait('@parentTreesUnderVegCode', { timeout: THIRTY_SECONDS }).its('response.statusCode').should('equal', 200); - cy.get('#parentTreeNumber'); + cy.get('#parentTreeNumber').scrollIntoView(); // Click 'Dothistroma needle blight (DFS)' checkbox cy.get(`.${prefix}--toolbar-content > span`) @@ -301,7 +377,7 @@ describe('A Class Seedlot Registration form, Parent Tree and SMP part-1(Cone and // Wait for the table to load cy.wait('@parentTreesUnderVegCode', { timeout: THIRTY_SECONDS }).its('response.statusCode').should('equal', 200); - cy.get('#parentTreeNumber'); + cy.get('#parentTreeNumber').scrollIntoView(); // Check Download file option cy.get(`.${prefix}--toolbar-content > span`) @@ -368,7 +444,8 @@ describe('A Class Seedlot Registration form, Parent Tree and SMP part-1(Cone and .click(); cy.get(`.${prefix}--modal-container[aria-label="Clean table data"]`) - .find('button[aria-label="close"]') + .find('button') + .contains('Cancel') .click(); cy.get(`.${prefix}--modal-container[aria-label="Clean table data"]`) @@ -456,6 +533,8 @@ describe('A Class Seedlot Registration form, Parent Tree and SMP part-1(Cone and cy.wait('@parentTreesUnderVegCode', { timeout: THIRTY_SECONDS }).its('response.statusCode').should('equal', 200); cy.get('#parentTreeNumber'); + cy.get(`.${prefix}--pagination`).scrollIntoView(); + const dropdownNumber = '20'; // Number of item dropdown cy.get(`.${prefix}--pagination__left`) @@ -518,6 +597,8 @@ describe('A Class Seedlot Registration form, Parent Tree and SMP part-1(Cone and cy.wait('@parentTreesUnderVegCode', { timeout: THIRTY_SECONDS }).its('response.statusCode').should('equal', 200); cy.get('#parentTreeNumber'); + cy.get('.info-sections-row').scrollIntoView(); + // Check info sections not visible in DOM cy.get('.info-section-sub-title') .should('not.exist'); diff --git a/frontend/cypress/e2e/smoke-test/a-class-seedlot-reg-form-parent-tree-part-2.cy.ts b/frontend/cypress/e2e/smoke-test/a-class-seedlot-reg-form-parent-tree-part-2.cy.ts new file mode 100644 index 000000000..5d318a344 --- /dev/null +++ b/frontend/cypress/e2e/smoke-test/a-class-seedlot-reg-form-parent-tree-part-2.cy.ts @@ -0,0 +1,444 @@ +import prefix from '../../../src/styles/classPrefix'; +import { THIRTY_SECONDS } from '../../constants'; + +describe('A Class Seedlot Registration form, Parent Tree and SMP part-2(SMP success on parent)', () => { + let regFormData: { + parentTree: { + smpSuccessTitle: string; + smpSuccessSubtitle: string; + smpSuccessErrorMsg: string; + nonOrchardErrorMsg: string; + smpSuccessCheckboxText: string; + smpSuccessNonOrchardErrorMsg: string; + } + }; + + let seedlotNum: string; + const speciesKey = 'pli'; + + beforeEach(() => { + // Login + cy.login(); + cy.fixture('aclass-reg-form').then((fData) => { + regFormData = fData; + }); + + cy.fixture('aclass-seedlot').then((fData) => { + cy.task('getData', fData[speciesKey].species).then((sNumber) => { + seedlotNum = sNumber as string; + const url = `/seedlots/a-class-registration/${seedlotNum}/?step=5`; + cy.visit(url); + cy.url().should('contains', url); + cy.get('#parent-tree-step-tab-list-id') + .find('button') + .contains('SMP success on parent') + .click(); + }); + }); + }); + + it('Page title and subtitles', () => { + cy.get('.parent-tree-step-table-container') + .find('h4') + .should('have.text', regFormData.parentTree.smpSuccessTitle); + + cy.get('.parent-tree-step-table-container') + .find(`p.${prefix}--data-table-header__description`) + .should('have.text', regFormData.parentTree.smpSuccessSubtitle); + }); + + it('check checkbox default state', () => { + cy.get('[for="smp-default-vals-checkbox"]') + .should('have.text', regFormData.parentTree.smpSuccessCheckboxText); + + cy.get('#smp-default-vals-checkbox') + .should('not.be.checked'); + + cy.get('#smp-default-vals-checkbox') + .check({ force: true}); + + cy.get('.smp-default-input-row') + .should('be.visible'); + }); + + it('change checkbox default state', () => { + // Wait for the table to load + cy.get('#parentTreeNumber', { timeout: 8000 }); + + cy.get('#smp-default-vals-checkbox') + .check({force: true}); + + cy.get('.smp-default-input-row') + .should('be.visible'); + + // Check error msg for negative 'SMP success' value + cy.get('#default-smp-success-input') + .clear() + .type('-1') + .blur(); + + cy.get(`.${prefix}--actionable-notification--error`) + .should('be.visible'); + + cy.get(`.${prefix}--actionable-notification--error`) + .find(`.${prefix}--actionable-notification__title`) + .as('errorDialog') + .should('have.text', regFormData.parentTree.smpSuccessErrorMsg); + + // Check no error message for positive 'SMP success' value + cy.get('#default-smp-success-input') + .clear() + .type('5') + .blur(); + + cy.get(`.${prefix}--actionable-notification--error`) + .should('not.exist'); + + // Check error msg for decimal 'SMP success' value + cy.get('#default-smp-success-input') + .clear() + .type('0.05') + .blur(); + + cy.get(`.${prefix}--actionable-notification--error`) + .should('be.visible'); + + cy.get('@errorDialog') + .should('have.text', regFormData.parentTree.smpSuccessErrorMsg); + + // Check error msg for >25 'SMP success' value + cy.get('#default-smp-success-input') + .clear() + .type('26') + .blur(); + + cy.get(`.${prefix}--actionable-notification--error`) + .should('be.visible'); + + cy.get('@errorDialog') + .should('have.text', regFormData.parentTree.smpSuccessErrorMsg); + + // Enter values for all 'SMP success on parent (%)' cells + cy.get('#default-smp-success-input') + .clear() + .type('5') + .blur(); + + // Check error msg for negative 'pollen contaminant' value + cy.get('#default-pollen-contam-input') + .clear() + .type('-1') + .blur(); + + cy.get(`.${prefix}--actionable-notification--error`) + .should('be.visible'); + + cy.get('@errorDialog') + .should('have.text', regFormData.parentTree.nonOrchardErrorMsg); + + // Check no error message for positive 'pollen contaminant' value + cy.get('#default-pollen-contam-input') + .clear() + .type('5') + .blur(); + + cy.get(`.${prefix}--actionable-notification--error`) + .should('not.exist'); + + // Check error msg for decimal 'pollen contaminant' value + cy.get('#default-pollen-contam-input') + .clear() + .type('0.05') + .blur(); + + cy.get(`.${prefix}--actionable-notification--error`) + .should('be.visible'); + + cy.get('@errorDialog') + .should('have.text', regFormData.parentTree.nonOrchardErrorMsg); + + // Check error msg for >100 'pollen contaminant' value + cy.get('#default-pollen-contam-input') + .clear() + .type('101') + .blur(); + + cy.get(`.${prefix}--actionable-notification--error`) + .should('be.visible'); + + cy.get('@errorDialog') + .should('have.text', regFormData.parentTree.nonOrchardErrorMsg); + + // Enter values for all 'Non-orchard pollen contam. (%)' cells + cy.get('#default-pollen-contam-input') + .clear() + .type('2') + .blur(); + + cy.get(`.${prefix}--actionable-notification--error`) + .should('not.exist'); + + // Check values for top 5 rows + cy.get('#212-smpSuccessPerc-value-input') + .should('have.value', '5'); + + cy.get('#212-nonOrchardPollenContam-value-input') + .should('have.value', '2'); + + cy.get('#219-smpSuccessPerc-value-input') + .should('have.value', '5'); + + cy.get('#219-nonOrchardPollenContam-value-input') + .should('have.value', '2'); + + cy.get('#222-smpSuccessPerc-value-input') + .should('have.value', '5'); + + cy.get('#222-nonOrchardPollenContam-value-input') + .should('have.value', '2'); + + cy.get('#223-smpSuccessPerc-value-input') + .should('have.value', '5'); + + cy.get('#223-nonOrchardPollenContam-value-input') + .should('have.value', '2'); + + cy.get('#224-smpSuccessPerc-value-input') + .should('have.value', '5'); + + cy.get('#224-nonOrchardPollenContam-value-input') + .should('have.value', '2'); + + // Change values of first rows + cy.get('#212-smpSuccessPerc-value-input') + .clear() + .type('0') + .blur(); + + cy.get('#212-nonOrchardPollenContam-value-input') + .clear() + .type('0') + .blur(); + }); + + it('Check \'Show/hide columns\' button functionality', () => { + // Wait for the table to load + cy.get('#parentTreeNumber', { timeout: 8000 }); + + // Click 'Dothistroma needle blight (DFS)' checkbox + cy.get(`.${prefix}--toolbar-content > span`) + .eq(0) + .find('button') + .as('clickShowHideBtn') + .click({force: true}); + + cy.get('ul.parent-tree-table-toggle-menu') + .find('li') + .contains('Dothistroma needle blight (DFS)') + .click(); + + cy.get('.parent-tree-step-table-container') + .find('h4') + .as('closeShowHideDropdown') + .click(); + + cy.get('thead.table-header') + .find('#dfs') + .should('exist'); + + // Click 'Comandra blister rust (DSC)' checkbox + cy.get('@clickShowHideBtn') + .click({force: true}); + + cy.get('ul.parent-tree-table-toggle-menu') + .find('li') + .contains('Comandra blister rust (DSC)') + .click(); + + cy.get('@closeShowHideDropdown') + .click(); + + cy.get('thead.table-header') + .find('#dsc') + .should('exist'); + + // Click 'Western gall rust (DSG)' checkbox + cy.get('@clickShowHideBtn') + .click({force: true}); + + cy.get('ul.parent-tree-table-toggle-menu') + .find('li') + .contains('Western gall rust (DSG)') + .click(); + + cy.get('@closeShowHideDropdown') + .click(); + + cy.get('thead.table-header') + .find('#dsg') + .should('exist'); + + // Click 'Volume growth (GVO)' checkbox + cy.get('@clickShowHideBtn') + .click({force: true}); + + cy.get('ul.parent-tree-table-toggle-menu') + .find('li') + .contains('Volume growth (GVO)') + .click(); + + cy.get('@closeShowHideDropdown') + .click(); + + cy.get('thead.table-header') + .find('#gvo') + .should('exist'); + }); + + it('Check \'More Options\' button functionality', () => { + // Wait for the table to load + cy.get('#parentTreeNumber', { timeout: 8000 }); + + // Check Download file option + cy.get(`.${prefix}--toolbar-content > span`) + .eq(1) + .find('button') + .as('clickMoreOptionsBtn') + .click(); + + cy.get('ul.parent-tree-table-option-menu') + .find('li') + .contains('Download table template') + .click(); + + cy.readFile(`${Cypress.config('downloadsFolder')}/Seedlot_composition_template.csv`); + + // Click 'Clean table data' option + cy.get('@clickMoreOptionsBtn') + .click(); + + cy.get('ul.parent-tree-table-option-menu') + .find('li') + .contains('Clean table data') + .as('clickCleanTableBtn') + .click(); + + cy.get(`.${prefix}--modal-container[aria-label="Clean table data"]`) + .should('be.visible'); + + // Check Cancel button of 'Clean table data' dialog box + cy.get(`.${prefix}--modal-container[aria-label="Clean table data"]`) + .find('button') + .contains('Cancel') + .click(); + + cy.get(`.${prefix}--modal-container[aria-label="Clean table data"]`) + .should('not.be.visible'); + + // Check 'X' button of 'Clean table data' dialog box + cy.get('@clickMoreOptionsBtn') + .click(); + + cy.get('@clickCleanTableBtn') + .click(); + + cy.get(`.${prefix}--modal-container[aria-label="Clean table data"]`) + .find('button') + .contains('Cancel') + .click(); + + cy.get(`.${prefix}--modal-container[aria-label="Clean table data"]`) + .should('not.be.visible'); + + // Check 'Clean table data' button of 'Clean table data' dialog box + cy.get('@clickMoreOptionsBtn') + .click(); + + cy.get('@clickCleanTableBtn') + .click(); + + cy.get(`.${prefix}--modal-container[aria-label="Clean table data"]`) + .find('button') + .contains('Clean table data') + .click(); + + // Check values in 'SMP success on parent (%)' and 'Non-orchard pollen contam. (%)' columns of the table + cy.get('#212-smpSuccessPerc-value-input') + .should('have.value', ''); + + cy.get('#212-nonOrchardPollenContam-value-input') + .should('have.value', ''); + + cy.get('#219-smpSuccessPerc-value-input') + .should('have.value', ''); + + cy.get('#219-nonOrchardPollenContam-value-input') + .should('have.value', ''); + + // Check upload button functionality + cy.get('button.upload-button') + .click({force: true}); + + cy.get(`.${prefix}--modal-container[aria-label="Seedlot registration"]`) + .should('be.visible'); + + cy.get('button') + .contains('Cancel') + .click(); + + cy.get(`.${prefix}--modal-container[aria-label="Seedlot registration"]`) + .should('not.be.visible'); + + // Check file upload functionality + cy.get('button.upload-button') + .click({force: true}); + + cy.get(`.${prefix}--modal-container[aria-label="Seedlot registration"]`) + .should('be.visible'); + + cy.get(`.${prefix}--file`) + .find(`input.${prefix}--file-input`) + .selectFile('cypress/fixtures/Seedlot_composition_template_02.csv', {force: true}); + + cy.get('button') + .contains('Import file and continue') + .click(); + + // Compare values in 'SMP success on parent (%)' and 'Non-orchard pollen contam. (%)' columns of the table with the csv file + cy.get('#212-smpSuccessPerc-value-input') + .should('have.value', '1'); + + cy.get('#212-nonOrchardPollenContam-value-input') + .should('have.value', '46'); + + cy.get('#219-smpSuccessPerc-value-input') + .should('have.value', '2'); + + cy.get('#219-nonOrchardPollenContam-value-input') + .should('have.value', '22'); + }); + + it('Calculate Metrics button', () => { + // Click 'Calculate metrics' button + cy.get('.gen-worth-cal-row') + .find('button') + .contains('Calculate metrics') + .click(); + + // Check info sections visible in DOM + cy.get('.info-section-sub-title') + .find(`.${prefix}--col`) + .contains('Genetic worth and percent of Tested parent tree contribution') + .should('be.visible'); + + cy.get('.info-section-sub-title') + .find(`.${prefix}--col`) + .contains('Effective population size and diversity') + .should('be.visible'); + + cy.get('.info-section-sub-title') + .find(`.${prefix}--col`) + .contains('Orchard parent tree geospatial summary') + .should('be.visible'); + }); +}); diff --git a/frontend/cypress/e2e/smoke-test/seedlot-dashboard.cy.ts b/frontend/cypress/e2e/smoke-test/seedlot-dashboard.cy.ts index 52615c58b..07e42d68f 100644 --- a/frontend/cypress/e2e/smoke-test/seedlot-dashboard.cy.ts +++ b/frontend/cypress/e2e/smoke-test/seedlot-dashboard.cy.ts @@ -44,7 +44,6 @@ describe('Seedlot Dashboard test', () => { const seedlotNumber = sNumber as string; cy.get(`#seedlot-table-cell-${seedlotNumber}-seedlotSpecies`).should('have.text', species); - cy.get(`#seedlot-table-cell-${seedlotNumber}-seedlotStatus`).should('have.text', 'Incomplete'); }); }); }); diff --git a/frontend/cypress/fixtures/Seedlot_composition_template_02.csv b/frontend/cypress/fixtures/Seedlot_composition_template_02.csv new file mode 100644 index 000000000..97f024cfa --- /dev/null +++ b/frontend/cypress/fixtures/Seedlot_composition_template_02.csv @@ -0,0 +1,3 @@ +Parent Tree number,Cone count,Pollen count,SMP success,Pollen contamination +212,,,1,46 +219,,,2,22 diff --git a/frontend/cypress/fixtures/aclass-reg-form.json b/frontend/cypress/fixtures/aclass-reg-form.json index 2faebe5d1..fd8702b87 100644 --- a/frontend/cypress/fixtures/aclass-reg-form.json +++ b/frontend/cypress/fixtures/aclass-reg-form.json @@ -65,10 +65,10 @@ "coneTitle": "Cone and pollen count", "coneSubtitle": "Enter the cone and pollen count estimate for the orchard's seedlot (*required)", "smpSuccessTitle": "SMP success on parent", - "smpSuccessSubtitle": "Enter the estimative of SMP success for the orchard's seedlot", + "smpSuccessSubtitle": "Enter the SMP success estimate for the orchard's seedlot", "calculationSMPTitle": "Calculation of SMP mix", "calculationSMPSubtitle": "Enter the estimative volume of SMP mix used for each clone", - "smpSuccessCheckboxText": "Enter the same SMP success on parent or Non-orchard pollen contaminant to all parent trees", + "smpSuccessCheckboxText": "Enter the same SMP success on parent or non-orchard pollen contaminant to all parent trees", "coneErrorMsg": "Invalid cone count entries", "pollenErrorMsg": "Invalid pollen count entries", "conePollenErrorMsg": "Invalid cone count and pollen count entries",