Skip to content

Commit

Permalink
[Rename] Refactored test/* director (#137)
Browse files Browse the repository at this point in the history
* [Rename] Refactored test/* directory

Signed-off-by: Mihir Soni <mihirsoni.123@gmail.com>

* [Rename] Renamed directories and files

* [Rename] addressed review feedbacks

* [Rename] addressed review feedbacks

* [Rename] addressed review feedbacks
  • Loading branch information
mihirsoni authored and kavilla committed Mar 19, 2021
1 parent 4200b97 commit 567026f
Show file tree
Hide file tree
Showing 546 changed files with 2,668 additions and 2,668 deletions.
4 changes: 2 additions & 2 deletions src/dev/i18n/tasks/check_configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ import { ErrorReporter, checkConfigNamespacePrefix, arrayify } from '..';

export function checkConfigs(additionalConfigPaths: string | string[] = []) {
const root = join(__dirname, '../../../../');
const kibanaRC = resolve(root, I18N_RC);
const opensearchDashboardsRC = resolve(root, I18N_RC);
const xpackRC = resolve(root, 'x-pack', I18N_RC);

const configPaths = [kibanaRC, xpackRC, ...arrayify(additionalConfigPaths)];
const configPaths = [opensearchDashboardsRC, xpackRC, ...arrayify(additionalConfigPaths)];

return configPaths.map((configPath) => ({
task: async (context: { reporter: ErrorReporter }) => {
Expand Down
12 changes: 6 additions & 6 deletions test/accessibility/apps/discover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,25 @@ import { FtrProviderContext } from '../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['common', 'discover', 'header', 'share', 'timePicker']);
const a11y = getService('a11y');
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const opensearchArchiver = getService('opensearchArchiver');
const opensearchDashboardsServer = getService('opensearchDashboardsServer');
const inspector = getService('inspector');
const testSubjects = getService('testSubjects');
const TEST_COLUMN_NAMES = ['extension', 'geo.src'];

describe('Discover a11y tests', () => {
before(async () => {
await esArchiver.load('discover');
await esArchiver.loadIfNeeded('logstash_functional');
await kibanaServer.uiSettings.update({
await opensearchArchiver.load('discover');
await opensearchArchiver.loadIfNeeded('logstash_functional');
await opensearchDashboardsServer.uiSettings.update({
defaultIndex: 'logstash-*',
});
await PageObjects.common.navigateToApp('discover');
await PageObjects.timePicker.setDefaultAbsoluteRange();
});

after(async () => {
await esArchiver.unload('logstash_functional');
await opensearchArchiver.unload('logstash_functional');
});

it('Discover main page', async () => {
Expand Down
2 changes: 1 addition & 1 deletion test/accessibility/apps/filter_panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});
await PageObjects.home.addSampleDataSet('flights');
await PageObjects.common.navigateToApp('discover');
await PageObjects.discover.selectIndexPattern('kibana_sample_data_flights');
await PageObjects.discover.selectIndexPattern('opensearch_dashboards_sample_data_flights');
});

it('a11y test on add filter panel', async () => {
Expand Down
6 changes: 3 additions & 3 deletions test/accessibility/apps/home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['common', 'home']);
const a11y = getService('a11y');

describe('Kibana Home', () => {
describe('OpenSearch Dashboards Home', () => {
before(async () => {
await PageObjects.common.navigateToApp('home');
});

it('Kibana Home view', async () => {
it('OpenSearch Dashboards Home view', async () => {
await a11y.testAppSnapshot();
});

it('Add Kibana sample data page', async () => {
it('Add OpenSearch Dashboards sample data page', async () => {
await PageObjects.common.navigateToUrl('home', '/tutorial_directory/sampleData', {
useActualUrl: true,
});
Expand Down
20 changes: 10 additions & 10 deletions test/accessibility/apps/management.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,30 @@ import { FtrProviderContext } from '../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['common', 'settings', 'header']);
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const opensearchArchiver = getService('opensearchArchiver');
const opensearchDashboardsServer = getService('opensearchDashboardsServer');
const a11y = getService('a11y');

describe('Management', () => {
before(async () => {
await esArchiver.load('discover');
await esArchiver.loadIfNeeded('logstash_functional');
await kibanaServer.uiSettings.update({
await opensearchArchiver.load('discover');
await opensearchArchiver.loadIfNeeded('logstash_functional');
await opensearchDashboardsServer.uiSettings.update({
defaultIndex: 'logstash-*',
});
await PageObjects.settings.navigateTo();
});

after(async () => {
await esArchiver.unload('logstash_functional');
await opensearchArchiver.unload('logstash_functional');
});

it('main view', async () => {
await a11y.testAppSnapshot();
});

it('index pattern page', async () => {
await PageObjects.settings.clickKibanaIndexPatterns();
await PageObjects.settings.clickOpenSearchDashboardsIndexPatterns();
await a11y.testAppSnapshot();
});

Expand All @@ -55,15 +55,15 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});

it('Open create index pattern wizard', async () => {
await PageObjects.settings.clickKibanaIndexPatterns();
await PageObjects.settings.clickOpenSearchDashboardsIndexPatterns();
await PageObjects.settings.clickAddNewIndexPatternButton();
await PageObjects.header.waitUntilLoadingHasFinished();
await a11y.testAppSnapshot();
});

// We are navigating back to index pattern page to test field formatters
it('Navigate back to logstash index page', async () => {
await PageObjects.settings.clickKibanaIndexPatterns();
await PageObjects.settings.clickOpenSearchDashboardsIndexPatterns();
await PageObjects.settings.clickIndexPatternLogstash();
await a11y.testAppSnapshot();
});
Expand All @@ -74,7 +74,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});

it('Advanced settings', async () => {
await PageObjects.settings.clickKibanaSettings();
await PageObjects.settings.clickOpenSearchDashboardsSettings();
await a11y.testAppSnapshot();
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['common', 'home']);
const a11y = getService('a11y');

describe('Kibana overview', () => {
const esArchiver = getService('esArchiver');
describe('OpenSearch Dashboards overview', () => {
const opensearchArchiver = getService('opensearchArchiver');

before(async () => {
await esArchiver.load('empty_kibana');
await PageObjects.common.navigateToApp('kibanaOverview');
await opensearchArchiver.load('empty_opensearch_dashboards');
await PageObjects.common.navigateToApp('opensearchDashboardsOverview');
});

after(async () => {
await PageObjects.common.navigateToUrl('home', '/tutorial_directory/sampleData', {
useActualUrl: true,
});
await PageObjects.home.removeSampleDataSet('flights');
await esArchiver.unload('empty_kibana');
await opensearchArchiver.unload('empty_opensearch_dashboards');
});

it('Getting started view', async () => {
Expand All @@ -48,7 +48,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
useActualUrl: true,
});
await PageObjects.home.addSampleDataSet('flights');
await PageObjects.common.navigateToApp('kibanaOverview');
await PageObjects.common.navigateToApp('opensearchDashboardsOverview');
await a11y.testAppSnapshot();
});
});
Expand Down
4 changes: 2 additions & 2 deletions test/accessibility/apps/visualize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ import { FtrProviderContext } from '../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['common', 'visualize', 'header']);
const a11y = getService('a11y');
const esArchiver = getService('esArchiver');
const opensearchArchiver = getService('opensearchArchiver');

describe('Visualize', () => {
before(async () => {
await esArchiver.loadIfNeeded('discover');
await opensearchArchiver.loadIfNeeded('discover');
await PageObjects.common.navigateToApp('visualize');
});

Expand Down
4 changes: 2 additions & 2 deletions test/accessibility/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import { FtrConfigProviderContext } from '@kbn/test/types/ftr';
import { FtrConfigProviderContext } from '@osd/test/types/ftr';
import { services } from './services';
import { pageObjects } from './page_objects';

Expand All @@ -36,7 +36,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
require.resolve('./apps/console'),
require.resolve('./apps/home'),
require.resolve('./apps/filter_panel'),
require.resolve('./apps/kibana_overview'),
require.resolve('./apps/opensearch_dashboards_overview'),
],
pageObjects,
services,
Expand Down
2 changes: 1 addition & 1 deletion test/accessibility/ftr_provider_context.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import { GenericFtrProviderContext } from '@kbn/test/types/ftr';
import { GenericFtrProviderContext } from '@osd/test/types/ftr';

import { pageObjects } from './page_objects';
import { services } from './services';
Expand Down
2 changes: 1 addition & 1 deletion test/accessibility/services/a11y/a11y.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import chalk from 'chalk';
import testSubjectToCss from '@kbn/test-subj-selector';
import testSubjectToCss from '@osd/test-subj-selector';

import { FtrProviderContext } from '../../ftr_provider_context';
import { AxeReport, printResult } from './axe_report';
Expand Down
4 changes: 2 additions & 2 deletions test/accessibility/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
* under the License.
*/

import { services as kibanaFunctionalServices } from '../../functional/services';
import { services as opensearchDashboardsFunctionalServices } from '../../functional/services';
import { A11yProvider } from './a11y';

export const services = {
...kibanaFunctionalServices,
...opensearchDashboardsFunctionalServices,
a11y: A11yProvider,
};
8 changes: 4 additions & 4 deletions test/api_integration/apis/core/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import expect from '@kbn/expect';
import expect from '@osd/expect';

export default function ({ getService }) {
const supertest = getService('supertest');
Expand All @@ -25,7 +25,7 @@ export default function ({ getService }) {
describe('compression', () => {
it(`uses compression when there isn't a referer`, async () => {
await supertest
.get('/app/kibana')
.get('/app/opensearch-dashboards')
.set('accept-encoding', 'gzip')
.then((response) => {
expect(response.headers).to.have.property('content-encoding', 'gzip');
Expand All @@ -34,7 +34,7 @@ export default function ({ getService }) {

it(`uses compression when there is a whitelisted referer`, async () => {
await supertest
.get('/app/kibana')
.get('/app/opensearch-dashboards')
.set('accept-encoding', 'gzip')
.set('referer', 'https://some-host.com')
.then((response) => {
Expand All @@ -44,7 +44,7 @@ export default function ({ getService }) {

it(`doesn't use compression when there is a non-whitelisted referer`, async () => {
await supertest
.get('/app/kibana')
.get('/app/opensearch-dashboards')
.set('accept-encoding', 'gzip')
.set('referer', 'https://other.some-host.com')
.then((response) => {
Expand Down
2 changes: 1 addition & 1 deletion test/api_integration/apis/general/cookies.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import expect from '@kbn/expect';
import expect from '@osd/expect';

export default function ({ getService }) {
const supertest = getService('supertest');
Expand Down
4 changes: 2 additions & 2 deletions test/api_integration/apis/general/csp.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
* under the License.
*/

import expect from '@kbn/expect';
import expect from '@osd/expect';

export default function ({ getService }) {
const supertest = getService('supertest');

describe('csp smoke test', () => {
it('app response sends content security policy headers', async () => {
const response = await supertest.get('/app/kibana');
const response = await supertest.get('/app/opensearch-dashboards');

expect(response.headers).to.have.property('content-security-policy');
const header = response.headers['content-security-policy'];
Expand Down
36 changes: 18 additions & 18 deletions test/api_integration/apis/home/sample_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@
* under the License.
*/

import expect from '@kbn/expect';
import expect from '@osd/expect';

export default function ({ getService }) {
const supertest = getService('supertest');
const es = getService('legacyEs');
const opensearch = getService('legacyOpenSearch');

const MILLISECOND_IN_WEEK = 1000 * 60 * 60 * 24 * 7;

describe('sample data apis', () => {
describe('list', () => {
it('should return list of sample data sets with installed status', async () => {
const resp = await supertest.get(`/api/sample_data`).set('kbn-xsrf', 'kibana').expect(200);
const resp = await supertest.get(`/api/sample_data`).set('osd-xsrf', 'opensearch-dashboards').expect(200);

expect(resp.body).to.be.an('array');
expect(resp.body.length).to.be.above(0);
Expand All @@ -38,24 +38,24 @@ export default function ({ getService }) {

describe('install', () => {
it('should return 404 if id does not match any sample data sets', async () => {
await supertest.post(`/api/sample_data/xxxx`).set('kbn-xsrf', 'kibana').expect(404);
await supertest.post(`/api/sample_data/xxxx`).set('osd-xsrf', 'opensearch-dashboards').expect(404);
});

it('should return 200 if success', async () => {
const resp = await supertest
.post(`/api/sample_data/flights`)
.set('kbn-xsrf', 'kibana')
.set('osd-xsrf', 'opensearch-dashboards')
.expect(200);

expect(resp.body).to.eql({
elasticsearchIndicesCreated: { kibana_sample_data_flights: 13059 },
kibanaSavedObjectsLoaded: 20,
opensearchIndicesCreated: { opensearch_dashboards_sample_data_flights: 13059 },
opensearchDashboardsSavedObjectsLoaded: 20,
});
});

it('should load elasticsearch index containing sample data with dates relative to current time', async () => {
const resp = await es.search({
index: 'kibana_sample_data_flights',
it('should load opensearch index containing sample data with dates relative to current time', async () => {
const resp = await opensearch.search({
index: 'opensearch_dashboards_sample_data_flights',
});

const doc = resp.hits.hits[0];
Expand All @@ -66,14 +66,14 @@ export default function ({ getService }) {
});

describe('parameters', () => {
it('should load elasticsearch index containing sample data with dates relative to now parameter', async () => {
it('should load opensearch index containing sample data with dates relative to now parameter', async () => {
const nowString = `2000-01-01T00:00:00`;
await supertest
.post(`/api/sample_data/flights?now=${nowString}`)
.set('kbn-xsrf', 'kibana');
.set('osd-xsrf', 'opensearch-dashboards');

const resp = await es.search({
index: 'kibana_sample_data_flights',
const resp = await opensearch.search({
index: 'opensearch_dashboards_sample_data_flights',
});

const doc = resp.hits.hits[0];
Expand All @@ -87,12 +87,12 @@ export default function ({ getService }) {

describe('uninstall', () => {
it('should uninstall sample data', async () => {
await supertest.delete(`/api/sample_data/flights`).set('kbn-xsrf', 'kibana').expect(204);
await supertest.delete(`/api/sample_data/flights`).set('osd-xsrf', 'opensearch-dashboards').expect(204);
});

it('should remove elasticsearch index containing sample data', async () => {
const resp = await es.indices.exists({
index: 'kibana_sample_data_flights',
it('should remove opensearch index containing sample data', async () => {
const resp = await opensearch.indices.exists({
index: 'opensearch_dashboards_sample_data_flights',
});
expect(resp).to.be(false);
});
Expand Down
Loading

0 comments on commit 567026f

Please sign in to comment.