diff --git a/src/plugins/opensearch_dashboards_react/public/table_list_view/table_list_view.tsx b/src/plugins/opensearch_dashboards_react/public/table_list_view/table_list_view.tsx index 3994bd3e4f7b..970ee4ff4e74 100644 --- a/src/plugins/opensearch_dashboards_react/public/table_list_view/table_list_view.tsx +++ b/src/plugins/opensearch_dashboards_react/public/table_list_view/table_list_view.tsx @@ -444,6 +444,7 @@ class TableListView extends React.Component !error, onClick: this.props.editItem, + 'data-test-subj': 'edit-dashboard-action', }, ]; diff --git a/test/functional/apps/visualize/_custom_branding.ts b/test/functional/apps/visualize/_custom_branding.ts index 1f18b82bf99e..623da83d153d 100644 --- a/test/functional/apps/visualize/_custom_branding.ts +++ b/test/functional/apps/visualize/_custom_branding.ts @@ -45,9 +45,25 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { expect(actualLabel.toUpperCase()).to.equal(expectedMarkLogo.toUpperCase()); }); - it('with customized logo for opensearch overview header in dark mode', async () => { + it('if enable user control, admin customized dark mode logo for opensearch overview header is not applied', async () => { await PageObjects.common.navigateToApp('management/opensearch-dashboards/settings'); await PageObjects.settings.toggleAdvancedSettingCheckbox('theme:enableUserControl'); + const button = await testSubjects.find('advancedSetting-editField-theme:darkMode'); + const isDisabled = (await button.getAttribute('disabled')) !== null; + expect(isDisabled).equal(true); + await PageObjects.common.navigateToApp('opensearch_dashboards_overview'); + await testSubjects.existOrFail('osdOverviewPageHeaderLogo'); + const actualLabel = await testSubjects.getAttribute( + 'osdOverviewPageHeaderLogo', + 'data-test-logo' + ); + expect(actualLabel.toUpperCase()).to.equal(expectedMarkLogo.toUpperCase()); + await PageObjects.common.navigateToApp('management/opensearch-dashboards/settings'); + await PageObjects.settings.clearAdvancedSettings('theme:enableUserControl'); + }); + + it('admin customized dark mode logo for opensearch overview header is applied', async () => { + await PageObjects.common.navigateToApp('management/opensearch-dashboards/settings'); await PageObjects.settings.toggleAdvancedSettingCheckbox('theme:darkMode'); await PageObjects.common.navigateToApp('opensearch_dashboards_overview'); await testSubjects.existOrFail('osdOverviewPageHeaderLogo'); @@ -56,6 +72,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { 'data-test-logo' ); expect(actualLabel.toUpperCase()).to.equal(expectedMarkLogoDarkMode.toUpperCase()); + await PageObjects.common.navigateToApp('management/opensearch-dashboards/settings'); + await PageObjects.settings.clearAdvancedSettings('theme:darkMode'); }); }); @@ -100,9 +118,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { expect(actualLabel.toUpperCase()).to.equal(expectedWelcomeMessage.toUpperCase()); }); - it('with customized logo in dark mode', async () => { + it('admin customized dark mode logo for home is applied', async () => { await PageObjects.common.navigateToApp('management/opensearch-dashboards/settings'); - await PageObjects.settings.toggleAdvancedSettingCheckbox('theme:enableUserControl'); await PageObjects.settings.toggleAdvancedSettingCheckbox('theme:darkMode'); await PageObjects.common.navigateToApp('home'); await testSubjects.existOrFail('welcomeCustomLogo'); @@ -111,6 +128,25 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { 'data-test-image-url' ); expect(actualLabel.toUpperCase()).to.equal(expectedMarkLogoDarkMode.toUpperCase()); + await PageObjects.common.navigateToApp('management/opensearch-dashboards/settings'); + await PageObjects.settings.clearAdvancedSettings('theme:darkMode'); + }); + + it('if enable user control, admin customized dark mode logo for home is not applied', async () => { + await PageObjects.common.navigateToApp('management/opensearch-dashboards/settings'); + await PageObjects.settings.toggleAdvancedSettingCheckbox('theme:enableUserControl'); + const button = await testSubjects.find('advancedSetting-editField-theme:darkMode'); + const isDisabled = (await button.getAttribute('disabled')) !== null; + expect(isDisabled).equal(true); + await PageObjects.common.navigateToApp('home'); + await testSubjects.existOrFail('welcomeCustomLogo'); + const actualLabel = await testSubjects.getAttribute( + 'welcomeCustomLogo', + 'data-test-image-url' + ); + expect(actualLabel.toUpperCase()).to.equal(expectedMarkLogo.toUpperCase()); + await PageObjects.common.navigateToApp('management/opensearch-dashboards/settings'); + await PageObjects.settings.clearAdvancedSettings('theme:enableUserControl'); }); }); @@ -180,10 +216,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); }); - describe('in dark mode', async () => { + describe('OpenSearch Dashboards branding configuration in dark mode', async () => { before(async function () { await PageObjects.common.navigateToApp('management/opensearch-dashboards/settings'); - await PageObjects.settings.toggleAdvancedSettingCheckbox('theme:enableUserControl'); await PageObjects.settings.toggleAdvancedSettingCheckbox('theme:darkMode'); await PageObjects.common.navigateToApp('home'); }); diff --git a/test/plugin_functional/test_suites/dashboard_listing_plugin/dashboard_listing_plugin.ts b/test/plugin_functional/test_suites/dashboard_listing_plugin/dashboard_listing_plugin.ts index da92a958797b..2a385d1282f9 100644 --- a/test/plugin_functional/test_suites/dashboard_listing_plugin/dashboard_listing_plugin.ts +++ b/test/plugin_functional/test_suites/dashboard_listing_plugin/dashboard_listing_plugin.ts @@ -54,8 +54,8 @@ export default function ({ getService, getPageObjects }) { it('should be able to navigate to edit dashboard', async () => { await listingTable.searchForItemWithName(dashboardName); - const editBttn = await find.allByCssSelector('.euiToolTipAnchor'); - await editBttn[3].click(); + const editBttn = await testSubjects.find('edit-dashboard-action'); + await editBttn.click(); await PageObjects.dashboard.clickCancelOutOfEditMode(); await PageObjects.dashboard.gotoDashboardLandingPage(); });