Skip to content
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

FTR configurable test users #52431

Merged
Merged
Show file tree
Hide file tree
Changes from 156 commits
Commits
Show all changes
187 commits
Select commit Hold shift + click to select a range
ff432e6
initial implementation of configurable test users
rashmivkulkarni Dec 6, 2019
48617a8
user superuser by default to match master
rashmivkulkarni Dec 6, 2019
dd2a035
referenced the configs in reporting and api integration
rashmivkulkarni Dec 7, 2019
61c7b9c
setting the minimum number of default roles
rashmivkulkarni Dec 7, 2019
6e15338
looking for x-pack tests with users and roles
rashmivkulkarni Dec 9, 2019
190e3f0
add testUserService in dashboard mode tests
rashmivkulkarni Dec 9, 2019
c51415a
running only ciGroup7
rashmivkulkarni Dec 9, 2019
35cea2c
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Dec 9, 2019
9530f18
uncommenting - addign visualization
rashmivkulkarni Dec 9, 2019
56dec72
re-enabling all CI groups to run on CI
rashmivkulkarni Dec 10, 2019
9f932bc
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Dec 10, 2019
884e4fd
reinstating Jenkinsfile
rashmivkulkarni Dec 10, 2019
6ac4486
disable Test user for OIDC config
rashmivkulkarni Dec 10, 2019
ae4f892
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Dec 10, 2019
f065eb8
improved logging and added Roles for OSS tests to get better info on …
rashmivkulkarni Dec 11, 2019
28ab914
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Dec 11, 2019
cf5aa8c
disable test_user for auth tests
rashmivkulkarni Dec 11, 2019
d53fea4
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Dec 11, 2019
7a7c2fc
don't fetch enabledPlugins when testuser disabled
rashmivkulkarni Dec 13, 2019
25ecc05
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Dec 13, 2019
64846ea
Merge remote-tracking branch 'upstream/master' into implement/ftr-con…
rashmivkulkarni Dec 16, 2019
080c41b
fix es-lint
rashmivkulkarni Dec 16, 2019
56cedfd
running oss tests with x-pack enabled
rashmivkulkarni Dec 18, 2019
96445ec
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Dec 18, 2019
47f1dfc
[revertme] build default dist for oss tests
spalger Dec 18, 2019
4fa5c6b
Merge branch 'master' of github.com:elastic/kibana into pr/52431
spalger Dec 18, 2019
67206c2
Merge branch 'master' into implement/ftr-configured-users
elasticmachine Dec 18, 2019
2aae063
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Dec 19, 2019
8b8fcdf
Merge branch 'master' into implement/ftr-configured-users
elasticmachine Dec 20, 2019
669666c
Merge branch 'implement/ftr-configured-users' of github.com:rasroh/ki…
rashmivkulkarni Jan 6, 2020
b2d5dd6
updating NOTICE.txt file as it complained in the kibana intake tests
rashmivkulkarni Jan 6, 2020
314f9aa
updating branch
rashmivkulkarni Jan 6, 2020
769af58
changed to pick OSS builds
rashmivkulkarni Jan 6, 2020
3898a1b
trying a license change to trial
rashmivkulkarni Jan 8, 2020
ec2a30c
switch back to xpack builds
rashmivkulkarni Jan 8, 2020
31146e3
created a new sample data role and used it in homepage tests
rashmivkulkarni Jan 9, 2020
ecf4ad2
reset jenkins file
rashmivkulkarni Jan 13, 2020
8e92b87
revert test/scripts/jenkins_ci_group.sh
rashmivkulkarni Jan 13, 2020
635dc78
testing the date-nanos role for the tests
rashmivkulkarni Jan 14, 2020
c6922d4
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Jan 14, 2020
8a7aeb2
only refresh browser and wait for chrome if we are already on Kibana …
rashmivkulkarni Jan 14, 2020
8056f13
fix large_string test to use minimum set of roles and privileges
rashmivkulkarni Jan 16, 2020
f199129
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Jan 16, 2020
1446e64
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Jan 17, 2020
b1294c1
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Jan 20, 2020
26af27f
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Jan 27, 2020
0d96418
fix for date nanos custom timestamp with a configured role
rashmivkulkarni Jan 28, 2020
fe6a16a
changes to the files with addition of new roles for the test_user
rashmivkulkarni Jan 29, 2020
6c4a2d3
changes to the files with addition of new roles for the test_user
rashmivkulkarni Jan 29, 2020
d3e3908
reverting to OSS changes and few additions to the time_zone test to r…
rashmivkulkarni Jan 29, 2020
8b6492f
changes to security
rashmivkulkarni Feb 3, 2020
a24f0d0
merging upstream
rashmivkulkarni Feb 4, 2020
d57a6c7
changes to the x-pack test to use elastic superuser
rashmivkulkarni Feb 5, 2020
4240e65
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Feb 5, 2020
27d753d
Merge branch 'master' into implement/ftr-configured-users
elasticmachine Feb 6, 2020
b322344
fix for chart_types test
rashmivkulkarni Feb 6, 2020
ef086ce
Merge branch 'implement/ftr-configured-users' of github.com:rasroh/ki…
rashmivkulkarni Feb 6, 2020
09fd78b
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Feb 7, 2020
23e2a68
fixes to area chart , input control test
rashmivkulkarni Feb 10, 2020
0e8da2c
Merge branch 'master' into implement/ftr-configured-users
elasticmachine Feb 10, 2020
08888ba
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Feb 10, 2020
3e5c19d
fix for dashboard filtering test and a new config role
rashmivkulkarni Feb 10, 2020
30d004c
Merge branch 'implement/ftr-configured-users' of github.com:rasroh/ki…
rashmivkulkarni Feb 10, 2020
b59456e
Merge branch 'master' into implement/ftr-configured-users
elasticmachine Feb 10, 2020
ec02491
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Feb 10, 2020
21af9ac
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Feb 11, 2020
b15b1c0
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Feb 12, 2020
152a5e9
changes to handle the x-pack tests
rashmivkulkarni Feb 12, 2020
d15ac89
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Feb 12, 2020
e0d37f0
Merge branch 'implement/ftr-configured-users' of github.com:rasroh/ki…
rashmivkulkarni Feb 12, 2020
354b897
additional role for date nanos mixed
rashmivkulkarni Feb 14, 2020
b628f7f
resolve conflicts and changes to config file
rashmivkulkarni Feb 14, 2020
5868a42
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Feb 14, 2020
4249286
Merge branch 'master' into implement/ftr-configured-users
elasticmachine Feb 18, 2020
825eb89
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Feb 18, 2020
0a4f459
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Feb 18, 2020
0c38975
added the logstash role to the accessibility tests
rashmivkulkarni Feb 18, 2020
053b290
Merge branch 'implement/ftr-configured-users' of github.com:rasroh/ki…
rashmivkulkarni Feb 18, 2020
b78ff8e
removed telemetry setting
rashmivkulkarni Feb 18, 2020
425f388
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Feb 19, 2020
87ee9e4
Merge branch 'master' into implement/ftr-configured-users
elasticmachine Feb 19, 2020
9a15407
Merge branch 'master' into implement/ftr-configured-users
elasticmachine Feb 19, 2020
63498b1
Merge branch 'implement/ftr-configured-users' of github.com:rasroh/ki…
rashmivkulkarni Feb 19, 2020
47ddf1c
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Feb 19, 2020
568a145
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Feb 19, 2020
4093ce9
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Feb 20, 2020
ac0c58e
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Feb 20, 2020
239d101
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Feb 21, 2020
b8fe171
docs+few changes to the tests
rashmivkulkarni Feb 21, 2020
bfa13da
Merge branch 'master' into implement/ftr-configured-users
elasticmachine Feb 22, 2020
dd963d4
Merge branch 'master' into implement/ftr-configured-users
elasticmachine Feb 24, 2020
85ec4da
Merge branch 'master' into implement/ftr-configured-users
elasticmachine Feb 24, 2020
00c8815
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Feb 24, 2020
856030d
removed Page navigation
rashmivkulkarni Feb 24, 2020
eb801f5
removed pageNavigation which was unused
rashmivkulkarni Feb 24, 2020
7e3cf67
Merge branch 'implement/ftr-configured-users' of github.com:rasroh/ki…
rashmivkulkarni Feb 24, 2020
7827591
test/accessibility/apps/management.ts
rashmivkulkarni Feb 24, 2020
9f05cb8
update management.ts
rashmivkulkarni Feb 24, 2020
3015b36
aria label, and other changes
rashmivkulkarni Feb 25, 2020
88a7543
Merge branch 'implement/ftr-configured-users' of github.com:rasroh/ki…
rashmivkulkarni Feb 25, 2020
6a7dc2e
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Feb 25, 2020
d46032a
accidentally checked in a piped file with results.
rashmivkulkarni Feb 25, 2020
e938207
accidentally checked in a piped file with results.
rashmivkulkarni Feb 25, 2020
277f24a
accidentally checked in a piped file with results.
rashmivkulkarni Feb 25, 2020
5ce2625
accidentally checked in a piped file with results.
rashmivkulkarni Feb 25, 2020
d22d699
accidentally checked in a piped file with results.
rashmivkulkarni Feb 25, 2020
c80531b
accidentally checked in a piped file with results.
rashmivkulkarni Feb 25, 2020
c894601
accidentally checked in a piped file with results.
rashmivkulkarni Feb 25, 2020
e3b8bf8
accidentally checked in a piped file with results.
rashmivkulkarni Feb 25, 2020
0f6efae
reverted
rashmivkulkarni Feb 25, 2020
088cfaf
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Feb 25, 2020
e3ad421
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Feb 25, 2020
4b00323
Merge branch 'implement/ftr-configured-users' of github.com:rasroh/ki…
rashmivkulkarni Feb 25, 2020
2315b2e
unloading of logstash data, fixing aria label
rashmivkulkarni Feb 25, 2020
f4937c3
aria-label
rashmivkulkarni Feb 25, 2020
1a0da8e
Merge branch 'master' into implement/ftr-configured-users
elasticmachine Feb 26, 2020
487c73e
added the required role
rashmivkulkarni Feb 26, 2020
79a4e25
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Feb 26, 2020
9bda865
Merge branch 'implement/ftr-configured-users' of github.com:rasroh/ki…
rashmivkulkarni Feb 26, 2020
2d8d64a
fix for tsvb chart
rashmivkulkarni Feb 27, 2020
0366066
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Feb 27, 2020
a704840
fix for sample data test reverted home_page pageobject file
rashmivkulkarni Feb 27, 2020
79e3a23
changes to sample data test and visualize index file to incorporate O…
rashmivkulkarni Feb 27, 2020
e84cddf
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Feb 27, 2020
e374c0c
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Feb 27, 2020
480b8ad
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Mar 2, 2020
3d79f43
Merge branch 'master' into implement/ftr-configured-users
elasticmachine Mar 2, 2020
fdf090d
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Mar 3, 2020
e92eea0
changes to describe() and some more changes to incorporate in setting…
rashmivkulkarni Mar 3, 2020
a303241
Merge branch 'implement/ftr-configured-users' of github.com:rasroh/ki…
rashmivkulkarni Mar 3, 2020
4ea6329
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Mar 3, 2020
ba22ffd
Merge branch 'master' into implement/ftr-configured-users
elasticmachine Mar 4, 2020
1f3f47f
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Mar 4, 2020
cdd6cde
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Mar 5, 2020
dcbf4ca
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Mar 6, 2020
c6a2b88
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Mar 9, 2020
af452e7
Merge branch 'implement/ftr-configured-users' of github.com:rasroh/ki…
rashmivkulkarni Mar 9, 2020
bb573a3
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Mar 10, 2020
8254749
re-adding the after()
rashmivkulkarni Mar 10, 2020
33de9f3
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Mar 10, 2020
b451fb8
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Mar 10, 2020
f76cd40
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Mar 11, 2020
a63f895
Merge branch 'master' into implement/ftr-configured-users
elasticmachine Mar 11, 2020
a7813d6
removed unwanted roles
rashmivkulkarni Mar 11, 2020
5f87f95
Merge branch 'implement/ftr-configured-users' of github.com:rasroh/ki…
rashmivkulkarni Mar 11, 2020
c740fd1
replaced kibana_user with kibana_admin
rashmivkulkarni Mar 11, 2020
192087b
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Mar 11, 2020
c5b7822
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Mar 12, 2020
bf934ff
added the check of deprecated kibana_user
rashmivkulkarni Mar 12, 2020
b56d10e
testing with kibana_admin role
rashmivkulkarni Mar 12, 2020
7d9c1a4
fixed merge conflicts and pulled master
rashmivkulkarni Mar 12, 2020
3c2a294
fix for discover test
rashmivkulkarni Mar 12, 2020
402177b
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Mar 12, 2020
3719a5a
incorporated the review comments
rashmivkulkarni Mar 12, 2020
7532ca9
incorporated the review comments
rashmivkulkarni Mar 12, 2020
e3bcd20
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Mar 12, 2020
99ccef9
Merge branch 'master' into implement/ftr-configured-users
elasticmachine Mar 12, 2020
c026428
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Mar 13, 2020
9d792de
incorporate review comments and added restoreDefaults()
rashmivkulkarni Mar 13, 2020
6030183
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Mar 13, 2020
c983d33
Merge branch 'implement/ftr-configured-users' of github.com:rasroh/ki…
rashmivkulkarni Mar 13, 2020
ab5758f
Merge branch 'master' into implement/ftr-configured-users
elasticmachine Mar 13, 2020
23c29cf
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Mar 13, 2020
7da0bb5
removed describe.only
rashmivkulkarni Mar 13, 2020
8e55301
Merge branch 'implement/ftr-configured-users' of github.com:rasroh/ki…
rashmivkulkarni Mar 13, 2020
d9a078a
reverted the OSS logic change I had here- pulled into seperate PR
rashmivkulkarni Mar 13, 2020
607ebdd
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Mar 13, 2020
5baf269
incorporated the review comments
rashmivkulkarni Mar 13, 2020
46b8bbb
incorporated review changes
rashmivkulkarni Mar 13, 2020
8e80963
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Mar 13, 2020
09ad350
Merge branch 'master' into implement/ftr-configured-users
elasticmachine Mar 14, 2020
c0cdb37
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Mar 16, 2020
18710ea
adding hidden=true to find hidden kibanaChrome
rashmivkulkarni Mar 16, 2020
2e42ef7
Merge branch 'master' of https://github.com/elastic/kibana into imple…
rashmivkulkarni Mar 16, 2020
066182c
Merge branch 'implement/ftr-configured-users' of github.com:rasroh/ki…
rashmivkulkarni Mar 16, 2020
8b6b60c
Merge remote-tracking branch 'upstream/master' into implement/ftr-con…
rashmivkulkarni Mar 16, 2020
6828d58
change field.test.tsx to be same as that of master branch
rashmivkulkarni Mar 16, 2020
be650be
Merge branch 'master' into implement/ftr-configured-users
elasticmachine Mar 16, 2020
568bf5f
Merge branch 'master' into implement/ftr-configured-users
elasticmachine Mar 17, 2020
39564aa
Merge branch 'master' into implement/ftr-configured-users
elasticmachine Mar 17, 2020
b776705
Merge branch 'master' into implement/ftr-configured-users
elasticmachine Mar 17, 2020
84fd9c2
Merge branch 'master' into implement/ftr-configured-users
elasticmachine Mar 17, 2020
74ed42a
Merge branch 'master' into implement/ftr-configured-users
elasticmachine Mar 17, 2020
44ea132
Merge branch 'master' into implement/ftr-configured-users
elasticmachine Mar 17, 2020
0fcf2fd
Merge branch 'master' into implement/ftr-configured-users
elasticmachine Mar 17, 2020
4fe9d22
Merge branch 'master' into implement/ftr-configured-users
elasticmachine Mar 17, 2020
eb9174a
Merge branch 'master' into implement/ftr-configured-users
elasticmachine Mar 17, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions docs/developer/core/development-functional-tests.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,25 @@ To run tests on Firefox locally, use `config.firefox.js`:
node scripts/functional_test_runner --config test/functional/config.firefox.js
-----------

[float]
===== Using the test_user service

Tests should run at the positive security boundry condition, meaning that they should be run with the mimimum privileges required (and documented) and not as the superuser.
This prevents the type of regression where additional privleges accidentally become required to perform the same action.

The functional UI tests now default to logging in with a user named `test_user` and the roles of this user can be changed dynamically without logging in and out.

In order to achieve this a new service was introduced called `createTestUserService` (see `test/common/services/security/test_user.ts`). The purpose of this test user service is to create roles defined in the test config files and setRoles() or restoreDefaults().

An example of how to set the role like how its defined below:

`await security.testUser.setRoles(['kibana_user', 'kibana_date_nanos']);`

Here we are setting the `test_user` to have the `kibana_user` role and also role access to a specific data index (`kibana_date_nanos`).

Tests should normally setRoles() in the before() and restoreDefaults() in the after().


[float]
===== Anatomy of a test file

Expand Down
15 changes: 15 additions & 0 deletions packages/kbn-test/src/functional_test_runner/lib/config/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,5 +248,20 @@ export const schema = Joi.object()
fixedHeaderHeight: Joi.number().default(50),
})
.default(),

// settings for the security service if there is no defaultRole defined, then default to superuser role.
security: Joi.object()
.keys({
roles: Joi.object().default(),
defaultRoles: Joi.array()
.items(Joi.string())
.when('$primary', {
rashmivkulkarni marked this conversation as resolved.
Show resolved Hide resolved
is: true,
then: Joi.array().min(1),
})
.default(['superuser']),
disableTestUser: Joi.boolean(),
})
.default(),
})
.default();

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ export class Field extends PureComponent<FieldProps> {
ref={this.changeImageForm}
fullWidth
data-test-subj={`advancedSetting-editField-${name}`}
aria-label={id}
rashmivkulkarni marked this conversation as resolved.
Show resolved Hide resolved
/>
);
}
Expand Down
32 changes: 2 additions & 30 deletions test/accessibility/apps/discover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,7 @@ export default function({ getService, getPageObjects }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const inspector = getService('inspector');
const docTable = getService('docTable');
const filterBar = getService('filterBar');
const TEST_COLUMN_NAMES = ['@message'];
const TEST_FILTER_COLUMN_NAMES = [
['extension', 'jpg'],
['geo.src', 'IN'],
];

describe('Discover', () => {
before(async () => {
Expand Down Expand Up @@ -63,6 +57,7 @@ export default function({ getService, getPageObjects }: FtrProviderContext) {
await a11y.testAppSnapshot();
});

// skipping the test for new because we can't fix it right now
it.skip('Click on new to clear the search', async () => {
await PageObjects.discover.clickNewSearchButton();
await a11y.testAppSnapshot();
Expand Down Expand Up @@ -99,6 +94,7 @@ export default function({ getService, getPageObjects }: FtrProviderContext) {
await a11y.testAppSnapshot();
});

// unable to validate on EUI pop-over
rashmivkulkarni marked this conversation as resolved.
Show resolved Hide resolved
it('click share button', async () => {
await PageObjects.share.clickShareTopNavButton();
await a11y.testAppSnapshot();
Expand All @@ -113,29 +109,5 @@ export default function({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.discover.closeSidebarFieldFilter();
await a11y.testAppSnapshot();
});

it('Add a field from sidebar', async () => {
for (const columnName of TEST_COLUMN_NAMES) {
await PageObjects.discover.clickFieldListItemAdd(columnName);
}
await a11y.testAppSnapshot();
});

it.skip('Add more fields from sidebar', async () => {
for (const [columnName, value] of TEST_FILTER_COLUMN_NAMES) {
await PageObjects.discover.clickFieldListItem(columnName);
await PageObjects.discover.clickFieldListPlusFilter(columnName, value);
}
await a11y.testAppSnapshot();
});

// Context view test
it('should open context view on a doc', async () => {
await docTable.clickRowToggle();
await (await docTable.getRowActions())[0].click();
await a11y.testAppSnapshot();
});

// Adding rest of the tests after https://github.com/elastic/kibana/issues/53888 is resolved
});
}
2 changes: 0 additions & 2 deletions test/common/services/security/role.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export class Role {
`Expected status code of 204, received ${status} ${statusText}: ${util.inspect(data)}`
);
}
this.log.debug(`created role ${name}`);
}

public async delete(name: string) {
Expand All @@ -56,6 +55,5 @@ export class Role {
)}`
);
}
this.log.debug(`deleted role ${name}`);
}
}
8 changes: 7 additions & 1 deletion test/common/services/security/security.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,21 @@ import { Role } from './role';
import { User } from './user';
import { RoleMappings } from './role_mappings';
import { FtrProviderContext } from '../../ftr_provider_context';
import { createTestUserService } from './test_user';

export function SecurityServiceProvider({ getService }: FtrProviderContext) {
export async function SecurityServiceProvider(context: FtrProviderContext) {
const { getService } = context;
const log = getService('log');
const config = getService('config');
const url = formatUrl(config.get('servers.kibana'));
const role = new Role(url, log);
const user = new User(url, log);
const testUser = await createTestUserService(role, user, context);

return new (class SecurityService {
role = new Role(url, log);
roleMappings = new RoleMappings(url, log);
user = new User(url, log);
rashmivkulkarni marked this conversation as resolved.
Show resolved Hide resolved
rashmivkulkarni marked this conversation as resolved.
Show resolved Hide resolved
testUser = testUser;
})();
}
94 changes: 94 additions & 0 deletions test/common/services/security/test_user.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { Role } from './role';
import { User } from './user';
import { FtrProviderContext } from '../../ftr_provider_context';
import { Browser } from '../../../functional/services/browser';
import { TestSubjects } from '../../../functional/services/test_subjects';
rashmivkulkarni marked this conversation as resolved.
Show resolved Hide resolved

export async function createTestUserService(
role: Role,
user: User,
{ getService, hasService }: FtrProviderContext
) {
const log = getService('log');
const config = getService('config');
// @ts-ignore browser service is not normally available in common.
const browser: Browser | void = hasService('browser') && getService('browser');
const testSubjects: TestSubjects | void =
// @ts-ignore testSubject service is not normally available in common.
hasService('testSubjects') && getService('testSubjects');
const kibanaServer = getService('kibanaServer');

const enabledPlugins = config.get('security.disableTestUser')
? []
: await kibanaServer.plugins.getEnabledIds();
const isEnabled = () => {
return enabledPlugins.includes('security') && !config.get('security.disableTestUser');
};
if (isEnabled()) {
log.debug(
'====================================================creating roles and users========================='
);
rashmivkulkarni marked this conversation as resolved.
Show resolved Hide resolved
for (const [name, definition] of Object.entries(config.get('security.roles'))) {
// create the defined roles (need to map array to create roles)
await role.create(name, definition);
}
try {
// delete the test_user if present (will it error if the user doesn't exist?)
await user.delete('test_user');
} catch (exception) {
log.debug('no test user to delete');
}

// create test_user with username and pwd
log.debug(`default roles = ${config.get('security.defaultRoles')}`);
await user.create('test_user', {
password: 'changeme',
roles: config.get('security.defaultRoles'),
full_name: 'test user',
});
}

return new (class TestUser {
async restoreDefaults() {
if (isEnabled()) {
await this.setRoles(config.get('security.defaultRoles'));
}
}
rashmivkulkarni marked this conversation as resolved.
Show resolved Hide resolved

async setRoles(roles: string[]) {
if (isEnabled()) {
log.debug(`set roles = ${roles}`);
await user.create('test_user', {
password: 'changeme',
roles,
full_name: 'test user',
});

if (browser && testSubjects) {
if (await testSubjects.exists('kibanaChrome')) {
await browser.refresh();
await testSubjects.find('kibanaChrome', config.get('timeouts.find') * 10);
}
}
}
}
})();
}
7 changes: 5 additions & 2 deletions test/functional/apps/context/_date_nanos.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ const TEST_STEP_SIZE = 3;
export default function({ getService, getPageObjects }) {
const kibanaServer = getService('kibanaServer');
const docTable = getService('docTable');
const security = getService('security');
const PageObjects = getPageObjects(['common', 'context', 'timePicker', 'discover']);
const esArchiver = getService('esArchiver');

describe('context view for date_nanos', () => {
before(async function() {
await security.testUser.setRoles(['kibana_admin', 'kibana_date_nanos']);
await esArchiver.loadIfNeeded('date_nanos');
await kibanaServer.uiSettings.replace({ defaultIndex: TEST_INDEX_PATTERN });
await kibanaServer.uiSettings.update({
Expand All @@ -39,8 +41,9 @@ export default function({ getService, getPageObjects }) {
});
});

after(function unloadMakelogs() {
return esArchiver.unload('date_nanos');
after(async function unloadMakelogs() {
await security.testUser.restoreDefaults();
await esArchiver.unload('date_nanos');
});

it('displays predessors - anchor - successors in right order ', async function() {
Expand Down
11 changes: 7 additions & 4 deletions test/functional/apps/context/_date_nanos_custom_timestamp.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ const TEST_STEP_SIZE = 3;
export default function({ getService, getPageObjects }) {
const kibanaServer = getService('kibanaServer');
const docTable = getService('docTable');
const security = getService('security');
const PageObjects = getPageObjects(['common', 'context', 'timePicker', 'discover']);
const esArchiver = getService('esArchiver');
// skipped due to a recent change in ES that caused search_after queries with data containing
// custom timestamp formats like in the testdata to fail
describe.skip('context view for date_nanos with custom timestamp', () => {
before(async function() {
await security.testUser.setRoles(['kibana_admin', 'kibana_date_nanos_custom']);
await esArchiver.loadIfNeeded('date_nanos_custom');
await kibanaServer.uiSettings.replace({ defaultIndex: TEST_INDEX_PATTERN });
await kibanaServer.uiSettings.update({
Expand All @@ -40,10 +42,6 @@ export default function({ getService, getPageObjects }) {
});
});

after(function unloadMakelogs() {
return esArchiver.unload('date_nanos_custom');
});

it('displays predessors - anchor - successors in right order ', async function() {
await PageObjects.context.navigateTo(TEST_INDEX_PATTERN, '1');
const actualRowsText = await docTable.getRowsText();
Expand All @@ -54,5 +52,10 @@ export default function({ getService, getPageObjects }) {
];
expect(actualRowsText).to.eql(expectedRowsText);
});

after(async function() {
await security.testUser.restoreDefaults();
await esArchiver.unload('date_nanos_custom');
});
});
}
2 changes: 2 additions & 0 deletions test/functional/apps/dashboard/dashboard_filtering.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export default function({ getService, getPageObjects }) {
const filterBar = getService('filterBar');
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const security = getService('security');
const dashboardPanelActions = getService('dashboardPanelActions');
const PageObjects = getPageObjects(['common', 'dashboard', 'header', 'visualize', 'timePicker']);

Expand All @@ -41,6 +42,7 @@ export default function({ getService, getPageObjects }) {

before(async () => {
await esArchiver.load('dashboard/current/kibana');
await security.testUser.setRoles(['kibana_admin', 'test_logstash_reader', 'animals']);
rashmivkulkarni marked this conversation as resolved.
Show resolved Hide resolved
await kibanaServer.uiSettings.replace({
defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c',
});
Expand Down
1 change: 1 addition & 0 deletions test/functional/apps/dashboard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export default function({ getService, loadTestFile }) {

async function loadCurrentData() {
await browser.setWindowSize(1300, 900);
await esArchiver.unload('logstash_functional');
rashmivkulkarni marked this conversation as resolved.
Show resolved Hide resolved
await esArchiver.loadIfNeeded('dashboard/current/data');
}

Expand Down
2 changes: 0 additions & 2 deletions test/functional/apps/dashboard/time_zones.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import expect from '@kbn/expect';

export default function({ getService, getPageObjects }) {
const pieChart = getService('pieChart');
const browser = getService('browser');
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const PageObjects = getPageObjects(['dashboard', 'timePicker', 'settings', 'common']);
Expand All @@ -48,7 +47,6 @@ export default function({ getService, getPageObjects }) {

after(async () => {
await kibanaServer.uiSettings.replace({ 'dateFormat:tz': 'UTC' });
await browser.refresh();
});

it('Exported dashboard adjusts EST time to UTC', async () => {
Expand Down
Loading