Skip to content

Commit

Permalink
scroll ML page to fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Michail Yasonik committed Jun 29, 2021
1 parent 34f8ae7 commit 58a1177
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 5 additions & 2 deletions test/functional/services/common/test_subjects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,12 @@ export class TestSubjects extends FtrService {
return testSubjSelector(selector);
}

public async scrollIntoView(selector: string) {
public async scrollIntoView(
selector: string,
offset: number | { topOffset?: number; bottomOffset?: number }
) {
const element = await this.find(selector);
await element.scrollIntoViewIfNecessary();
await element.scrollIntoViewIfNecessary(offset);
}

// isChecked always returns false when run on an euiSwitch, because they use the aria-checked attribute
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';
import { MlCommonUI } from './common_ui';

const fixedFooterHeight = 72; // Size of EuiBottomBar more or less

export function MachineLearningDataVisualizerFileBasedProvider(
{ getService, getPageObjects }: FtrProviderContext,
mlCommonUI: MlCommonUI
Expand Down Expand Up @@ -131,7 +133,9 @@ export function MachineLearningDataVisualizerFileBasedProvider(
},

async selectCreateFilebeatConfig() {
await testSubjects.scrollIntoView('fileDataVisFilebeatConfigLink');
await testSubjects.scrollIntoView('fileDataVisFilebeatConfigLink', {
bottomOffset: fixedFooterHeight,
});
await testSubjects.click('fileDataVisFilebeatConfigLink');
await testSubjects.existOrFail('fileDataVisFilebeatConfigPanel');
},
Expand Down

0 comments on commit 58a1177

Please sign in to comment.