This repository has been archived by the owner on Mar 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MM-12958] Support running two Mattermost instances on the same domai…
…n using subpaths (#2533) * [MM-12958] Support running two Mattermost instances on the same domain using subpaths * leverage getBasePath within LocalStorage * update comments re: clearing cookies * path-scope all local storage keys * fix linting issues
- Loading branch information
Showing
6 changed files
with
166 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. | ||
// See LICENSE.txt for license information. | ||
|
||
// *************************************************************** | ||
// - [number] indicates a test step (e.g. 1. Go to a page) | ||
// - [*] indicates an assertion (e.g. * Check the title) | ||
// - Use element ID when selecting an element. Create one if none. | ||
// *************************************************************** | ||
|
||
/* eslint max-nested-callbacks: ["error", 4] */ | ||
|
||
describe('Cookie with Subpath', () => { | ||
before(() => { | ||
// 1. Remove whitelisted cookies | ||
cy.clearCookie('MMAUTHTOKEN'); | ||
cy.clearCookie('MMUSERID'); | ||
cy.clearCookie('MMCSRF'); | ||
}); | ||
|
||
it('should generate cookie with subpath', () => { | ||
cy.getSubpath().then((subpath) => { | ||
// * Check login page is loaded | ||
cy.get('#login_section').should('be.visible'); | ||
|
||
// 2. Login as user-1 | ||
cy.get('#loginId').should('be.visible').type('user-1'); | ||
cy.get('#loginPassword').should('be.visible').type('user-1'); | ||
cy.get('#loginButton').should('be.visible').click(); | ||
|
||
// * Check login success | ||
cy.get('#channel_view').should('be.visible'); | ||
|
||
// * Check subpath included in url | ||
cy.url().should('include', subpath); | ||
cy.url().should('include', '/channels/town-square'); | ||
|
||
// * Check cookies have correct path parameter | ||
cy.getCookies().should('have.length', 3).each((cookie) => { | ||
if (subpath) { | ||
expect(cookie).to.have.property('path', subpath); | ||
} else { | ||
expect(cookie).to.have.property('path', '/'); | ||
} | ||
}); | ||
}); | ||
}); | ||
}); |
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