Skip to content

Commit

Permalink
fix: cypress tests
Browse files Browse the repository at this point in the history
  • Loading branch information
craigyu committed Aug 1, 2024
1 parent 0b7c4f3 commit 69d8b2e
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ describe('A Class Seedlot Registration form, Orchard', () => {
});

it('Orchard dropdown section', () => {
cy.get('#orchard-combobox-0')
cy.get('#primary-orchard-selection')
.siblings(`button.${prefix}--list-box__menu-icon[title="Open"]`)
.click();

Expand Down Expand Up @@ -110,7 +110,7 @@ describe('A Class Seedlot Registration form, Orchard', () => {
.contains('Orchard')
.click();

cy.get('#orchard-combobox-0')
cy.get('#primary-orchard-selection')
.siblings(`button.${prefix}--list-box__selection[title="Clear selected item"]`)
.as('cancelOrchard')
.click();
Expand Down Expand Up @@ -138,11 +138,11 @@ describe('A Class Seedlot Registration form, Orchard', () => {
.contains('Change orchard')
.click();

cy.get('#orchard-combobox-0')
cy.get('#primary-orchard-selection')
.should('have.value', '');

// Add orchard from dropdown
cy.get('#orchard-combobox-0')
cy.get('#primary-orchard-selection')
.siblings(`button.${prefix}--list-box__menu-icon[title="Open"]`)
.click();

Expand All @@ -156,10 +156,10 @@ describe('A Class Seedlot Registration form, Orchard', () => {
.contains('Add additional orchard')
.click();

cy.get(`label.${prefix}--label[for="orchard-combobox-1"]`)
cy.get(`label.${prefix}--label[for="secondary-orchard-selection"]`)
.should('have.text', regFormData.orchard.additionalOrchardLabel);

cy.get('#orchard-combobox-1')
cy.get('#secondary-orchard-selection')
.siblings(`button.${prefix}--list-box__menu-icon[title="Open"]`)
.click();

Expand All @@ -181,10 +181,10 @@ describe('A Class Seedlot Registration form, Orchard', () => {
.contains('Orchard')
.click();

// Delete additional orchard
// Delete secondary orchard
cy.get('.seedlot-orchard-add-orchard')
.find('button')
.contains('Delete additional orchard')
.contains('Delete secondary orchard')
.as('deleteOrchard')
.click();

Expand All @@ -205,27 +205,27 @@ describe('A Class Seedlot Registration form, Orchard', () => {
cy.get('@deleteOrchard')
.click();

// Check 'Delete additional orchard' button of change orchard modal
// Check 'Delete secondary orchard' button of change orchard modal
cy.get(`.${prefix}--modal-container[aria-label="Delete orchard"]`)
.find(`button.${prefix}--btn`)
.contains('Delete additional orchard')
.contains('Delete secondary orchard')
.click();

cy.get('#orchard-combobox-1')
cy.get('#secondary-orchard-selection')
.should('not.exist');

cy.get('@cancelOrchard')
.click();

cy.get('#orchard-combobox-0')
cy.get('#primary-orchard-selection')
.should('have.value', '');

// Save changes
cy.saveSeedlotRegFormProgress();
});

it('store first Orchard Parent Tree Number in an array', () => {
cy.get('#orchard-combobox-0')
cy.get('#primary-orchard-selection')
.siblings(`button.${prefix}--list-box__menu-icon[title="Open"]`)
.click();

Expand Down Expand Up @@ -272,7 +272,7 @@ describe('A Class Seedlot Registration form, Orchard', () => {
.click();

// Cancel orchard
cy.get('#orchard-combobox-0')
cy.get('#primary-orchard-selection')
.siblings(`button.${prefix}--list-box__selection[title="Clear selected item"]`)
.click();

Expand All @@ -281,7 +281,7 @@ describe('A Class Seedlot Registration form, Orchard', () => {
.contains('Change orchard')
.click();

cy.get('#orchard-combobox-0')
cy.get('#primary-orchard-selection')
.should('have.value', '');

// Save changes
Expand All @@ -290,7 +290,7 @@ describe('A Class Seedlot Registration form, Orchard', () => {

it('store second Orchard Parent Tree Number in an array', () => {
// Enter new orchard
cy.get('#orchard-combobox-0')
cy.get('#primary-orchard-selection')
.siblings(`button.${prefix}--list-box__menu-icon[title="Open"]`)
.click();

Expand Down Expand Up @@ -336,7 +336,7 @@ describe('A Class Seedlot Registration form, Orchard', () => {
.click();

// Cancel orchard
cy.get('#orchard-combobox-0')
cy.get('#primary-orchard-selection')
.siblings(`button.${prefix}--list-box__selection[title="Clear selected item"]`)
.click();

Expand All @@ -345,15 +345,15 @@ describe('A Class Seedlot Registration form, Orchard', () => {
.contains('Change orchard')
.click();

cy.get('#orchard-combobox-0')
cy.get('#primary-orchard-selection')
.should('have.value', '');

// Save changes
cy.saveSeedlotRegFormProgress();
});

it('Linkage of Step 4 and Step 5', () => {
cy.get('#orchard-combobox-0')
cy.get('#primary-orchard-selection')
.siblings(`button.${prefix}--list-box__menu-icon[title="Open"]`)
.click();

Expand All @@ -368,7 +368,7 @@ describe('A Class Seedlot Registration form, Orchard', () => {
.contains('Add additional orchard')
.click();

cy.get('#orchard-combobox-1')
cy.get('#secondary-orchard-selection')
.siblings(`button.${prefix}--list-box__menu-icon[title="Open"]`)
.click();

Expand Down
4 changes: 2 additions & 2 deletions frontend/src/__test__/components/OrchardStep.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,11 @@ describe.skip('Orchard Step test', () => {
});
});

it('should show and click Delete additional orchard button', () => {
it('should show and click Delete secondary orchard button', () => {
const addButton = screen.getByText('Add orchard');
fireEvent.click(addButton);

const deleteButton = screen.getByText('Delete additional orchard');
const deleteButton = screen.getByText('Delete secondary orchard');
fireEvent.click(deleteButton);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const modalConfig: orchardModalOptions = {
label: 'Delete orchard',
title: 'Are you sure you want to delete the additional orchard? If yes, then you will lose the parent tree and SMP information in Step 5',
buttons: {
primary: 'Delete additional orchard',
primary: 'Delete secondary orchard',
secondary: 'Cancel'
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const orchardStepText = {
},
buttons: {
add: 'Add additional orchard',
delete: 'Delete additional orchard'
delete: 'Delete secondary orchard'
}
},
gameteSection: {
Expand Down

0 comments on commit 69d8b2e

Please sign in to comment.