Skip to content

Commit

Permalink
Updated some test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
DianaDerevyankina committed Mar 16, 2020
1 parent c60a464 commit 6cd8a35
Showing 1 changed file with 64 additions and 23 deletions.
87 changes: 64 additions & 23 deletions test/functional/apps/visualize/_area_chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -459,35 +459,76 @@ export default function({ getService, getPageObjects }) {
});

describe('date histogram interval', () => {
beforeEach(async () => await PageObjects.visEditor.toggleAccordion('visEditorAggAccordion2'));

it('should update accordion label when collapsed', async () => {
await PageObjects.visEditor.toggleAccordion('visEditorAggAccordion2', false);
const accordionLabel = await (
await find.byCssSelector(
'[data-test-subj="visEditorAggAccordion2"] .visEditorSidebar__aggGroupAccordionButtonContent'
)
).getVisibleText();
expect(accordionLabel).to.include.string('per month');
before(async () => {
await PageObjects.visualize.loadSavedVisualization(vizName1);
await PageObjects.visChart.waitForVisualization();
});

it('should update label inside when scaled to milliseconds', async () => {
await PageObjects.visEditor.setInterval('Millisecond');
const accordionLabel = await (
await find.byCssSelector('[data-test-subj="currentlyScaledText"]')
).getVisibleText();
expect(accordionLabel).to.include.string('to week');
beforeEach(async () => {
const fromTime = 'Sep 20, 2015 @ 00:00:00.000';
const toTime = 'Sep 20, 2015 @ 23:30:00.000';
await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime);
});

it('should scale to 10 minutes and display the correct label when time range is changed and custom interval is set to 10s', async () => {
const fromTime = 'Sep 20, 2015 @ 00:00:00.000';
it('should update collapsed accordion label when time range is changed', async () => {
const accordionLabel = await find.byCssSelector(
'[data-test-subj="visEditorAggAccordion2"] .visEditorSidebar__aggGroupAccordionButtonContent'
);
let accordionLabelText = await accordionLabel.getVisibleText();
expect(accordionLabelText).to.include.string('per 30 minutes');
const fromTime = 'Sep 20, 2015 @ 08:30:00.000';
const toTime = 'Sep 20, 2015 @ 23:30:00.000';
await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime);
await PageObjects.visEditor.setInterval('10s', { type: 'custom' });
const accordionLabel = await (
await find.byCssSelector('[data-test-subj="currentlyScaledText"]')
).getVisibleText();
expect(accordionLabel).to.include.string('to 10 minutes');
accordionLabelText = await accordionLabel.getVisibleText();
expect(accordionLabelText).to.include.string('per 10 minutes');
});

describe('expanded accordion', () => {
before(async () => await PageObjects.visEditor.toggleAccordion('visEditorAggAccordion2'));

it('should update label inside the opened accordion when scaled to milliseconds', async () => {
const isHelperScaledLabelExists = await find.existsByCssSelector(
'[data-test-subj="currentlyScaledText"]'
);
expect(isHelperScaledLabelExists).to.be(false);
await PageObjects.visEditor.setInterval('Millisecond');
const helperScaledLabelText = await (
await find.byCssSelector('[data-test-subj="currentlyScaledText"]')
).getVisibleText();
expect(helperScaledLabelText).to.include.string('to 10 minutes');
});

it('should display updated scaled label text after time range is changed', async () => {
await PageObjects.visEditor.setInterval('Millisecond');
const isHelperScaledLabelExists = await find.existsByCssSelector(
'[data-test-subj="currentlyScaledText"]'
);
expect(isHelperScaledLabelExists).to.be(true);
const helperScaledLabel = await find.byCssSelector(
'[data-test-subj="currentlyScaledText"]'
);
let helperScaledLabelText = await helperScaledLabel.getVisibleText();
expect(helperScaledLabelText).to.include.string('to 10 minutes');
const fromTime = 'Sep 20, 2015 @ 22:30:00.000';
const toTime = 'Sep 20, 2015 @ 23:30:00.000';
await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime);
helperScaledLabelText = await helperScaledLabel.getVisibleText();
expect(helperScaledLabelText).to.include.string('to 30 seconds');
});

it('should update scaled label text after custom interval is set and time range is changed', async () => {
await PageObjects.visEditor.setInterval('10s', { type: 'custom' });
const helperScaledLabel = await find.byCssSelector(
'[data-test-subj="currentlyScaledText"]'
);
let helperScaledLabelText = await helperScaledLabel.getVisibleText();
expect(helperScaledLabelText).to.include.string('to 10 minutes');
const fromTime = 'Sep 20, 2015 @ 21:30:00.000';
const toTime = 'Sep 20, 2015 @ 23:30:00.000';
await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime);
helperScaledLabelText = await helperScaledLabel.getVisibleText();
expect(helperScaledLabelText).to.include.string('to minute');
});
});
});
});
Expand Down

0 comments on commit 6cd8a35

Please sign in to comment.