Skip to content

Commit

Permalink
Use data test subj selectors to find search box.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjcenizal committed May 14, 2020
1 parent 885869e commit 1244952
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ describe('<AutoFollowPatternList />', () => {
});

describe('when there are multiple pages of auto-follow patterns', () => {
let find;
let component;
let table;
let actions;
Expand All @@ -81,7 +82,7 @@ describe('<AutoFollowPatternList />', () => {
httpRequestsMockHelpers.setLoadAutoFollowPatternsResponse({ patterns: autoFollowPatterns });

// Mount the component
({ component, table, actions, form } = setup());
({ find, component, table, actions, form } = setup());

await nextTick(); // Make sure that the http request is fulfilled
component.update();
Expand All @@ -97,7 +98,7 @@ describe('<AutoFollowPatternList />', () => {
});

test('search works', () => {
form.setInputValue(component.find('input[type="search"]'), 'unique');
form.setInputValue(find('autoFollowPatternSearch'), 'unique');
const { tableCellsValues } = table.getMetaData('autoFollowPatternListTable');
expect(tableCellsValues.length).toBe(1);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ describe('<FollowerIndicesList />', () => {
});

describe('when there are multiple pages of follower indices', () => {
let find;
let component;
let table;
let actions;
Expand All @@ -91,7 +92,7 @@ describe('<FollowerIndicesList />', () => {
httpRequestsMockHelpers.setLoadFollowerIndicesResponse({ indices: followerIndices });

// Mount the component
({ component, table, actions, form } = setup());
({ find, component, table, actions, form } = setup());

await nextTick(); // Make sure that the http request is fulfilled
component.update();
Expand All @@ -107,7 +108,7 @@ describe('<FollowerIndicesList />', () => {
});

test('search works', () => {
form.setInputValue(component.find('input[type="search"]'), 'unique');
form.setInputValue(find('followerIndexSearch'), 'unique');
const { tableCellsValues } = table.getMetaData('followerIndexListTable');
expect(tableCellsValues.length).toBe(1);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ export class AutoFollowPatternTable extends PureComponent {
onChange: this.onSearch,
box: {
incremental: true,
'data-test-subj': 'autoFollowPatternSearch',
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ export class FollowerIndicesTable extends PureComponent {
onChange: this.onSearch,
box: {
incremental: true,
'data-test-subj': 'followerIndexSearch',
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ describe('<RemoteClusterList />', () => {
});

describe('when there are multiple pages of remote clusters', () => {
let find;
let table;
let actions;
let waitFor;
let form;
let component;

const remoteClusters = [
{
Expand All @@ -94,7 +94,7 @@ describe('<RemoteClusterList />', () => {
httpRequestsMockHelpers.setLoadRemoteClustersResponse(remoteClusters);

await act(async () => {
({ component, table, actions, waitFor, form } = setup());
({ find, table, actions, waitFor, form } = setup());
await waitFor('remoteClusterListTable');
});
});
Expand All @@ -109,7 +109,7 @@ describe('<RemoteClusterList />', () => {
});

test('search works', () => {
form.setInputValue(component.find('input[type="search"]'), 'unique');
form.setInputValue(find('remoteClusterSearch'), 'unique');
const { tableCellsValues } = table.getMetaData('remoteClusterListTable');
expect(tableCellsValues.length).toBe(1);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ export class RemoteClusterTable extends Component {
onChange: this.onSearch,
box: {
incremental: true,
'data-test-subj': 'remoteClusterSearch',
},
};

Expand Down

0 comments on commit 1244952

Please sign in to comment.