-
-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
7538 - Validate cookie when restoring the app from the bfcache (#7575)
Ticket: #7538 This commit: - When the app is restored from the bfcache, the session is validated once more to make sure the user doesn't get stuck in an impossible state.
- Loading branch information
Showing
12 changed files
with
100 additions
and
12 deletions.
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
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
const commonPage = require('../../page-objects/common/common.wdio.page'); | ||
const loginPage = require('../../page-objects/login/login.wdio.page'); | ||
const usersAdminPage = require('../../page-objects/admin/user.wdio.page'); | ||
const auth = require('../../auth')(); | ||
|
||
describe('bfcache', async () => { | ||
beforeEach(async () => { | ||
await loginPage.login({ | ||
username: auth.username, | ||
password: auth.password, | ||
createUser: true, | ||
}); | ||
}); | ||
|
||
afterEach(async () => { | ||
await browser.deleteCookies(); | ||
await browser.url('/'); | ||
}); | ||
|
||
describe('login page', () => { | ||
it('should redirect to the app page when session is valid', async () => { | ||
await commonPage.goToBase(); | ||
expect(await browser.getUrl()).to.contain('/messages'); | ||
await browser.back(); | ||
await browser.waitUntil(async () => (await browser.getUrl()).includes('/messages')); | ||
}); | ||
}); | ||
|
||
describe('webapp', () => { | ||
it('should redirect to login page when session is expired', async () => { | ||
await commonPage.goToPeople(); | ||
await browser.deleteCookies('AuthSession'); | ||
await commonPage.goToMessages(); | ||
const redirectToLoginBtn = await $('#session-expired .btn.submit.btn-primary'); | ||
await redirectToLoginBtn.click(); | ||
expect(await browser.getUrl()).to.contain('/login?redirect='); | ||
await browser.back(); | ||
await browser.waitUntil(async () => (await browser.getUrl()).includes('/login?redirect=')); | ||
}); | ||
}); | ||
|
||
describe('admin app', () => { | ||
it('should redirect to login page when session is expired', async () => { | ||
await usersAdminPage.goToAdminUser(); | ||
await browser.deleteCookies('AuthSession'); | ||
await usersAdminPage.goToAdminUpgrade(); | ||
expect(await browser.getUrl()).to.contain('/login?redirect='); | ||
await browser.back(); | ||
await browser.waitUntil(async () => (await browser.getUrl()).includes('/login?redirect=')); | ||
}); | ||
}); | ||
}); |
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