Skip to content

Commit

Permalink
Rename wizard in functional tests
Browse files Browse the repository at this point in the history
Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>
  • Loading branch information
abbyhu2000 committed Oct 26, 2022
1 parent a270a94 commit 05ae345
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 37 deletions.
2 changes: 1 addition & 1 deletion src/plugins/vis_builder/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ export class VisBuilderPlugin implements Plugin<VisBuilderPluginSetup, VisBuilde
return {};
}

public stop() { }
public stop() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,52 +7,52 @@ import expect from '@osd/expect';
import { FtrProviderContext } from '../../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['visualize', 'wizard', 'visChart']);
const PageObjects = getPageObjects(['visualize', 'visBuilder', 'visChart']);
const testSubjects = getService('testSubjects');
const log = getService('log');
const retry = getService('retry');

describe('Basic tests for wizard app ', function () {
describe('Basic tests for visBuilder app ', function () {
before(async () => {
log.debug('navigateToApp wizard');
await PageObjects.wizard.navigateToCreateWizard();
log.debug('navigateToApp visBuilder');
await PageObjects.visBuilder.navigateToCreateVisBuilder();
});

it('should be able to switch data sources', async () => {
const dataSourceValue = await PageObjects.wizard.selectDataSource(
PageObjects.wizard.index.LOGSTASH_NON_TIME_BASED
const dataSourceValue = await PageObjects.visBuilder.selectDataSource(
PageObjects.visBuilder.index.LOGSTASH_NON_TIME_BASED
);

expect(dataSourceValue).to.equal(PageObjects.wizard.index.LOGSTASH_NON_TIME_BASED);
expect(dataSourceValue).to.equal(PageObjects.visBuilder.index.LOGSTASH_NON_TIME_BASED);
// TODO: Switch with a datasource with unique fields to test if it exists
});

it('should show visualization when a field is added', async () => {
const expectedData = [2904, 2858, 2814, 2784, 1322];
await PageObjects.wizard.addField('metric', 'Count');
await PageObjects.wizard.addField('segment', 'Terms', 'machine.os.raw');
await PageObjects.visBuilder.addField('metric', 'Count');
await PageObjects.visBuilder.addField('segment', 'Terms', 'machine.os.raw');

const data = await PageObjects.visChart.getBarChartData();
expect(data).to.eql(expectedData);
});

it('should clear visualization when field is deleted', async () => {
await PageObjects.wizard.removeField('metric', 0);
await PageObjects.visBuilder.removeField('metric', 0);

const isEmptyWorkspace = await PageObjects.wizard.isEmptyWorkspace();
const isEmptyWorkspace = await PageObjects.visBuilder.isEmptyWorkspace();
expect(isEmptyWorkspace).to.be(true);
});

it('should show warning before changing visualization type', async () => {
await PageObjects.wizard.selectVisType('metric', false);
await PageObjects.visBuilder.selectVisType('metric', false);
const confirmModalExists = await testSubjects.exists('confirmVisChangeModal');
expect(confirmModalExists).to.be(true);

await testSubjects.click('confirmModalCancelButton');
});

it('should change visualization type', async () => {
const pickerValue = await PageObjects.wizard.selectVisType('metric');
const pickerValue = await PageObjects.visBuilder.selectVisType('metric');

expect(pickerValue).to.eql('Metric');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,25 @@ import { VISUALIZE_ENABLE_LABS_SETTING } from '../../../../src/plugins/visualiza
import { FtrProviderContext } from '../../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['visualize', 'wizard']);
const PageObjects = getPageObjects(['visualize', 'visBuilder']);
const log = getService('log');
const opensearchDashboardsServer = getService('opensearchDashboardsServer');

describe('experimental settings for wizard app ', function () {
it('should show an notification when creating wizard visualization', async () => {
describe('experimental settings for visBuilder app ', function () {
it('should show an notification when creating visBuilder visualization', async () => {
log.debug('navigateToApp visualize');
await PageObjects.visualize.navigateToNewVisualization();
await PageObjects.visualize.waitForVisualizationSelectPage();

// Try to find the wizard Vis type.
const wizardVisTypeExists = await PageObjects.visualize.hasVisType('wizard');
// Try to find the visBuilder Vis type.
const wizardVisTypeExists = await PageObjects.visualize.hasVisType('visBuilder');
expect(wizardVisTypeExists).to.be(true);

// Create a new visualization
await PageObjects.visualize.clickVisType('wizard');
await PageObjects.visualize.clickVisType('visBuilder');

// Check that the experimental banner is there and state that this is experimental
const info = await PageObjects.wizard.getExperimentalInfo();
const info = await PageObjects.visBuilder.getExperimentalInfo();
expect(await info.getVisibleText()).to.contain('experimental');
});

Expand All @@ -38,9 +38,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.visualize.navigateToNewVisualization();
await PageObjects.visualize.waitForVisualizationSelectPage();

// Try to find the wizard Vis type.
const wizardVisTypeExists = await PageObjects.visualize.hasVisType('wizard');
expect(wizardVisTypeExists).to.be(false);
// Try to find the visBuilder Vis type.
const visBuilderVisTypeExists = await PageObjects.visualize.hasVisType('visBuilder');
expect(visBuilderVisTypeExists).to.be(false);
});

after(async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { FtrProviderContext } from '../../ftr_provider_context.d';
import { FtrProviderContext } from '../../ftr_provider_context';
import { UI_SETTINGS } from '../../../../src/plugins/data/common';

export default function ({ getService, loadTestFile }: FtrProviderContext) {
Expand All @@ -12,11 +12,11 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) {
const opensearchArchiver = getService('opensearchArchiver');
const opensearchDashboardsServer = getService('opensearchDashboardsServer');

describe('wizard app', function () {
describe('visBuilder app', function () {
this.tags('ciGroup13');

before(async function () {
log.debug('Starting wizard before method');
log.debug('Starting visBuilder before method');
await browser.setWindowSize(1280, 800);
await opensearchArchiver.loadIfNeeded('logstash_functional');
await opensearchArchiver.loadIfNeeded('long_window_logstash');
Expand Down
6 changes: 3 additions & 3 deletions test/functional/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default async function ({ readConfigFile }) {
require.resolve('./apps/status_page'),
require.resolve('./apps/timeline'),
require.resolve('./apps/visualize'),
require.resolve('./apps/wizard'),
require.resolve('./apps/vis_builder'),
],
pageObjects,
services,
Expand Down Expand Up @@ -92,8 +92,8 @@ export default async function ({ readConfigFile }) {
pathname: '/app/visualize',
hash: '/',
},
wizard: {
pathname: '/app/wizard',
visBuilder: {
pathname: '/app/vis_builder',
hash: '/',
},
dashboard: {
Expand Down
4 changes: 2 additions & 2 deletions test/functional/page_objects/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import { TimePickerProvider } from './time_picker';
import { TimelinePageProvider } from './timeline_page';
import { VisualBuilderPageProvider } from './visual_builder_page';
import { VisualizePageProvider } from './visualize_page';
import { WizardPageProvider } from './wizard_page';
import { VisBuilderPageProvider } from './vis_builder_page';
import { VisualizeEditorPageProvider } from './visualize_editor_page';
import { VisualizeChartPageProvider } from './visualize_chart_page';
import { TileMapPageProvider } from './tile_map_page';
Expand All @@ -69,7 +69,7 @@ export const pageObjects = {
timePicker: TimePickerProvider,
visualBuilder: VisualBuilderPageProvider,
visualize: VisualizePageProvider,
wizard: WizardPageProvider,
visBuilder: VisBuilderPageProvider,
visEditor: VisualizeEditorPageProvider,
visChart: VisualizeChartPageProvider,
tileMap: TileMapPageProvider,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { FtrProviderContext } from '../ftr_provider_context';

export function WizardPageProvider({ getService, getPageObjects }: FtrProviderContext) {
export function VisBuilderPageProvider({ getService, getPageObjects }: FtrProviderContext) {
const testSubjects = getService('testSubjects');
const find = getService('find');
const browser = getService('browser');
Expand All @@ -16,14 +16,14 @@ export function WizardPageProvider({ getService, getPageObjects }: FtrProviderCo
* This page object contains the visualization type selection, the landing page,
* and the open/save dialog functions
*/
class WizardPage {
class VisBuilderPage {
index = {
LOGSTASH_TIME_BASED: 'logstash-*',
LOGSTASH_NON_TIME_BASED: 'logstash*',
};

public async navigateToCreateWizard() {
await common.navigateToApp('wizard');
public async navigateToCreateVisBuilder() {
await common.navigateToApp('visBuilder');
await header.waitUntilLoadingHasFinished();
}

Expand Down Expand Up @@ -124,5 +124,5 @@ export function WizardPageProvider({ getService, getPageObjects }: FtrProviderCo
}
}

return new WizardPage();
return new VisBuilderPage();
}

0 comments on commit 05ae345

Please sign in to comment.