forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add screenshot tests for reset session page (elastic#148443)
- Loading branch information
1 parent
2dfa17c
commit 58ac314
Showing
3 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
Binary file added
BIN
+69.3 KB
x-pack/test/security_functional/screenshots/baseline/reset_session_page.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
55 changes: 55 additions & 0 deletions
55
x-pack/test/security_functional/tests/login_selector/reset_session_page.ts
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import expect from '@kbn/expect'; | ||
import { FtrProviderContext } from '../../ftr_provider_context'; | ||
|
||
export default function ({ getService, getPageObjects, updateBaselines }: FtrProviderContext) { | ||
const screenshots = getService('screenshots'); | ||
const browser = getService('browser'); | ||
const security = getService('security'); | ||
const PageObjects = getPageObjects(['security', 'common']); | ||
|
||
describe('reset session page', function () { | ||
const userWithoutPermissions = { username: 'user_without_permissions', password: 'changeme' }; | ||
|
||
before(async () => { | ||
// We use a really small window to minimize differences across os's and browsers. | ||
await browser.setScreenshotSize(1000, 500); | ||
|
||
await security.user.create(userWithoutPermissions.username, { | ||
password: userWithoutPermissions.password, | ||
roles: [], | ||
}); | ||
}); | ||
|
||
beforeEach(async () => { | ||
// Logout needs to happen before anything else to avoid flaky behavior | ||
await PageObjects.security.forceLogout(); | ||
}); | ||
|
||
after(async () => { | ||
// Clean up after ourselves | ||
await security.user.delete(userWithoutPermissions.username); | ||
await PageObjects.security.forceLogout(); | ||
}); | ||
|
||
it('compare screenshot', async () => { | ||
await PageObjects.security.loginSelector.login('basic', 'basic1', { | ||
username: userWithoutPermissions.username, | ||
password: userWithoutPermissions.password, | ||
expectedLoginResult: 'error', | ||
}); | ||
|
||
const percentDifference = await screenshots.compareAgainstBaseline( | ||
'reset_session_page', | ||
updateBaselines | ||
); | ||
expect(percentDifference).to.be.lessThan(0.022); | ||
}); | ||
}); | ||
} |