Skip to content

Commit

Permalink
[Tests-refactor] Remove angular code from plugin_functional and updat…
Browse files Browse the repository at this point in the history
…e tests (opensearch-project#5221)

* remove angular-based view from DocViewsPlugin
* remove the test case that validates the display and content of the angular doc view

Issue Resolve
opensearch-project#5020

Signed-off-by: ananzh <[email protected]>
  • Loading branch information
ananzh authored and SuZhou-Joe committed Oct 7, 2023
1 parent c0b87eb commit 058a4dd
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 29 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
### 🔩 Tests

- [Tests] Add BWC tests for 2.9 and 2.10 ([#4762](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4762))
- [Tests-refactor] Remove angular code from plugin_functional and update tests ([#5221](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5221))

## [1.3.12 - 2023-08-10](https://github.com/opensearch-project/OpenSearch-Dashboards/releases/tag/1.3.12)

Expand Down
20 changes: 0 additions & 20 deletions test/plugin_functional/plugins/doc_views_plugin/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,36 +28,16 @@
* under the License.
*/

import angular from 'angular';
import React from 'react';
import { Plugin, CoreSetup } from 'opensearch-dashboards/public';
import { DiscoverSetup } from '../../../../../src/plugins/discover/public';

angular.module('myDocView', []).directive('myHit', () => ({
restrict: 'E',
scope: {
hit: '=hit',
},
template: '<h1 data-test-subj="angular-docview">{{hit._index}}</h1>',
}));

function MyHit(props: { index: string }) {
return <h1 data-test-subj="react-docview">{props.index}</h1>;
}

export class DocViewsPlugin implements Plugin<void, void> {
public setup(core: CoreSetup, { discover }: { discover: DiscoverSetup }) {
discover.docViews.addDocView({
directive: {
controller: function MyController($injector: any) {
$injector.loadNewModules(['myDocView']);
},
template: `<my-hit hit="hit"></my-hit>`,
},
order: 1,
title: 'Angular doc view',
});

discover.docViews.addDocView({
component: (props) => {
return <MyHit index={props.hit._index as string} />;
Expand Down
9 changes: 0 additions & 9 deletions test/plugin_functional/test_suites/doc_views/doc_views.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,10 @@ export default function ({ getService, getPageObjects }: PluginFunctionalProvide

it('should show custom doc views', async () => {
await testSubjects.click('docTableExpandToggleColumn');
const angularTab = await find.byButtonText('Angular doc view');
const reactTab = await find.byButtonText('React doc view');
expect(await angularTab.isDisplayed()).to.be(true);
expect(await reactTab.isDisplayed()).to.be(true);
});

it('should render angular doc view', async () => {
const angularTab = await find.byButtonText('Angular doc view');
await angularTab.click();
const angularContent = await testSubjects.find('angular-docview');
expect(await angularContent.getVisibleText()).to.be('logstash-2015.09.22');
});

it('should render react doc view', async () => {
const reactTab = await find.byButtonText('React doc view');
await reactTab.click();
Expand Down

0 comments on commit 058a4dd

Please sign in to comment.