-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Forget session on window close (#33040)
- Loading branch information
1 parent
4991617
commit a337503
Showing
4 changed files
with
77 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'@rocket.chat/meteor': patch | ||
--- | ||
|
||
Fixed an issue related to setting Accounts_ForgetUserSessionOnWindowClose, this setting was not working as expected. | ||
|
||
The new meteor 2.16 release introduced a new option to configure the Accounts package and choose between the local storage or session storage. They also changed how Meteor.\_localstorage works internally. Due to these changes in Meteor, our setting to use session storage wasn't working as expected. This PR fixes this issue and configures the Accounts package according to the workspace settings. |
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
55 changes: 55 additions & 0 deletions
55
apps/meteor/tests/e2e/account-forgetSessionOnWindowClose.spec.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 @@ | ||
import { DEFAULT_USER_CREDENTIALS } from './config/constants'; | ||
import { Registration } from './page-objects'; | ||
import { test, expect } from './utils/test'; | ||
|
||
test.describe.serial('Forget session on window close setting', () => { | ||
let poRegistration: Registration; | ||
|
||
test.beforeEach(async ({ page }) => { | ||
poRegistration = new Registration(page); | ||
|
||
await page.goto('/home'); | ||
}); | ||
|
||
test.describe('Setting off', async () => { | ||
test.beforeAll(async ({ api }) => { | ||
await api.post('/settings/Accounts_ForgetUserSessionOnWindowClose', { value: false }); | ||
}); | ||
|
||
test('Login using credentials and reload to stay logged in', async ({ page, context }) => { | ||
await poRegistration.username.type('user1'); | ||
await poRegistration.inputPassword.type(DEFAULT_USER_CREDENTIALS.password); | ||
await poRegistration.btnLogin.click(); | ||
|
||
await expect(page.locator('role=heading[name="Welcome to Rocket.Chat"]')).toBeVisible(); | ||
|
||
const newPage = await context.newPage(); | ||
await newPage.goto('/home'); | ||
|
||
await expect(newPage.locator('role=heading[name="Welcome to Rocket.Chat"]')).toBeVisible(); | ||
}); | ||
}); | ||
|
||
test.describe('Setting on', async () => { | ||
test.beforeAll(async ({ api }) => { | ||
await api.post('/settings/Accounts_ForgetUserSessionOnWindowClose', { value: true }); | ||
}); | ||
|
||
test.afterAll(async ({ api }) => { | ||
await api.post('/settings/Accounts_ForgetUserSessionOnWindowClose', { value: false }); | ||
}); | ||
|
||
test('Login using credentials and reload to get logged out', async ({ page, context }) => { | ||
await poRegistration.username.type('user1'); | ||
await poRegistration.inputPassword.type(DEFAULT_USER_CREDENTIALS.password); | ||
await poRegistration.btnLogin.click(); | ||
|
||
await expect(page.locator('role=heading[name="Welcome to Rocket.Chat"]')).toBeVisible(); | ||
|
||
const newPage = await context.newPage(); | ||
await newPage.goto('/home'); | ||
|
||
await expect(newPage.locator('role=button[name="Login"]')).toBeVisible(); | ||
}); | ||
}); | ||
}); |