|
|
@@ -14,9 +14,9 @@ import { throttledRecompile } from './helpers/compile'
|
|
|
import { beforeWithReRunOnTestRetry } from './helpers/beforeWithReRunOnTestRetry'
|
|
|
|
|
|
describe('Project Sharing', function () {
|
|
|
- if (isExcludedBySharding('CE_CUSTOM_2')) return
|
|
|
+ if (isExcludedBySharding('PRO_CUSTOM_2')) return
|
|
|
ensureUserExists({ email: 'user@example.com' })
|
|
|
- startWith({ withDataDir: true })
|
|
|
+ startWith({ withDataDir: true, pro: true })
|
|
|
|
|
|
let projectName: string
|
|
|
beforeWithReRunOnTestRetry(function () {
|
|
|
@@ -135,22 +135,57 @@ describe('Project Sharing', function () {
|
|
|
cy.findByText('History').should('not.exist')
|
|
|
}
|
|
|
|
|
|
+ function expectCommentAccess() {
|
|
|
+ cy.findByRole('textbox', { name: /Source Editor editing/i }).should(
|
|
|
+ 'contain.text',
|
|
|
+ '\\maketitle'
|
|
|
+ )
|
|
|
+
|
|
|
+ cy.findByText('\\maketitle').parent().dblclick()
|
|
|
+
|
|
|
+ cy.findByRole('button', { name: 'Add comment' }).should('be.visible')
|
|
|
+
|
|
|
+ cy.findByRole('textbox', { name: /Source Editor editing/i }).click()
|
|
|
+ }
|
|
|
+
|
|
|
+ function expectNoCommentAccess() {
|
|
|
+ cy.findByRole('textbox', { name: /Source Editor editing/i }).should(
|
|
|
+ 'contain.text',
|
|
|
+ '\\maketitle'
|
|
|
+ )
|
|
|
+
|
|
|
+ cy.findByText('\\maketitle').parent().dblclick()
|
|
|
+
|
|
|
+ cy.findByRole('button', { name: 'Add comment' }).should('not.exist')
|
|
|
+ cy.findByRole('textbox', { name: /Source Editor editing/i }).click()
|
|
|
+ }
|
|
|
+
|
|
|
function expectFullReadOnlyAccess() {
|
|
|
expectContentReadOnlyAccess()
|
|
|
expectChatAccess()
|
|
|
expectHistoryAccess()
|
|
|
+ expectNoCommentAccess()
|
|
|
}
|
|
|
|
|
|
function expectRestrictedReadOnlyAccess() {
|
|
|
expectContentReadOnlyAccess()
|
|
|
expectNoChatAccess()
|
|
|
expectNoHistoryAccess()
|
|
|
+ expectNoCommentAccess()
|
|
|
+ }
|
|
|
+
|
|
|
+ function expectFullReadAndWriteAccess() {
|
|
|
+ expectContentWriteAccess()
|
|
|
+ expectChatAccess()
|
|
|
+ expectHistoryAccess()
|
|
|
+ expectCommentAccess()
|
|
|
}
|
|
|
|
|
|
- function expectReadAndWriteAccess() {
|
|
|
+ function expectAnonymousReadAndWriteAccess() {
|
|
|
expectContentWriteAccess()
|
|
|
expectChatAccess()
|
|
|
expectHistoryAccess()
|
|
|
+ expectNoCommentAccess()
|
|
|
}
|
|
|
|
|
|
function expectProjectDashboardEntry() {
|
|
|
@@ -209,7 +244,7 @@ describe('Project Sharing', function () {
|
|
|
it('should grant the collaborator write access', () => {
|
|
|
login(email)
|
|
|
openProjectByName(projectName)
|
|
|
- expectReadAndWriteAccess()
|
|
|
+ expectFullReadAndWriteAccess()
|
|
|
expectEditAuthoredAs('You')
|
|
|
expectProjectDashboardEntry()
|
|
|
})
|
|
|
@@ -244,7 +279,7 @@ describe('Project Sharing', function () {
|
|
|
projectName,
|
|
|
email
|
|
|
)
|
|
|
- expectReadAndWriteAccess()
|
|
|
+ expectFullReadAndWriteAccess()
|
|
|
expectEditAuthoredAs('You')
|
|
|
expectProjectDashboardEntry()
|
|
|
})
|
|
|
@@ -254,6 +289,7 @@ describe('Project Sharing', function () {
|
|
|
describe('with OVERLEAF_ALLOW_PUBLIC_ACCESS=false', () => {
|
|
|
describe('wrap startup', () => {
|
|
|
startWith({
|
|
|
+ pro: true,
|
|
|
vars: {
|
|
|
OVERLEAF_ALLOW_PUBLIC_ACCESS: 'false',
|
|
|
},
|
|
|
@@ -266,6 +302,7 @@ describe('Project Sharing', function () {
|
|
|
|
|
|
describe('with OVERLEAF_ALLOW_ANONYMOUS_READ_AND_WRITE_SHARING=true', () => {
|
|
|
startWith({
|
|
|
+ pro: true,
|
|
|
vars: {
|
|
|
OVERLEAF_ALLOW_PUBLIC_ACCESS: 'false',
|
|
|
OVERLEAF_ALLOW_ANONYMOUS_READ_AND_WRITE_SHARING: 'true',
|
|
|
@@ -281,6 +318,7 @@ describe('Project Sharing', function () {
|
|
|
describe('with OVERLEAF_ALLOW_PUBLIC_ACCESS=true', () => {
|
|
|
describe('wrap startup', () => {
|
|
|
startWith({
|
|
|
+ pro: true,
|
|
|
vars: {
|
|
|
OVERLEAF_ALLOW_PUBLIC_ACCESS: 'true',
|
|
|
},
|
|
|
@@ -299,6 +337,7 @@ describe('Project Sharing', function () {
|
|
|
|
|
|
describe('with OVERLEAF_ALLOW_ANONYMOUS_READ_AND_WRITE_SHARING=true', () => {
|
|
|
startWith({
|
|
|
+ pro: true,
|
|
|
vars: {
|
|
|
OVERLEAF_ALLOW_PUBLIC_ACCESS: 'true',
|
|
|
OVERLEAF_ALLOW_ANONYMOUS_READ_AND_WRITE_SHARING: 'true',
|
|
|
@@ -313,7 +352,7 @@ describe('Project Sharing', function () {
|
|
|
|
|
|
it('should grant write access with write link', () => {
|
|
|
openProjectViaLinkSharingAsAnon(linkSharingReadAndWrite)
|
|
|
- expectReadAndWriteAccess()
|
|
|
+ expectAnonymousReadAndWriteAccess()
|
|
|
expectEditAuthoredAs('Anonymous')
|
|
|
})
|
|
|
})
|