From 340fec113cade3fe00a3a1f881d449524489dbe9 Mon Sep 17 00:00:00 2001 From: Shyam Panjiyar Date: Mon, 13 Jan 2025 17:43:36 +0530 Subject: [PATCH] test: Deleting logo Management to execute from Open Source (#5682) Deleting logo Management to execute from enterprise ## Summary by CodeRabbit - **Removed Features** - Removed logo management test suite and associated page objects - Eliminated methods for updating custom logo text and uploading logos in management page - **Impact** - Logo management testing functionality has been completely removed from the test suite - No current capability to test logo-related operations --- tests/ui-testing/pages/logoManagementPage.js | 83 ------------------- tests/ui-testing/pages/managementPage .js | 43 +--------- .../playwright-tests/logoManagement.spec.js | 61 -------------- 3 files changed, 1 insertion(+), 186 deletions(-) delete mode 100644 tests/ui-testing/pages/logoManagementPage.js delete mode 100644 tests/ui-testing/playwright-tests/logoManagement.spec.js diff --git a/tests/ui-testing/pages/logoManagementPage.js b/tests/ui-testing/pages/logoManagementPage.js deleted file mode 100644 index 7d7b6508a8..0000000000 --- a/tests/ui-testing/pages/logoManagementPage.js +++ /dev/null @@ -1,83 +0,0 @@ -import { expect } from '@playwright/test'; - -export const path = require('path'); -export - class LogoManagementPage { - - constructor(page) { - this.page = page; - - this.homeIcon = page.locator("[name ='home']"); - this.managementMenuItem = page.locator('[data-test="menu-link-settings-item"]'); - this.submitButton = page.locator('[data-test="dashboard-add-submit"]'); // Add appropriate data-test attribute - this.editLogoTextButton = page.locator('[data-test="settings_ent_logo_custom_text_edit_btn"]'); - this.customLogoTextBox = page.locator('[data-test="settings_ent_logo_custom_text"]'); - this.customLogoText = page.locator("[aria-label ='Custom Logo Text']"); - this.saveButton = page.locator('[data-test="settings_ent_logo_custom_text_save_btn"]'); - this.deleteLogoButton = page.locator('[data-test="setting_ent_custom_logo_img_delete_btn"]'); - this.confirmDeleteButton = page.locator('[data-test="logs-search-bar-confirm-dialog-ok-btn"]'); - this.fileUploadInput = page.locator('input[data-test="setting_ent_custom_logo_img_file_upload"]'); - } - - async navigateToManagement() { - await this.page.waitForSelector("[name ='home']"); - await this.homeIcon.hover(); - await this.page.waitForSelector('[data-test="menu-link-settings-item"]'); - await this.managementMenuItem.click({ force: true }); - } - - async goToManagement() { - await this.managementMenuItem.click({ force: true }); - await expect(this.page.getByRole('main')).toContainText('Management'); - } - - async managementPageDefaultMultiOrg() { - await this.page.locator('[data-test="navbar-organizations-select"]').getByText('arrow_drop_down').click(); - await this.page.getByRole('option', { name: 'defaulttestmulti' }).locator('div').nth(2).click(); - } - - async managementPageURLValidation() { - await expect(this.page).toHaveURL(/defaulttestmulti/); - } - - async managementURLValidation() { - await expect(this.page).toHaveURL(/settings/); - } - - async clickSaveSubmit() { - await this.submitButton.waitFor({ state: 'visible' }); - await this.submitButton.click({ force: true }); - } - - - async updateCustomLogoText(text) { - const isVisible = await this.editLogoTextButton.isVisible(); - if (isVisible) { - await this.page.locator('[data-test="settings_ent_logo_custom_text_edit_btn"]').click(); - } - await expect(this.page.getByText('Unauthorized Access')).not.toBeVisible(); - await this.customLogoTextBox.click(); - await expect(this.page.getByText('Unauthorized Access')).not.toBeVisible(); - await this.customLogoTextBox.fill(text); - await this.page.waitForSelector('[data-test="settings_ent_logo_custom_text_save_btn"]'); - await this.saveButton.click({ force: true }); -} - async uploadLogo(filePath) { - const isVisible = await this.deleteLogoButton.isVisible(); - if (isVisible) { - await this.page.waitForSelector('[data-test="setting_ent_custom_logo_img_delete_btn"]'); - await this.deleteLogoButton.click({ force: true }); - await this.page.waitForSelector('[data-test="logs-search-bar-confirm-dialog-ok-btn"]'); - await this.confirmDeleteButton.click({ force: true }); - } - await this.page.goto(process.env["ZO_BASE_URL"] + "/web/settings/general?org_identifier=default"); - await this.page.waitForSelector('[data-test="setting_ent_custom_logo_img_file_upload"]'); - await this.page.setInputFiles('input[ data-test="setting_ent_custom_logo_img_file_upload"]', filePath); - await expect(this.page.getByText("Logo updated successfully")).toBeVisible({ - timeout: 30000, - }); - - - } -} - diff --git a/tests/ui-testing/pages/managementPage .js b/tests/ui-testing/pages/managementPage .js index f99cc4b10e..c455391790 100644 --- a/tests/ui-testing/pages/managementPage .js +++ b/tests/ui-testing/pages/managementPage .js @@ -49,46 +49,5 @@ export async managementURLValidation() { await expect(this.page).toHaveURL(/settings/); - } - - - async updateCustomLogoText(text) { - await this.submitButton.waitFor({ state: 'visible' }); - await this.submitButton.click({ force: true }); - await this.page.waitForResponse( - (response) => - response.url().includes("/api/default/settings") && response.status() === 200 - ); - await this.page.getByText('Custom Logo Text').click(); - await this.page.locator('[data-test="settings_ent_logo_custom_text_edit_btn"]').click(); - await this.page.locator('[data-test="settings_ent_logo_custom_text"]').click(); - await this.page.locator('[data-test="settings_ent_logo_custom_text"]').fill('logo Autom'); - await this.customLogoText.click({ force: true }); - await this.customLogoText.fill(text); - await this.page.waitForSelector('[data-test="settings_ent_logo_custom_text_save_btn"]'); - await this.saveButton.click({ force: true }); - await this.page.waitForResponse( - (response) => - response.url().includes("/api/default/settings/logo/text") && response.status() === 200 - ); - - - } - - async uploadLogo(filePath) { - const isVisible = await this.deleteLogoButton.isVisible(); - if (isVisible) { - await this.page.waitForSelector('[data-test="setting_ent_custom_logo_img_delete_btn"]'); - await this.deleteLogoButton.click({ force: true }); - await this.page.waitForSelector('[data-test="logs-search-bar-confirm-dialog-ok-btn"]'); - await this.confirmDeleteButton.click({ force: true }); - } - //  await this.fileUploadInput.setInputFiles(filePath); - await this.page.setInputFiles('input[ data-test="setting_ent_custom_logo_img_file_upload"]', filePath); - await expect(this.page.getByText("Logo updated successfully")).toBeVisible({ - timeout: 30000, - }); - - - } + } } \ No newline at end of file diff --git a/tests/ui-testing/playwright-tests/logoManagement.spec.js b/tests/ui-testing/playwright-tests/logoManagement.spec.js deleted file mode 100644 index 37093aad96..0000000000 --- a/tests/ui-testing/playwright-tests/logoManagement.spec.js +++ /dev/null @@ -1,61 +0,0 @@ -import { test, expect } from "./baseFixtures"; - - -import { LogoManagementPage } from "../pages/logoManagementPage.js"; - -import { LoginPage } from '../pages/loginPage.js'; - - -const path = require('path'); - -// Function to generate a random 5-character alphabetic name -function generateRandomLogoName() { - const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; - let randomName = ''; - for (let i = 0; i < 5; i++) { - randomName += alphabet.charAt(Math.floor(Math.random() * alphabet.length)); - } - return randomName; -} - - -test('Logo Upload on Management ', async ({ page }) => { - // Create page object instances - const filePath = path.resolve(__dirname, './attachment/imagesAuto.png'); - - const loginPage = new LoginPage(page); - const logoManagementPage = new LogoManagementPage(page); - - // Example usage in Playwright POM -const logoName = generateRandomLogoName(); -console.log(`Generated logo name: ${logoName}`); - - // Step 1: Navigate to the application and login - - await page.goto(process.env["ZO_BASE_URL"]); - - // console.log ('URL Opened') - - await loginPage.gotoLoginPage(); - - // await loginPage.loginAsInternalUser(); - - await loginPage.login(); - - // Step 2: Navigate to Logs Page - - - await logoManagementPage.navigateToManagement(); - - await logoManagementPage.clickSaveSubmit(); - - await logoManagementPage.updateCustomLogoText(logoName ); - - console.log(`Uploading file from path: ${filePath}`); - // - await logoManagementPage.uploadLogo(filePath); - - - await page.waitForTimeout(5000); // Adjust or remove as needed -}); -