-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix pagination bugs in CCR and Remote Clusters #65931
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c3048f8
Fix broken pagination in CCR Follower Indices table.
cjcenizal 4dbdd12
Fix broken pagination in CCR Auto-follow patterns table.
cjcenizal edbd9c1
Fix broken pagination in Remote Clusters table.
cjcenizal 885869e
Merge branch 'master' into bug/ccr-pagination
cjcenizal 1244952
Use data test subj selectors to find search box.
cjcenizal 4d107cd
Skip failing search tests.
cjcenizal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,14 @@ | |
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
/** | ||
* The below import is required to avoid a console error warn from brace package | ||
* console.warn ../node_modules/brace/index.js:3999 | ||
Could not load worker ReferenceError: Worker is not defined | ||
at createWorker (/<path-to-repo>/node_modules/brace/index.js:17992:5) | ||
*/ | ||
import * as stubWebWorker from '../../../../../test_utils/stub_web_worker'; // eslint-disable-line no-unused-vars | ||
|
||
import { getFollowerIndexMock } from './fixtures/follower_index'; | ||
import './mocks'; | ||
import { setupEnvironment, pageHelpers, nextTick, getRandomString } from './helpers'; | ||
|
@@ -59,6 +67,54 @@ describe('<FollowerIndicesList />', () => { | |
}); | ||
}); | ||
|
||
describe('when there are multiple pages of follower indices', () => { | ||
let find; | ||
let component; | ||
let table; | ||
let actions; | ||
let form; | ||
|
||
const followerIndices = [ | ||
{ | ||
name: 'unique', | ||
seeds: [], | ||
}, | ||
]; | ||
|
||
for (let i = 0; i < 29; i++) { | ||
followerIndices.push({ | ||
name: `name${i}`, | ||
seeds: [], | ||
}); | ||
} | ||
|
||
beforeEach(async () => { | ||
httpRequestsMockHelpers.setLoadFollowerIndicesResponse({ indices: followerIndices }); | ||
|
||
// Mount the component | ||
({ find, component, table, actions, form } = setup()); | ||
|
||
await nextTick(); // Make sure that the http request is fulfilled | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From my notes and finding, we should not add |
||
component.update(); | ||
}); | ||
|
||
test('pagination works', () => { | ||
actions.clickPaginationNextButton(); | ||
const { tableCellsValues } = table.getMetaData('followerIndexListTable'); | ||
|
||
// Pagination defaults to 20 follower indices per page. We loaded 30 follower indices, | ||
// so the second page should have 10. | ||
expect(tableCellsValues.length).toBe(10); | ||
}); | ||
|
||
// Skipped until we can figure out how to get this test to work. | ||
test.skip('search works', () => { | ||
form.setInputValue(find('followerIndexSearch'), 'unique'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would probably do this act(() => {
form.setInputValue(find('followerIndexSearch'), 'unique');
});
component.update();
... |
||
const { tableCellsValues } = table.getMetaData('followerIndexListTable'); | ||
expect(tableCellsValues.length).toBe(1); | ||
}); | ||
}); | ||
|
||
describe('when there are follower indices', () => { | ||
let find; | ||
let exists; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sebelga There are two other search tests like this one in the other tests files, and they are all failing based on the
tableCellsValues.length
remaining unchanged at 20. It looks like the input is being found and the change event is simulated, but it's not bubbling back up to the list component (which is responsible for handling it and updating the array of filtered items). Any ideas on what could be causing this?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have your tried adding
component.update()
afterform.setInputValue()
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason why you decided to use
component.find('input[type="search"]')
instead of using a data-test-subj?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, no change.
Fixed! I didn't realize this was possible until you suggested it and I looked at the EUI search bar config.