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

E2 e tests local #375

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
33 changes: 19 additions & 14 deletions .github/workflows/e2e-cypress-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,13 @@ on:

jobs:
cypress-run:
runs-on: ubuntu-latest
name: E2E on Chrome
runs-on: ${{ matrix.os }}
name: E2E on ${{ matrix.os }} with ${{ matrix.browser }}

strategy:
matrix:
os: [ubuntu-latest]
browser: [chrome, firefox, edge]

steps:
# Step 1: Checkout repo
Expand Down Expand Up @@ -58,7 +63,7 @@ jobs:
CI=false yarn build

# Step 6: Removing license file for the new build
- name: Remove old build files
- name: Remove new license file
run: |
find backend/src/zango/assets/app_panel/js -name "build.*.min.js.LICENSE.txt" -type f -delete

Expand All @@ -80,7 +85,7 @@ jobs:
id: start-time
run: echo "START_TIME=$(date +%s)" >> $GITHUB_ENV

# Step 9: Install cypress dependencies
# Step 9: Install cypress dependencies
- name: Install cypress dependencies
run: npm install
working-directory: e2e-tests
Expand All @@ -89,7 +94,7 @@ jobs:
- name: Run Cypress tests
uses: cypress-io/github-action@v6
with:
browser: chrome
browser: ${{ matrix.browser }}
working-directory: e2e-tests
continue-on-error: true

Expand All @@ -108,7 +113,7 @@ jobs:
DURATION="${DURATION_MINUTES}m ${DURATION_REMAINDER_SECONDS}s"
echo "DURATION=${DURATION}" >> $GITHUB_ENV

#Step 13: Extracting zango version
# Step 13: Extracting zango version
- name: Extract Version
id: extract_version
run: |
Expand All @@ -123,33 +128,33 @@ jobs:
node cucumber-html-report.js
working-directory: e2e-tests
env:
BROWSER_NAME: chrome
BROWSER_VERSION: "127"
BROWSER_NAME: ${{ matrix.browser }}
BROWSER_VERSION: "127" # Adjust this if needed
DEVICE_NAME: "Remote Device"
PLATFORM_NAME: "Ubuntu"
PLATFORM_VERSION: "22.04.4"
PLATFORM_NAME: ${{ matrix.os }}
PLATFORM_VERSION: ${{ matrix.os == 'ubuntu-latest' && '22.04.4'}}
CI_ENVIRONMENT: "GitHub Actions"

# Step 15: Upload Cypress screenshots
- name: Upload Cypress screenshots
uses: actions/upload-artifact@v3
with:
name: cypress-screenshots
name: cypress-${{ matrix.os }}-${{ matrix.browser }}-screenshots
path: e2e-tests/cypress/screenshots
if-no-files-found: ignore

# Step 16: Upload Cypress videos
- name: Upload Cypress videos
uses: actions/upload-artifact@v3
with:
name: cypress-videos
name: cypress-${{ matrix.os }}-${{ matrix.browser }}-videos
path: e2e-tests/cypress/videos
if-no-files-found: ignore

# Step 17: Upload Cucumber HTML Report
- name: Upload Cucumber HTML Report
uses: actions/upload-artifact@v3
with:
name: cucumber-html-report
name: cucumber-html-report on ${{ matrix.os }}-${{ matrix.browser }}
path: e2e-tests/reports/cucumber-html-report.html
if-no-files-found: ignore
if-no-files-found: ignore
2 changes: 1 addition & 1 deletion e2e-tests/cucumber-html-report.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ report.generate({
{ label: "Project", value: "Zango e2e-Tests Report" },
{ label: "Zango Version", value: process.env.ZANGO_VERSION },
{ label: "Execution Date Time", value: executionDateTime },
{ label: "Execution Environment", value: process.env.CI_ENVIRONMENT },
{ label: "Platform", value: process.env.PLATFORM_NAME },
{ label: "Execution Duration", value: process.env.DURATION },
],
},
Expand Down
2 changes: 0 additions & 2 deletions e2e-tests/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ module.exports = defineConfig({
setupNodeEvents(on, config) {
on("file:preprocessor", cucumber());
},
// specPattern: "**/*.feature",
specPattern: "cypress/e2e/**/*.feature",
// specPattern: "cypress/e2e/**/*.cy.{js,jsx,ts,tsx}",
},
});
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
Feature: App Launch and Validation
Background: Navigate to the home page of App Panel
Given Admin logins successfully and lands on the home page of App panel

Scenario: App Launch with valid data
Given Admin logins successfully and lands on the home page of App panel
When Admin clicks on the app launch button on homepage
And Admin fills the app launch form with the valid data and submits the form
Then App should be successfully Launched and also the Api response should have message "App Launch Initiated Successfully" and status code 200

Scenario: App launch with invalid data
When Admin clicks on the app launch button on homepage
And Admin fills the app launch form with the invalid data and submits the form
Then Error message for invalid app name should be displayed and status code of api response should be 500

Scenario: App launch with existing app data
When Admin clicks on the app launch button on homepage
And Admin fills the app launch form with the valid data and submits the form
Then Error message for duplication app name should be displayed and status code of api response should be 500

2 changes: 2 additions & 0 deletions e2e-tests/cypress/e2e/featureFiles/3_userFeature/user.feature
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ Feature: User Creation and Validation
Then User should be successfully addded and admin should be redirected to the table view
And Admin also wants to assert the Api response post user addition
Then Api response post user creation should have message "App User created successfully." and status code 200

Scenario: Required fields validation for user form
When Admin clicks on the new user button on the user page
And Admin skips the mandatory fields on user form
Then Required field error message for user from should be displayed

Scenario: User creation with existing user name
When Admin clicks on the new user button on the user page
And Admin fills up the user form with valid data and submits the form
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,23 @@ Feature: User Api Assertions
Scenario: Api assertion post landing on user tab
And Validate the user tab URL
Then Api response post landing on user tab should have message "Users fetched successfully" and status code 200

Scenario: Api assertion post search
When Admin clicks on the user table search button and Enters the valid data
Then Api response post search should have message "Users fetched successfully" total records should be 1 and status code 200 in user table

Scenario: Api assertion for deactivating the user
When Admin clicks on the user table search button and Enters the valid data
And Admin clicks on the deactivate user button under the three dots menu
And Api response post update should have message "App User updated successfully." and status code 200
Then Post deactivation user should get deactivated

Scenario: Api assertion for activating the user
When Admin clicks on the user table search button and Enters the valid data
And Admin clicks on the activate user button under the three dots menu
And Api response post update should have message "App User updated successfully." and status code 200
Then Post activation user should get activated

# Scenario: Admin wants to update the user and also assert the api response
# When Admin clicks on the user table search button and Enters the valid data
# And Admin clicks on the edit user button under the three dots menu
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Feature: Policy Management
Background: Navigate to the Policies Tab
Given User navigates to policies tab

Scenario: Admin wants to verify that all the policies are loaded
When Validate the policies tab URL
And Policy table should contain the following columns
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Feature: Task Management
Scenario: Admin wants to sync the tasks
When Admin clicks on the sync task button
Then Api response post syncing tasks should have message "Tasks synced successfully" and status code 200

Scenario: Admin wants to verify that all the tasks are loaded
When Validate the task tab URL
And Task table should contain the following columns
Expand Down
37 changes: 19 additions & 18 deletions e2e-tests/cypress/e2e/featureFiles/6_packageFeature/package.feature
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
Feature: Package Management
Background: Navigate to the Package Tab
Given User navigates to Package tab
@focus

Scenario: Admin wants to verify the contents of package tab
When Validate the Package tab URL
And Validate the Package tab URL
And Package table should contain the following columns
| Column_1 | Column_2 | Column_3 | Column_4 |
| Package Name | Version | Status | Status |
Then Api response post landing on Package tab should have status code 200

# Scenario Outline:Admin wants to install the packages
# When Admin clicks on the package table search button and Enters the "<packages>"
# And Admin clicks on the install package button under the three dots menu
# And Install package form should contain following fields
# | field_name_1 | field_name_2 |
# | Package Name | Version |
# And Admin selects the version and submits the form
# Then Api response post installation should have message "Package Installed" and status code 200

# Examples:
# | packages |
# | communication |
# | crud |
# | frame |
# | login |
# | workflow |
Scenario Outline: Admin wants to install the packages
When Admin clicks on the package table search button and Enters the "<packages>"
And Admin clicks on the install package button under the three dots menu
And Install package form should contain following fields
| field_name_1 | field_name_2 |
| Package Name | Version |
And Admin selects the version and submits the form
Then Api response post package installation should have message "Package Installed" and status code 200
And Validate the Package tab URL
Then Verify if the package is installed successfully
Examples:
| packages |
| communication |
| crud |
| frame |
| login |
| workflow |
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Feature: Platform User Management
Background: Navigates to the application platform
Given Admin navigates to the user management tab and gets the platform user data from fixtures

Scenario: New platform user creation by the admin
When Admin clicks on the new user button on the user management page
And Admin creates the dynamic data of the platform user
And Add platform user form is dispalyed with the following fields
| field_name_1 | field_name_2 | field_name_3 | field_name_4 |
| Full Name | Email | Password | Apps Access |
And Admin fills up the platform user form with valid data and submits the form
Then Platform User should be successfully added and admin should be redirected to the table view
And Admin also wants to assert the Api response post platform user creation
Then Api response post platform user creation should have message "Platform User created successfully." and status code 200

Scenario: Required fields validation for platform user form
When Admin clicks on the new user button on the user management page
And Admin skips the mandatory fields on the platform user form
Then Required field error message should be displayed on the platform user form

Scenario: Platform User creation with existing platform user name
When Admin clicks on the new user button on the user management page
And Admin fills up the platform user form with valid data and submits the form
Then Error message for duplication of platform user management should be displayed

Scenario: Table data validation post platform user creation
When Admin wants to validate the user management tab URL
And User management table should contain the following columns
| Column_1 | Column_2 | Column_3 | Column_4 | Column_5 |
| User Id | User Name Active/inactive | Email | Apps Access | Last Login / Date Joined |
And Admin clicks on the user management table search button and Enters the valid data
Then User management table row should contain the valid data
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Feature: Platform User Management API Assertions
Background:Navigates to the application platform
Given Admin navigates to the user management tab and gets the platform user data from fixtures

Scenario: Api assertion post landing on user management tab
When Admin lands on the user management tab
Then Api response post landing on user management tab should have message "Platform user fetched successfully" and status code 200

Scenario: Api assertion post user management search
When Admin clicks on the user management table search button and Enters the valid data
Then Api response post search should have message "Platform user fetched successfully" total records should be 1 and status code 200 in platform user table

Scenario: Api assertion for deactivating the user management
When Admin clicks on the user management table search button and Enters the valid data
And Admin clicks on the deactivate platform user button under the three dots menu
And Api response post platform user update should have message "Platform User updated successfully." and status code 200
Then Post deactivation platform user should get deactivated

Scenario: Api assertion for activating the user management
When Admin clicks on the user management table search button and Enters the valid data
And Admin clicks on the activate platform user button under the three dots menu
And Api response post platform user update should have message "Platform User updated successfully." and status code 200
Then Post activation platform user should get activated

Scenario: Admin wants to reset the platform user password and also assert the api response
When Admin clicks on the user management table search button and Enters the valid data
And Admin clicks on the reset platform user button under the three dots menu
And Admin resets the platform user password with the valid data
Then Api response post platform user update should have message "Platform User updated successfully." and status code 200

Scenario: Admin wants to update the platform user and also assert the api response
When Admin clicks on the user management table search button and Enters the valid data
And Admin clicks on the edit platform user button under the three dots menu
And Admin updates the platform user form with the valid data
Then Api response post platform user update should have message "Platform User updated successfully." and status code 200
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Feature: Platform User Login Management
Background: User Navigates to the application URL
Given Platform user navigates to the application URL

Scenario: Platform user logs into the system
When Platform user validates the application URL
And Platform user login form is dispalyed with the following fields
| field_name_1 | field_name_2 |
| Enter Username | Email Password |
And Platform user fills the login form with the valid details and click on the submit button
Then Platform user should be successfully logged in and should be redirected to the application platform

Scenario: Api assertion post platform user logs in
When Platform user fills the login form with the valid details and click on the submit button
Then Post logging into the application platform user should be activated

Scenario: Api assertion post landing on the application platform
When Platform user fills the login form with the valid details and click on the submit button
Then Api response post landing on application platform should have message "All apps fetched successfully" and status code 200
38 changes: 36 additions & 2 deletions e2e-tests/cypress/e2e/stepDefinitions/appLaunch.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ let appData = "";
Given(
"Admin logins successfully and lands on the home page of App panel",
() => {
cy.login("[email protected]", "Zango@123");
const dynamicData = {
app_name: `app_${Math.floor(Math.random() * 10000)}`, //To create random text
invalid_app_name: `app ${Math.floor(Math.random() * 10000)}`,
app_description: `app_${Math.floor(Math.random() * 10000)}`, //To create random text
domain_url: `https://test${Math.floor(Math.random() * 10000)}.com`,
// Add more fields as needed
Expand All @@ -26,6 +26,7 @@ Given(
);

When("Admin clicks on the app launch button on homepage", () => {
cy.login("[email protected]", "Zango@123");
appPanelPageObjects
.getAppLaunchButton()
.should("contain", "Launch New App")
Expand All @@ -39,11 +40,21 @@ And(
appPanelPageObjects.getTextField().type(appData.app_name);
appPanelPageObjects.getTextArea().type(appData.app_description);
appPanelPageObjects.getSubmitButton().click();
cy.wait(5000);
cy.wait(3000);
cy.log("App Launched");
}
);

And(
"Admin fills the app launch form with the invalid data and submits the form",
() => {
cy.intercept("POST", "/api/v1/apps/").as("getAppData");
appPanelPageObjects.getTextField().type(appData.invalid_app_name);
appPanelPageObjects.getTextArea().type(appData.app_description);
appPanelPageObjects.getSubmitButton().click();
}
);

Then(
"App should be successfully Launched and also the Api response should have message {string} and status code {int}",
(message, statusCode) => {
Expand All @@ -65,3 +76,26 @@ Then(
});
}
);

Then(
"Error message for duplication app name should be displayed and status code of api response should be {int}",
(statusCode) => {
cy.wait("@getAppData").then((intercept) => {
expect(intercept.response.statusCode).to.eq(statusCode);
});
appPanelPageObjects.getErrorMessage().should("contain", "already exists");
appPanelPageObjects.getGoBackButton().click();
}
);
Then(
"Error message for invalid app name should be displayed and status code of api response should be {int}",
(statusCode) => {
cy.wait("@getAppData").then((intercept) => {
expect(intercept.response.statusCode).to.eq(statusCode);
});
appPanelPageObjects
.getErrorMessage()
.should("contain", "['Invalid string used for the Tenant Name']");
appPanelPageObjects.getGoBackButton().click();
}
);
Loading
Loading