Skip to content

Commit

Permalink
Add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasnorre committed Oct 23, 2024
1 parent 3cf3baf commit 6b0202e
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 53 deletions.
28 changes: 0 additions & 28 deletions Tests/Acceptance-Playwright/Tests/backend_flush_processes.spec.js

This file was deleted.

55 changes: 55 additions & 0 deletions Tests/Acceptance-Playwright/Tests/backend_module_process.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import {test, expect} from '@playwright/test';
import * as helpers from './helpers';

async function addQueueEntries(page, config, depth = '0') {
await helpers.openCrawlerModuleStartCrawling(page)
await page.getByRole('treeitem', {name: 'Welcome'}).locator('div').nth(2).click();
await expect(page.locator('#nprogress')).toHaveCount(0);
await page.locator('iframe[name="list_frame"]').contentFrame().locator('select[name="configurationSelection[]"]').selectOption(config);
await page.locator('iframe[name="list_frame"]').contentFrame().locator('select[name="crawlingDepth"]').selectOption(depth);
await page.locator('iframe[name="list_frame"]').contentFrame().getByRole('button', {name: 'Crawl URLs'}).click();
await expect(page.locator('#nprogress')).toHaveCount(0);
}

test('Can Flush all processes', async ({page}) => {
await helpers.loginBackend(page)
await addQueueEntries(page, 'default', '99');
await helpers.openCrawlerModuleCrawlerProcesses(page)
await page.locator('iframe[name="list_frame"]').contentFrame().getByRole('link', {name: 'Add process'}).click();
await page.locator('iframe[name="list_frame"]').contentFrame().getByRole('link', {name: 'Add process'}).click();
await expect(page.locator('iframe[name="list_frame"]').contentFrame().locator('#processes tbody tr')).toHaveCount(2)
await page.locator('iframe[name="list_frame"]').contentFrame().getByRole('link', {name: 'Flush all processes'}).click();
await expect(page.locator('iframe[name="list_frame"]').contentFrame().locator('#processes tbody tr')).toHaveCount(0)
});

test('Can disable and enable crawler', async ({page}) => {
await helpers.loginBackend(page)
await helpers.openCrawlerModuleCrawlerProcesses(page);
await page.locator('iframe[name="list_frame"]').contentFrame().getByRole('link', {name: 'Stop all processes and'}).click();
await expect(page.locator('iframe[name="list_frame"]').contentFrame().locator('body')).toContainText('Enable crawling');
await page.locator('iframe[name="list_frame"]').contentFrame().getByRole('link', {name: 'Enable crawling'}).click();
await expect(page.locator('iframe[name="list_frame"]').contentFrame().locator('body')).toContainText('Stop all processes and disable crawling');
});

test('Can add process', async ({page}) => {
await helpers.loginBackend(page)
await addQueueEntries(page, 'default')
await expect(page.locator('iframe[name="list_frame"]').contentFrame().getByText('URLs submitted')).toContainText('1 URLs submitted');
await helpers.openCrawlerModuleCrawlerProcesses(page);
await expect(page.locator('iframe[name="list_frame"]').contentFrame().getByText('CLI-Path')).toContainText('CLI-Path');
await page.locator('iframe[name="list_frame"]').contentFrame().getByRole('link', {name: 'Add process'}).click();
await expect(page.locator('iframe[name="list_frame"]').contentFrame().getByText('New process has been started')).toContainText('New process has been started');
});

test('Process successful', async ({page}) => {
await helpers.loginBackend(page)
await addQueueEntries(page, 'default')
await expect(page.locator('iframe[name="list_frame"]').contentFrame().getByText('URLs submitted')).toContainText('1 URLs submitted');
await helpers.openCrawlerModuleCrawlerProcesses(page);
await expect(page.locator('iframe[name="list_frame"]').contentFrame().getByText('CLI-Path')).toContainText('CLI-Path');
await page.locator('iframe[name="list_frame"]').contentFrame().getByRole('link', {name: 'Add process'}).click();
await expect(page.locator('iframe[name="list_frame"]').contentFrame().getByText('New process has been started')).toContainText('New process has been started');

await page.locator('iframe[name="list_frame"]').contentFrame().getByRole('link', {name: 'Show finished and terminated processes'}).click();
await expect(page.locator('iframe[name="list_frame"]').contentFrame().getByText('Process completed successfully')).toContainText('Process completed successfully');
});
46 changes: 21 additions & 25 deletions Tests/Acceptance/BackendModule/BackendModuleCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,9 @@ public function updateUrlButton(BackendModule $I, Admin $adminStep, PageTree $pa
// Implemented in Playwright for TYPO3 V13
public function CrawlerConfigurationWithExcludePageSixPlusThree(
BackendModule $I,
Admin $adminStep,
PageTree $pageTree
): void
{
Admin $adminStep,
PageTree $pageTree
): void {
$adminStep->loginAsAdmin();
$I->openCrawlerBackendModuleStartCrawling($adminStep, $pageTree);
$I->selectOption('configurationSelection[]', 'excludepages-6-plus-3');
Expand All @@ -99,10 +98,9 @@ public function CrawlerConfigurationWithExcludePageSixPlusThree(

public function EnsureNoUserGroupsAndNoProcInstAreDisplayed(
BackendModule $I,
Admin $adminStep,
PageTree $pageTree
): void
{
Admin $adminStep,
PageTree $pageTree
): void {
$adminStep->loginAsAdmin();
$I->openCrawlerBackendModuleStartCrawling($adminStep, $pageTree);
$I->selectOption('configurationSelection[]', 'excludepages-6-plus-3');
Expand All @@ -123,6 +121,7 @@ public function updateUrlButtonSetDepth(BackendModule $I, Admin $adminStep, Page
$I->waitForElementVisible('.table-striped', 15);
}

// Implemented in Playwright for TYPO3 V13
public function crawlerAddProcess(BackendModule $I, Admin $adminStep, PageTree $pageTree): void
{
$adminStep->loginAsAdmin();
Expand All @@ -134,6 +133,7 @@ public function crawlerAddProcess(BackendModule $I, Admin $adminStep, PageTree $
$I->addProcessOnProcess($adminStep, $pageTree);
}

// Implemented in Playwright for TYPO3 V13
public function processSuccessful(BackendModule $I, Admin $adminStep, PageTree $pageTree): void
{
$adminStep->loginAsAdmin();
Expand Down Expand Up @@ -187,10 +187,9 @@ public function crawlerUrlsContinueAndShowLog(BackendModule $I, Admin $adminStep

public function crawlerUrlsContinueAndShowLogCheckDepthDropdown(
BackendModule $I,
Admin $adminStep,
PageTree $pageTree
): void
{
Admin $adminStep,
PageTree $pageTree
): void {
$adminStep->loginAsAdmin();
$I->openCrawlerBackendModuleStartCrawling($adminStep, $pageTree);
$I->selectOption('configurationSelection[]', 'default');
Expand All @@ -211,11 +210,10 @@ public function crawlerUrlsContinueAndShowLogCheckDepthDropdown(

public function flushVisibleEntries(
BackendModule $I,
Admin $adminStep,
PageTree $pageTree,
ModalDialog $modalDialog
): void
{
Admin $adminStep,
PageTree $pageTree,
ModalDialog $modalDialog
): void {
// Will test twice, but done to avoid duplicate code
$this->crawlerUrlsContinueAndShowLogCheckDepthDropdown($I, $adminStep, $pageTree);
$I->click('Flush entire queue');
Expand Down Expand Up @@ -247,10 +245,9 @@ public function flushVisibleEntries(

public function CrawlerLogDisplayAndItemsPerPageDropdowns(
BackendModule $I,
Admin $adminStep,
PageTree $pageTree
): void
{
Admin $adminStep,
PageTree $pageTree
): void {
$adminStep->loginAsAdmin();
$I->openCrawlerBackendModuleCrawlerLog($adminStep, $pageTree);
$I->selectOption('moduleMenu', 'Log');
Expand Down Expand Up @@ -324,10 +321,9 @@ public function CrawlerLogResultLogAndFEVarsCheckboxes(BackendModule $I, Admin $

public function CrawlerLogDropDownAndCheckboxesCombined(
BackendModule $I,
Admin $adminStep,
PageTree $pageTree
): void
{
Admin $adminStep,
PageTree $pageTree
): void {
$adminStep->loginAsAdmin();
$I->openCrawlerBackendModuleCrawlerLog($adminStep, $pageTree);

Expand Down

0 comments on commit 6b0202e

Please sign in to comment.