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

[Tests-refactor] Remove angular code from plugin_functional and update tests #5221

Merged
merged 1 commit into from
Oct 5, 2023
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,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
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
Loading