-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Graph] Fix functional tests #47053
Merged
flash1293
merged 17 commits into
elastic:master
from
flash1293:graph/enable-functional-tests
Oct 9, 2019
Merged
[Graph] Fix functional tests #47053
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
df1ea74
re-enable graph tests
flash1293 391959a
stabilize new graph navigation
flash1293 d48ea4b
Merge remote-tracking branch 'upstream/master' into graph/enable-func…
flash1293 9a9cacd
fix functional tests for new html structure
flash1293 ddc5fbf
Merge remote-tracking branch 'upstream/master' into graph/enable-func…
flash1293 be3646b
fix style parser
flash1293 348e1b9
Merge remote-tracking branch 'upstream/master' into graph/enable-func…
flash1293 3473fc8
Merge remote-tracking branch 'upstream/master' into graph/enable-func…
flash1293 6a3df14
fix functional tests due to UI changes
flash1293 f130165
wait for guidance panel instead of sleeping
flash1293 ab027a6
Merge branch 'master' into graph/enable-functional-tests
elasticmachine a2aa243
Merge remote-tracking branch 'upstream/master' into graph/enable-func…
flash1293 4bfaa4f
run x-pack-ciGroup1 20x times
dmlemeshko 89e5950
Merge branch 'graph/enable-functional-tests' of github.com:flash1293/…
flash1293 9bb0c3d
Merge remote-tracking branch 'upstream/master' into graph/enable-func…
flash1293 cae13ee
wait for dom changes instead of sleeping
flash1293 fbada9c
Revert "run x-pack-ciGroup1 20x times"
flash1293 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,8 +13,7 @@ export default function({ getService, getPageObjects }: FtrProviderContext) { | |
const esArchiver = getService('esArchiver'); | ||
const browser = getService('browser'); | ||
|
||
// FLAKY: https://github.com/elastic/kibana/issues/45317 | ||
describe.skip('graph', function() { | ||
describe('graph', function() { | ||
before(async () => { | ||
await browser.setWindowSize(1600, 1000); | ||
log.debug('load graph/secrepo data'); | ||
|
@@ -47,67 +46,56 @@ export default function({ getService, getPageObjects }: FtrProviderContext) { | |
'/blog/wp-admin/', | ||
]; | ||
|
||
const expectedConnectionWidth: Record<string, Record<string, number>> = { | ||
'/blog/wp-admin/': { wp: 2, blog: 5.51581 }, | ||
const expectedConnections: Record<string, Record<string, boolean>> = { | ||
'/blog/wp-admin/': { wp: true, blog: true }, | ||
wp: { | ||
blog: 2, | ||
'202.136.75.194': 2, | ||
'login.php': 2, | ||
admin: 2, | ||
'/test/wp-admin/': 2, | ||
'/wp-login.php': 2, | ||
'80.5.27.16': 2, | ||
'/wordpress/wp-admin/': 2, | ||
'190.154.27.54': 2, | ||
'187.131.21.37': 2, | ||
'181.113.155.46': 2, | ||
blog: true, | ||
'202.136.75.194': true, | ||
'login.php': true, | ||
admin: true, | ||
'/test/wp-admin/': true, | ||
'/wp-login.php': true, | ||
'80.5.27.16': true, | ||
'/wordpress/wp-admin/': true, | ||
'190.154.27.54': true, | ||
'187.131.21.37': true, | ||
'181.113.155.46': true, | ||
}, | ||
admin: { test: 2, blog: 2, '/blog/wp-admin/': 2 }, | ||
'/test/wp-admin/': { admin: 2 }, | ||
test: { wp: 2, '/test/wp-admin/': 8.54514 }, | ||
wordpress: { wp: 2, admin: 2.0311 }, | ||
'/wordpress/wp-admin/': { wordpress: 9.70794, admin: 2.30771 }, | ||
admin: { test: true, blog: true, '/blog/wp-admin/': true }, | ||
'/test/wp-admin/': { admin: true }, | ||
test: { wp: true, '/test/wp-admin/': true }, | ||
wordpress: { wp: true, admin: true }, | ||
'/wordpress/wp-admin/': { wordpress: true, admin: true }, | ||
}; | ||
|
||
async function buildGraph() { | ||
log.debug('select index pattern secrepo*'); | ||
await PageObjects.graph.selectIndexPattern('secrepo*'); | ||
// wait for the saved object to be loaded | ||
// TODO this race condition will be removed with eui-ification | ||
// of graph bar | ||
await PageObjects.common.sleep(1000); | ||
// select fields url.parts, url, params and src | ||
await PageObjects.graph.addField('url.parts'); | ||
await PageObjects.graph.addField('url'); | ||
await PageObjects.graph.addField('params'); | ||
await PageObjects.graph.addField('src'); | ||
await PageObjects.graph.addFields(['url.parts', 'url', 'params', 'src']); | ||
await PageObjects.graph.query('admin'); | ||
await PageObjects.common.sleep(8000); | ||
} | ||
|
||
it('should show correct node labels', async function() { | ||
await PageObjects.graph.selectIndexPattern('secrepo*'); | ||
await buildGraph(); | ||
const { nodes } = await PageObjects.graph.getGraphObjects(); | ||
const circlesText = nodes.map(({ label }) => label); | ||
expect(circlesText.length).to.equal(expectedNodes.length); | ||
expect(circlesText).to.eql(expectedNodes); | ||
circlesText.forEach(circleText => { | ||
expect(expectedNodes.includes(circleText)).to.be(true); | ||
}); | ||
}); | ||
|
||
it('should show correct connections', async function() { | ||
const epsilon = Number.EPSILON; | ||
const expectedConnectionCount = Object.values(expectedConnectionWidth) | ||
const expectedConnectionCount = Object.values(expectedConnections) | ||
.map(connections => Object.values(connections).length) | ||
.reduce((acc, n) => acc + n, 0); | ||
const { edges } = await PageObjects.graph.getGraphObjects(); | ||
expect(edges.length).to.be(expectedConnectionCount); | ||
edges.forEach(edge => { | ||
const from = edge.sourceNode.label!; | ||
const to = edge.targetNode.label!; | ||
// fuzzy matching to take floating point rounding issues into account | ||
expect(expectedConnectionWidth[from][to]).to.be.within( | ||
edge.width - epsilon, | ||
edge.width + epsilon | ||
); | ||
expect(expectedConnections[from][to]).to.be(true); | ||
}); | ||
}); | ||
|
||
|
@@ -122,11 +110,14 @@ export default function({ getService, getPageObjects }: FtrProviderContext) { | |
const { nodes } = await PageObjects.graph.getGraphObjects(); | ||
const circlesText = nodes.map(({ label }) => label); | ||
expect(circlesText.length).to.equal(expectedNodes.length); | ||
expect(circlesText).to.eql(expectedNodes); | ||
circlesText.forEach(circleText => { | ||
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. Don't validate the order of nodes because it doesn't matter |
||
expect(expectedNodes.includes(circleText)).to.be(true); | ||
}); | ||
}); | ||
|
||
it('should create new Graph workspace', async function() { | ||
await PageObjects.graph.newGraph(); | ||
await PageObjects.graph.selectIndexPattern('secrepo*'); | ||
const { nodes, edges } = await PageObjects.graph.getGraphObjects(); | ||
expect(nodes).to.be.empty(); | ||
expect(edges).to.be.empty(); | ||
|
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
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.
After syncing with @markharwood it doesn't make sense to validate specific line lengths because the exact numbers can change because of a lot of things.