Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/Listeners/BeforeTemplateRenderedListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\EventDispatcher\IEventListener;
use OCP\Files\Template\ITemplateManager;
use OCP\IUserSession;
use OCP\Util;

Expand All @@ -29,6 +30,7 @@ public function __construct(
private UserFolderHelper $userFolderHelper,
private IEventDispatcher $eventDispatcher,
private IInitialState $initialState,
private ITemplateManager $templateManager,
) {
}

Expand Down Expand Up @@ -62,5 +64,6 @@ public function handle(Event $event): void {

// Provide Collectives user folder as initial state
$this->initialState->provideInitialState('user_folder', $userFolder);
$this->initialState->provideInitialState('templates', $this->templateManager->listCreators());
}
}
28 changes: 28 additions & 0 deletions playwright/e2e/page-content.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

import { runOcc } from '@nextcloud/e2e-test-server/docker'
import { expect, mergeTests } from '@playwright/test'
import { test as createCollectiveTest } from '../support/fixtures/create-collectives.ts'
import { test as editorTest } from '../support/fixtures/editor.ts'

const test = mergeTests(createCollectiveTest, editorTest)

test.describe('Page content', () => {
test('create whiteboard from attachments menu', async ({ user, page, collective, editor }) => {
test.slow()
await runOcc(['app:enable', '--force', 'whiteboard'])
const collectivePage = await collective.createPage({ title: 'Page with whiteboard', user, page })
await collectivePage.open(true)

editor.setMode(true)
await editor.clickMenu('attachment', 'New whiteboard')
await expect(editor.getContent()
.locator('.widget-file.whiteboard'))
.toBeVisible()

await runOcc(['app:disable', 'whiteboard'])
})
})
24 changes: 19 additions & 5 deletions playwright/support/sections/EditorSection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,35 @@ import { expect } from '@playwright/test'

export class EditorSection {
public isEdit: boolean
public readonly editorContent: Locator
public readonly readerContent: Locator
public readonly editor: Locator
public readonly reader: Locator

constructor(public readonly page: Page) {
this.isEdit = false
this.editorContent = this.page.locator('[data-cy-collectives="editor"] .ProseMirror')
this.readerContent = this.page.locator('[data-cy-collectives="reader"] .ProseMirror')
this.editor = this.page.locator('[data-cy-collectives="editor"]')
this.reader = this.page.locator('[data-cy-collectives="reader"]')
}

public setMode(edit: boolean) {
this.isEdit = edit
}

public getMenu(name: string): Locator {
return this.editor.getByRole('button', { name })
}

public getMenuItem(name: string): Locator {
return this.editor.getByRole('menuitem', { name })
}

public async clickMenu(menu: string, item: string): Promise<void> {
await this.getMenu(menu).click()
await this.getMenuItem(item).click()
}

public getContent() {
return this.isEdit ? this.editorContent : this.readerContent
return (this.isEdit ? this.editor : this.reader)
.locator('.ProseMirror')
}

public async hasImage(filename: string): Promise<void> {
Expand Down
Loading