mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 13:13:45 +01:00
Ensure add comment tooltip doesnt show up without comment permissions (#27273)
* Ensure add comment tooltip doesnt show up without comment permissions * disable comment option when no permissions in new editor * add e2e tests * use server pro for project sharing * use findByRole for add comment * remove .only GitOrigin-RevId: fbef78e0db7678a00d6c602069e16ddeaf23b2f3
This commit is contained in:
committed by
Copybot
parent
7c97cbbfe4
commit
9228f2248b
@@ -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 expectReadAndWriteAccess() {
|
||||
function expectFullReadAndWriteAccess() {
|
||||
expectContentWriteAccess()
|
||||
expectChatAccess()
|
||||
expectHistoryAccess()
|
||||
expectCommentAccess()
|
||||
}
|
||||
|
||||
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')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user