-
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
[Archive Migration] x-pack..dashboard_view_mode #108503
Merged
wayneseymour
merged 3 commits into
master
from
archive-migration/xpack-dashboard_view_mode
Aug 19, 2021
Merged
Changes from all commits
Commits
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,6 @@ export default function ({ getService, getPageObjects }) { | |
const pieChart = getService('pieChart'); | ||
const security = getService('security'); | ||
const testSubjects = getService('testSubjects'); | ||
const dashboardAddPanel = getService('dashboardAddPanel'); | ||
const dashboardPanelActions = getService('dashboardPanelActions'); | ||
const appsMenu = getService('appsMenu'); | ||
const filterBar = getService('filterBar'); | ||
|
@@ -30,91 +29,47 @@ export default function ({ getService, getPageObjects }) { | |
'share', | ||
]); | ||
const dashboardName = 'Dashboard View Mode Test Dashboard'; | ||
const savedSearchName = 'Saved search for dashboard'; | ||
|
||
describe('Dashboard View Mode', function () { | ||
this.tags(['skipFirefox']); | ||
|
||
before('initialize tests', async () => { | ||
log.debug('Dashboard View Mode:initTests'); | ||
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional'); | ||
await esArchiver.load('x-pack/test/functional/es_archives/dashboard_view_mode'); | ||
await kibanaServer.importExport.load( | ||
'x-pack/test/functional/fixtures/kbn_archiver/dashboard_view_mode' | ||
); | ||
await kibanaServer.uiSettings.replace({ defaultIndex: 'logstash-*' }); | ||
await browser.setWindowSize(1600, 1000); | ||
|
||
await PageObjects.common.navigateToApp('discover'); | ||
await PageObjects.timePicker.setHistoricalDataRange(); | ||
await PageObjects.discover.saveSearch(savedSearchName); | ||
|
||
await PageObjects.common.navigateToApp('dashboard'); | ||
await PageObjects.dashboard.clickNewDashboard(); | ||
await dashboardAddPanel.addSavedSearch(savedSearchName); | ||
await PageObjects.dashboard.addVisualizations( | ||
PageObjects.dashboard.getTestVisualizationNames() | ||
}); | ||
|
||
after(async () => { | ||
await kibanaServer.importExport.unload( | ||
'x-pack/test/functional/fixtures/kbn_archiver/dashboard_view_mode' | ||
); | ||
await PageObjects.dashboard.saveDashboard(dashboardName); | ||
const types = [ | ||
'search', | ||
'dashboard', | ||
'visualization', | ||
'search-session', | ||
'core-usage-stats', | ||
'event_loop_delays_daily', | ||
'search-telemetry', | ||
'core-usage-stats', | ||
]; | ||
await kibanaServer.savedObjects.clean({ types }); | ||
}); | ||
|
||
describe('Dashboard viewer', () => { | ||
before('Create logstash data role', async () => { | ||
await PageObjects.settings.navigateTo(); | ||
await testSubjects.click('roles'); | ||
await PageObjects.security.clickCreateNewRole(); | ||
|
||
await testSubjects.setValue('roleFormNameInput', 'logstash-data'); | ||
await PageObjects.security.addIndexToRole('logstash-*'); | ||
await PageObjects.security.addPrivilegeToRole('read'); | ||
await PageObjects.security.clickSaveEditRole(); | ||
}); | ||
|
||
before('Create dashboard only mode user', async () => { | ||
await PageObjects.settings.navigateTo(); | ||
await PageObjects.security.createUser({ | ||
username: 'dashuser', | ||
password: '123456', | ||
confirm_password: '123456', | ||
email: '[email protected]', | ||
full_name: 'dashuser', | ||
roles: ['kibana_dashboard_only_user', 'logstash-data'], | ||
}); | ||
}); | ||
|
||
before('Create user with mixes roles', async () => { | ||
await PageObjects.security.createUser({ | ||
username: 'mixeduser', | ||
password: '123456', | ||
confirm_password: '123456', | ||
email: '[email protected]', | ||
full_name: 'mixeduser', | ||
roles: ['kibana_dashboard_only_user', 'kibana_admin', 'logstash-data'], | ||
}); | ||
}); | ||
|
||
before('Create user with dashboard and superuser role', async () => { | ||
await PageObjects.security.createUser({ | ||
username: 'mysuperuser', | ||
password: '123456', | ||
confirm_password: '123456', | ||
email: '[email protected]', | ||
full_name: 'mixeduser', | ||
roles: ['kibana_dashboard_only_user', 'superuser'], | ||
}); | ||
}); | ||
|
||
after(async () => { | ||
await security.testUser.restoreDefaults(); | ||
}); | ||
|
||
it('shows only the dashboard app link', async () => { | ||
await security.testUser.setRoles( | ||
['test_logstash_reader', 'kibana_dashboard_only_user'], | ||
false | ||
); | ||
|
||
await security.testUser.setRoles(['test_logstash_reader', 'kibana_dashboard_only_user']); | ||
await PageObjects.header.waitUntilLoadingHasFinished(); | ||
await PageObjects.security.forceLogout(); | ||
await PageObjects.security.login('test_user', 'changeme'); | ||
|
||
const appLinks = await appsMenu.readLinks(); | ||
expect(appLinks).to.have.length(1); | ||
expect(appLinks[0]).to.have.property('text', 'Dashboard'); | ||
|
Binary file removed
BIN
-1.89 KB
x-pack/test/functional/es_archives/dashboard_view_mode/data.json.gz
Binary file not shown.
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.
I don't think this
unload
is actually enough in this test. This test file saves a new saved search and a new dashboard. I think we would want to clean those with something like.clean(['search', 'dashboard'[);
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.
@LeeDr Looks like the test user svc is already restoring defaults. Is there more to be done regarding test users?
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.
It's not about the test user, it's about the saved objects. Currently the test does 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.
I think the latest push addresses this boss.