From 93552b19f0c2126198e7ed6077b537e50e42a435 Mon Sep 17 00:00:00 2001 From: Ketul Shah Date: Thu, 30 Nov 2023 19:34:41 +0530 Subject: [PATCH] added testcase for 2.0 channel update (#566) Signed-off-by: Ketul Shah --- .../05-Install20SmartContract.feature | 52 ++++++++++++++++++- ...9-BuildANetwork_Without_SysChannel.feature | 47 +++++++++++++++++ .../step_definitions/navigation_steps.js | 10 ++++ 3 files changed, 108 insertions(+), 1 deletion(-) diff --git a/packages/apollo/test/cypress/e2e/features/05-Install20SmartContract.feature b/packages/apollo/test/cypress/e2e/features/05-Install20SmartContract.feature index d11b11e3..c5d8d960 100644 --- a/packages/apollo/test/cypress/e2e/features/05-Install20SmartContract.feature +++ b/packages/apollo/test/cypress/e2e/features/05-Install20SmartContract.feature @@ -6,7 +6,7 @@ Feature: 2.0 Lifecycle Flow And I am logged in And I am ready to get started - # Cypress launches new test runner / browser with clean state and that clears wallet that we store in browser local storage + # Cypress launches new test runner / browser with clean state and that clears wallet that we store in browser local storage # https://github.com/cypress-io/cypress/issues/28186#issuecomment-1787344347 # Hence, we need to import required identities in begining of each feature file Scenario: Setting up the identities @@ -130,3 +130,53 @@ Feature: 2.0 Lifecycle Flow And I clicked the div with text 'Org1 MSP Admin' And I clicked the button with text 'Commit smart contract' Then the chaincode with name 'fabcar' should have been created in 'Committed' state + + Scenario: Updating channel2 as Org2 + And I am on the 'channels' page + And I clicked the div with id 'ibp-tile-channel2' + Then wait "5" seconds + And I clicked the button with id 'channel2-sticky-settings-button' + And I clicked the button with title 'Select the MSP' + And I clicked the div with text 'Org2 MSP (org2msp)' + And I clicked the button with title 'Select an identity' + And I clicked the div with text 'Org2 MSP Admin' + Then wait "1" seconds + And I clicked the span with text 'Next' + And I clicked the span with text 'Next' + And I clicked the span with text 'Next' + And I clicked the span with text 'Next' + And I clicked the span with text 'Next' + And I clicked the span with text 'Next' + And I provided '13' for input field with id 'channelModal-block-params-absolute_max_bytes_mb-input-for-slider' + And I provided '510' for input field with id 'channelModal-block-params-max_message_count-input-for-slider' + And I clicked the span with text 'Next' + And I clicked the span with text 'Next' + And I clicked the span with text 'Next' + And I clicked the span with text 'Next' + And I clicked the button with title 'Select the MSP' + And I clicked the div with text 'Ordering Service MSP (osmsp)' + And I clicked the span with text 'Next' + And I clicked the span with text 'Next' + And I clicked the span with text 'Update channel' + Then I should see a success toast with class '.bx--toast-notification__title' which says 'You have successfully initiated a request to update channel channel2.' + # View channel configuration updates + When I clicked the button with id 'ibp-header-signature-collection-icon' + And I clicked element with class '.ibp-signature-collection-notification-link-text' + Then the element div with text 'Updated in channel configuration' should be visible on page + Then the element div with text 'Block cutting parameters' should be visible on page + And I clicked the button with id 'next' + And I clicked the button with title 'Select identity to sign with' + And I clicked the div with text 'Ordering Service MSP Admin' + And I clicked the button with id 'submit' + # Review and update channel configuration + And I clicked element with class '.ibp-signature-collection-notification-link-text' + Then the element div with text 'Updated in channel configuration' should be visible on page + Then the element div with text 'Block cutting parameters' should be visible on page + And I clicked the button with id 'next' + And I clicked the button with title 'Select MSP' + And I clicked the div with text 'Org2 MSP' + Then wait "1" seconds + And I clicked the button with title 'Select an identity' + And I clicked the div with text 'Org2 MSP Admin' + And I clicked the button with id 'submit' + Then the element div with text 'No approval notifications' should be visible on page diff --git a/packages/apollo/test/cypress/e2e/features/09-BuildANetwork_Without_SysChannel.feature b/packages/apollo/test/cypress/e2e/features/09-BuildANetwork_Without_SysChannel.feature index 66fab07a..d5dead86 100644 --- a/packages/apollo/test/cypress/e2e/features/09-BuildANetwork_Without_SysChannel.feature +++ b/packages/apollo/test/cypress/e2e/features/09-BuildANetwork_Without_SysChannel.feature @@ -237,3 +237,50 @@ Feature: Build a network without system channel And I clicked the div with text 'Org1 MSP Admin' And I clicked the button with text 'Commit smart contract' Then the chaincode with name 'fabcar' should have been created in 'Committed' state + + Scenario: Updating channel5 as Org2 + And I am on the 'channels' page + And I clicked the div with id 'ibp-tile-channel5' + Then wait "5" seconds + And I clicked the button with id 'channel5-sticky-settings-button' + And I clicked the button with title 'Select the MSP' + And I clicked the div with text 'Org2 MSP (org2msp)' + And I clicked the button with title 'Select an identity' + And I clicked the div with text 'Org2 MSP Admin' + Then wait "1" seconds + And I clicked the span with text 'Next' + And I clicked the span with text 'Next' + And I clicked the span with text 'Next' + And I clicked the span with text 'Next' + And I clicked the span with text 'Next' + And I clicked the span with text 'Next' + And I provided '13' for input field with id 'channelModal-block-params-absolute_max_bytes_mb-input-for-slider' + And I provided '510' for input field with id 'channelModal-block-params-max_message_count-input-for-slider' + And I clicked the span with text 'Next' + And I clicked the button with title 'Select the MSP' + And I clicked the div with text 'Ordering Service MSP (osmsp)' + And I clicked the span with text 'Next' + And I clicked the span with text 'Next' + And I clicked the span with text 'Update channel' + Then I should see a success toast with class '.bx--toast-notification__title' which says 'You have successfully initiated a request to update channel channel5.' + # View channel configuration updates + When I clicked the button with id 'ibp-header-signature-collection-icon' + And I clicked element with class '.ibp-signature-collection-notification-link-text' + Then the element div with text 'Updated in channel configuration' should be visible on page + Then the element div with text 'Block cutting parameters' should be visible on page + And I clicked the button with id 'next' + And I clicked the button with title 'Select identity to sign with' + And I clicked the div with text 'Ordering Service MSP Admin' + And I clicked the button with id 'submit' + # Review and update channel configuration + And I clicked element with class '.ibp-signature-collection-notification-link-text' + Then the element div with text 'Updated in channel configuration' should be visible on page + Then the element div with text 'Block cutting parameters' should be visible on page + And I clicked the button with id 'next' + And I clicked the button with title 'Select MSP' + And I clicked the div with text 'Org2 MSP' + Then wait "1" seconds + And I clicked the button with title 'Select an identity' + And I clicked the div with text 'Org2 MSP Admin' + And I clicked the button with id 'submit' + Then the element div with text 'No approval notifications' should be visible on page diff --git a/packages/apollo/test/cypress/support/step_definitions/navigation_steps.js b/packages/apollo/test/cypress/support/step_definitions/navigation_steps.js index 3123af0b..48b97f74 100644 --- a/packages/apollo/test/cypress/support/step_definitions/navigation_steps.js +++ b/packages/apollo/test/cypress/support/step_definitions/navigation_steps.js @@ -84,3 +84,13 @@ Then(/^the div with id (?:'|")(.*?)(?:'|") does not exist on page$/, value => { cy.wait(1000) cy.get(`div[id="${value}"]`).should('not.exist'); }); + +Given(/^the element (div|span) with text (?:'|")(.*?)(?:'|") should be visible on page$/, (property, value) => { + cy.wait(500) + cy.get(property).contains(value).should('be.visible') +}); + +Given(/^I clicked element with class (?:'|")(.*?)(?:'|")$/, (className) => { + cy.wait(500) + cy.get(className).should('be.visible').click() + });