Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cypress UI automated test cases #536

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/fabric-operations-console.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Feature: 2.0 Lifecycle Flow
And I clicked the button with text 'Next'
And I clicked the button with text 'Next'
And I clicked the button with text 'Propose'
Then wait "30" seconds
Then the chaincode with name 'fabcar' should have been created in 'Proposed' state

Scenario: Approve Smart Contact as Org2
Expand Down
50 changes: 50 additions & 0 deletions packages/apollo/test/functional/features/9-Misc Cases.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
@saas @software @saas-minimal @mustgather
Feature: Verify miscellaneous cases of console works as expected

Scenario: Run mustgather tool
Given I go to the console
And I am logged in
And I am ready to get started
And I am on Help page
Then wait "2" seconds
And I clicked the button with text 'Start mustgather'
Then wait "30" seconds
And I clicked anchor with text 'Download results'
Then wait "10" seconds
And I clicked the button with text 'Run again'
Then wait "30" seconds
And I clicked the button with xpath "//div[text()='Delete mustgather pod and service']"
Then wait "20" seconds
And I clicked the button with text 'Start mustgather'

Scenario: Import peer, certificate authority, orderer and delete them
Given I go to the console
And I am logged in
And I am ready to get started
And I am on the 'settings' page
And I clicked the button with text 'Export'
And I clicked the button with id 'export_button'
Then wait "5" seconds
And I clicked the button with text 'Import'
And I upload file '/assets/Import/IBP_Import.zip' to 'file-uploader' input
And I clicked the button with id 'import_button'
Then wait "30" seconds
And I am on the 'nodes' page
Then a tile with title 'Peer_Import' should have been created
Then a tile with title 'CA_Import' should have been created
Then a tile with title 'OS_Import' should have been created
And I clicked the tile with title 'Peer_Import'
And I clicked the button with id 'peer_import-sticky-delete-button'
And I provided 'Peer_Import' for the 'Type here' input
And I clicked the button with text 'Remove peer'
Then wait "5" seconds
And I clicked the tile with title 'CA_Import'
And I clicked the button with id 'ca_import-sticky-delete-button'
And I provided 'CA_Import' for the 'Type here' input
And I clicked the button with text 'Remove Certificate Authority'
Then wait "5" seconds
And I clicked the tile with title 'OS_Import'
And I clicked the button with id 'os_import_1-sticky-delete-button'
And I provided 'OS_Import' for the 'Type here' input
And I clicked the button with text 'Remove ordering service'
Then wait "5" seconds
9 changes: 9 additions & 0 deletions packages/cypress/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Automated UI Functional Tests Using Cypress

Please follow below steps to setup / run Cucumber driven Cypress UI automated functional test cases.
1. Clone the repository and navigate to Cypress test directory.
2. To install Cypress, run below command:<br> ```
"npm install cypress --save-dev"```<br>
For more information, please refer the steps mentioned [here](https://docs.cypress.io/guides/getting-started/installing-cypress).
3. Update the config.json file in "fixtures" folder with your console URL and login details before running the test case.
4.
1 change: 1 addition & 0 deletions packages/cypress/cucumber-messages.ndjson
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"testRunStarted":{"timestamp":{"seconds":1696844468,"nanos":527000000}}}
28 changes: 28 additions & 0 deletions packages/cypress/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { defineConfig } from "cypress";
import createBundler from "@bahmutov/cypress-esbuild-preprocessor";
import { addCucumberPreprocessorPlugin } from "@badeball/cypress-cucumber-preprocessor";
import createEsbuildPlugin from "@badeball/cypress-cucumber-preprocessor/esbuild";

export default defineConfig({
e2e: {
specPattern: "**/*.feature",
defaultCommandTimeout: 120000,
viewportWidth: 1200,
viewportHeight: 860,
testIsolation: false,
async setupNodeEvents(
on: Cypress.PluginEvents,
config: Cypress.PluginConfigOptions
): Promise<Cypress.PluginConfigOptions> {
// This is required for the preprocessor to be able to generate JSON reports after each run, and more,
await addCucumberPreprocessorPlugin(on, config);
on("file:preprocessor", createBundler({
plugins: [createEsbuildPlugin(config)],
})
);

// Make sure to return the config object as it might have been modified by the plugin.
return config;
},
},
});
13 changes: 13 additions & 0 deletions packages/cypress/cypress/e2e/features/1-Login.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@support @regression @smoke
Feature: Login feature

Scenario: When entering the default username and password
Given I go to the console
And I am on the login page
When I am logged in for first time
Then I should be asked to change the default password

Scenario: When changing the default username and password
Given I am on the change default password page
When I change the password from default password
Then I should be redirected to the login page again
181 changes: 181 additions & 0 deletions packages/cypress/cypress/e2e/features/2-BuildNetwork.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
@support @regression
Feature: Build a network feature

Background: Login to console
Given I go to the console
And I am logged in
And I am ready to get started

Scenario: When creating a certificate authority for Org1
And I am on the 'nodes' page
And I clicked the button with title 'Add Certificate Authority'
And I clicked Create a Certificate Authority
And I clicked the button with id 'next'
And I provided 'Org1 CA' for the 'Enter a CA display name' input
And I provided 'admin' for the 'Enter enroll ID' input
And I provided 'adminpw' for the 'Enter enroll secret' input
And I clicked the button with id 'next'
And I clicked the button with id 'submit'
Then wait "5" seconds
Then I should see a success toast with class '.bx--toast-notification__subtitle' which says "Congratulations! You have successfully created 'Org1 CA'."
And the certificate authority with name 'Org1 CA' should have started successfully

Scenario: When associating and enrolling identities for Org1 CA
And I am on the 'nodes' page
And I clicked the 'Org1 CA' certificate authority
And I clicked the button with id 'no-identity-button'
And I provided 'admin' for the 'Enter an ID' input
And I provided 'adminpw' for the 'Enter a secret' input
And I provided 'Org1 CA Admin' for the 'Enter a name' input
And I clicked the button with id 'associate_identity'
And the CA admin is set as 'Org1 CA Admin'
Then wait "3" seconds
When the 'admin' user was enrolled with id 'org1admin' and secret 'org1adminpw'
Then wait "3" seconds
And the 'peer' user was enrolled with id 'peer1' and secret 'peer1pw'
Then wait "10" seconds
Then the 'admin' user with id 'org1admin' should be enrolled
And the 'peer' user with id 'peer1' should be enrolled

Scenario: When creating an organization MSP definition for Org1
And I am on the 'organizations' page
And I clicked the button with title 'Create MSP definition'
And I provided 'Org1 MSP' for the 'Enter name for the MSP' input
And I provided 'org1msp' for the 'Enter the MSP ID' input
And I clicked the span with text 'Next'
And I clicked the button with title 'Select a root Certificate Authority'
And I clicked the div with text 'Org1 CA'
And wait "3" seconds
And I clicked the span with text 'Next'
And I clicked the button with title 'org1admin'
And I clicked the div with text 'org1admin'
And I provided 'org1adminpw' for the 'Enter a secret' input
And I provided 'Org1 MSP Admin' for the 'Enter name for the identity to be stored in your Wallet' input
And I clicked the button with text 'Generate'
And I clicked the button with text 'Export'
And I clicked the button with text 'Next'
And I click Create MSP definition button
Then I should see a success toast with class '.bx--toast-notification__title' which says "MSP Org1 MSP has been created successfully."

Scenario: When creating a peer for Org1
And I am on the 'nodes' page
And I clicked the button with title 'Add peer'
And I clicked Create a peer
And I clicked the button with id 'next'
And I provided 'Peer Org1' for the 'Enter the Peer name' input
And I clicked the button with id 'next'
And I clicked the button with title 'Select CA'
And I clicked the dropdown item 'Org1 CA' with class '.bx--list-box__menu-item__option'
Then wait "2" seconds
And I clicked the button with title 'peer1'
And I clicked the div with text 'peer1'
And I provided 'peer1pw' for the 'Enter a secret' input
And I clicked the button with title 'Select an MSP'
And I clicked the div with text 'Org1 MSP'
And I clicked the button with title 'Select a Fabric version'
And I clicked the div with text '2.2.13-2'
And I clicked the button with id 'next'
And I clicked the button with title 'Please select an identity from your wallet'
And I clicked the div with text 'Org1 MSP Admin'
And I clicked the button with id 'next'
When I clicked the button with id 'submit'
Then wait "6" seconds
Then I should see a success toast with class '.bx--toast-notification__subtitle' which says "Congratulations! You have successfully created 'Peer Org1'"
And the peer with name 'Peer Org1' should have started successfully

Scenario: When creating a certificate authority for the Ordering Service
And I am on the 'nodes' page
And I clicked the button with title 'Add Certificate Authority'
And I clicked Create a Certificate Authority
And I clicked the button with id 'next'
And I provided 'Ordering Service CA' for the 'Enter a CA display name' input
And I provided 'admin' for the 'Enter enroll ID' input
And I provided 'adminpw' for the 'Enter enroll secret' input
And I clicked the button with id 'next'
And I clicked the button with id 'submit'
Then wait "3" seconds
Then I should see a success toast with class '.bx--toast-notification__subtitle' which says "Congratulations! You have successfully created 'Ordering Service CA'."
And the certificate authority with name 'Ordering Service CA' should have started successfully

Scenario: When associating and enrolling identities for Ordering Service CA
And I am on the 'nodes' page
And I clicked the 'Ordering Service CA' certificate authority
And I clicked the button with text 'Associate identity'
And I provided 'admin' for the 'Enter an ID' input
And I provided 'adminpw' for the 'Enter a secret' input
And I provided 'Ordering Service CA Admin' for the 'Enter a name' input
And I clicked the button with id 'associate_identity'
And the CA admin is set as 'Ordering Service CA Admin'
Then wait "3" seconds
When the 'admin' user was enrolled with id 'OSadmin' and secret 'OSadminpw'
Then wait "2" seconds
And the 'orderer' user was enrolled with id 'OS1' and secret 'OS1pw'
Then wait "10" seconds
Then the 'admin' user with id 'OSadmin' should be enrolled
And the 'orderer' user with id 'OS1' should be enrolled
Then wait "2" seconds
And I enroll TLS identity for OS1 with secret 'OS1pw' and name 'TLSOS1'
Then wait "2" seconds

Scenario: When creating an organization MSP definition for Ordering Service
And I am on the 'organizations' page
And I clicked the button with title 'Create MSP definition'
And I provided 'Ordering Service MSP' for the 'Enter name for the MSP' input
And I provided 'osmsp' for the 'Enter the MSP ID' input
Then wait "3" seconds
And I clicked the Next button in Create MSP definition screen
And I clicked the button with title 'Select a root Certificate Authority'
And I clicked the div with text 'Ordering Service CA'
Then wait "5" seconds
And I clicked the Next button in Create MSP definition screen
And I clicked the button with title 'OSadmin'
And I clicked the div with text 'OSadmin'
And I provided 'OSadminpw' for the 'Enter a secret' input
And I provided 'Ordering Service MSP Admin' for the 'Enter name for the identity to be stored in your Wallet' input
And I clicked the button with text 'Generate'
And I clicked the button with text 'Export'
And I clicked the Next button in Create MSP definition screen
And I click Create MSP definition button
Then I should see a success toast with class '.bx--toast-notification__title' which says "MSP Ordering Service MSP has been created successfully."

Scenario: When creating an ordering service with system channel
And I am on the 'nodes' page
And I clicked the button with title 'Add ordering service'
And I clicked Create a Ordering Service
And I clicked the button with id 'next'
Then wait "3" seconds
And I provided 'Ordering Service' for the 'Enter an ordering service display name' input
And I clicked the span with text 'With a system channel'
Then wait "2" seconds
And I clicked the button with id 'next'
Then wait "3" seconds
And I clicked the button with title 'Select CA'
And I clicked the dropdown item 'Ordering Service CA' with class '.bx--list-box__menu-item__option'
Then wait "3" seconds
And I clicked the button with text 'OS1'
And I clicked the dropdown item 'OS1' with class '.bx--list-box__menu-item__option'
And I provided 'OS1pw' for the 'Enter a secret' input
And I clicked the button with title 'Select an MSP'
And I clicked the dropdown item 'Ordering Service MSP' with class '.bx--list-box__menu-item__option'
And I clicked the button with title 'Select a Fabric version'
And I clicked the dropdown item '2.2.13-2' with class '.bx--list-box__menu-item__option'
And I clicked the button with id 'next'
Then wait "2" seconds
And I clicked the button with title 'Please select an identity from your wallet'
And I clicked the dropdown item 'Ordering Service MSP Admin' with class '.bx--list-box__menu-item__option'
And I clicked the button with id 'next'
When I clicked the button with id 'submit'
Then wait "6" seconds
Then I should see a success toast with class '.bx--toast-notification__subtitle' which says "Congratulations! You have successfully created 'Ordering Service'."
And the orderer with name 'Ordering Service' should have started successfully

Scenario: Add Org1 to consortium
And I am on the 'nodes' page
And I clicked the 'Ordering Service' orderer
Then wait "10" seconds
And I clicked the button with title 'Add organization'
And I clicked the button with title 'Ordering Service MSP (osmsp)'
And I clicked the dropdown item 'Org1 MSP (org1msp)' with class '.bx--list-box__menu-item__option'
When I clicked the button with id 'submit'
Then wait "10" seconds
Then a tile with title 'Org1 MSP' should have been created
Loading
Loading