Skip to content

Commit

Permalink
[FEATURE] Add TYPO3 environment "Workspaces" (TYPO3-Documentation#236)
Browse files Browse the repository at this point in the history
* [FEATURE] Add TYPO3 environment "Workspaces"

solves TYPO3-Documentation#235

* [FEATURE] Add TYPO3 environment "Workspaces"

Fix Example Configuration

solves TYPO3-Documentation#235

* [BUGFIX] Reset accidental changes to comment of config.yaml

Co-authored-by: lina.wolf <[email protected]>
  • Loading branch information
linawolf and linawolf authored Aug 22, 2022
1 parent 4646e14 commit c46cdb9
Show file tree
Hide file tree
Showing 16 changed files with 259 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .ddev/commands/host/install
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
## Description: (Re-)install the project or a single suite
## Usage: install [flags]
## Example: ddev install\nddev install --force\nddev install --suite-id site-package\nddev install --initialize-suites-only\nddev install --initialize-suites-only --suite-id site-package
## Flags: [{"Name":"force","Shorthand":"f","Usage":"Do not ask any interactive question"},{"Name":"initialize-suites-only","Shorthand":"i","Usage":"Reflect updates of the project composer packages in the suites TYPO3 instances only instead of full (re-)installation."},{"Name":"suite-id","Shorthand":"s","Type":"string","Usage":"Re-install this suite only (core, examples, extension-builder, install, introduction, news, site-package, styleguide). All suites if empty."}]
## Flags: [{"Name":"force","Shorthand":"f","Usage":"Do not ask any interactive question"},{"Name":"initialize-suites-only","Shorthand":"i","Usage":"Reflect updates of the project composer packages in the suites TYPO3 instances only instead of full (re-)installation."},{"Name":"suite-id","Shorthand":"s","Type":"string","Usage":"Re-install this suite only (core, examples, extension-builder, install, introduction, site-package, styleguide, workspaces). All suites if empty."}]


# Initialize local variables
FORCE=""
Expand Down
3 changes: 2 additions & 1 deletion .ddev/commands/web/make-screenshots
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
## Description: Make screenshots via codeception inside the web container
## Usage: make-screenshots
## Example: make-screenshots\nmake-screenshots -s Styleguide\nmake-screenshots -s Styleguide -a actionsIdentifierScreenshots\nmake-screenshots -t TYPO3CMS-Reference-TCA
## Flags: [{"Name":"actions-id","Shorthand":"a","Type":"string","Usage":"Run actions of specific ID only. Actions of all IDs if empty."},{"Name":"suite-id","Shorthand":"s","Type":"string","Usage":"Run actions of specific TYPO3 environment suite ID only (Core, Examples, ExtensionBuilder, Install, Introduction, News, SitePackage, Styleguide). All suites if empty."},{"Name":"target-path","Shorthand":"t","Type":"string","Usage":"Run actions of specific folder and its subfolders only (relative or absolute path). All folders if empty."}]
## Flags: [{"Name":"actions-id","Shorthand":"a","Type":"string","Usage":"Run actions of specific ID only. Actions of all IDs if empty."},{"Name":"suite-id","Shorthand":"s","Type":"string","Usage":"Run actions of specific TYPO3 environment suite ID only (Core, Examples, ExtensionBuilder, Install, Introduction, SitePackage, Styleguide, Workspaces). All suites if empty."},{"Name":"target-path","Shorthand":"t","Type":"string","Usage":"Run actions of specific folder and its subfolders only (relative or absolute path). All folders if empty."}]


SUITE_ID=""
TARGET_PATH=""
Expand Down
1 change: 1 addition & 0 deletions .ddev/config.suites.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ additional_hostnames:
- "news.t3docs-screenshots"
- "site-package.t3docs-screenshots"
- "styleguide.t3docs-screenshots"
- "workspaces.t3docs-screenshots"
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
"t3docs/screenshots": "@dev",
"typo3/cms-introduction": "dev-master",
"typo3/cms-styleguide": "dev-master",
"typo3/cms-workspaces": "dev-master as 11.5.0",
"typo3/site-package": "dev-master",
"typo3/testing-framework": "^6.9.0"
},
Expand Down
68 changes: 67 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ protected function configure(): void
'suite-id',
's',
InputOption::VALUE_OPTIONAL,
'Filter for specific suite ID (Core, Examples, ExtensionBuilder, Install, Introduction, News, SitePackage, Styleguide). ' .
'Filter for specific suite ID (Core, Examples, ExtensionBuilder, Install, Introduction, SitePackage, Styleguide, Workspaces). ' .
'All suite IDs if empty.'
)
->addOption(
Expand Down
16 changes: 16 additions & 0 deletions packages/screenshots/Classes/Configuration/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,22 @@ public function createBasicConfig(): void
['action' => 'cropScreenshot', 'fileName' => "StyleguideDashboardCropRightBottom", 'position' => 'right-bottom', 'height' => 400, 'width' => 400],
],
]
],

'Workspaces' => [
'screenshots' => [
'_default'=> [
['action' => 'resizeWindow', 'width' => 1024, 'height' => 768],
],
'actionsIdentifierWorkspaces' => [
['include' => '_default'],
['action' => 'see', 'text' => 'Workspaces'],
['action' => 'click', 'link' => 'Workspaces'],
['action' => 'click', 'link' => '.t3js-topbar-button-modulemenu'],
['action' => 'switchToContentFrame'],
['action' => 'makeScreenshotOfFullPage', 'fileName' => 'WorkspacesFullPage'],
]
]
]
]
]);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<?php

declare(strict_types=1);
namespace TYPO3\Documentation\Screenshots\Runner\Codeception\Support\Extension;

/*
* This file is part of the TYPO3 project.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/

use Codeception\Event\SuiteEvent;
use TYPO3\CMS\Core\Core\ApplicationContext;
use TYPO3\CMS\Core\Core\Bootstrap;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Object\ObjectManager;
use TYPO3\CMS\Extensionmanager\Utility\InstallUtility;
use TYPO3\TestingFramework\Core\Acceptance\Extension\BackendEnvironment;

/**
* Load all core extensions and EXT:extension_builder and EXT:screenshots
*/
class WorkspacesEnvironment extends BackendEnvironment
{
/**
* @var array
*/
protected $localConfig = [
// Order matters: Align sorting of core extensions with /public/typo3conf/PackageStates.php
'coreExtensionsToLoad' => [
'core',
'scheduler',
'extbase',
'fluid',
'frontend',
'fluid_styled_content',
'filelist',
'impexp',
'form',
'install',
'info',
'linkvalidator',
'reports',
'redirects',
'recordlist',
'backend',
'indexed_search',
'recycler',
'setup',
'rte_ckeditor',
'adminpanel',
'belog',
'beuser',
'dashboard',
'extensionmanager',
'felogin',
'filemetadata',
'lowlevel',
'opendocs',
'seo',
'sys_note',
't3editor',
'tstemplate',
'viewpage',
'workspaces'
],
'testExtensionsToLoad' => [
'typo3conf/ext/screenshots',
],
'xmlDatabaseFixtures' => [
'EXT:screenshots/Classes/Runner/Codeception/Fixtures/StyleguideEnvironment/be_groups.xml',
'EXT:screenshots/Classes/Runner/Codeception/Fixtures/StyleguideEnvironment/be_sessions.xml',
'EXT:screenshots/Classes/Runner/Codeception/Fixtures/StyleguideEnvironment/be_users.xml',
],
];

/**
* Initialize TYPO3 instance
*
* @param SuiteEvent $suiteEvent
*/
public function bootstrapTypo3Environment(SuiteEvent $suiteEvent): void
{
parent::bootstrapTypo3Environment($suiteEvent);

Environment::initialize(
new ApplicationContext('Testing'),
Environment::isCli(),
Environment::isComposerMode(),
Environment::getProjectPath(),
Environment::getPublicPath(),
Environment::getVarPath(),
Environment::getConfigPath(),
Environment::getBackendPath() . '/index.php',
Environment::isWindows() ? 'WINDOWS' : 'UNIX'
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);
namespace TYPO3\Documentation\Screenshots\Runner\Codeception\ExtensionBuilder;

/*
* This file is part of the TYPO3 project.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/

use TYPO3\Documentation\Screenshots\Runner\Codeception\AbstractBaseCest;
use TYPO3\Documentation\Screenshots\Runner\Codeception\Support\Photographer;

/**
* Run all actions of TYPO3 environment "ExtensionBuilder"
*/
class WorkspacesCest extends AbstractBaseCest
{
/**
* @param Photographer $I
*/
public function makeScreenshots(Photographer $I): void
{
$I->reloadBackend('admin');
parent::runSuite($I, 'Workspaces');
}
}
12 changes: 12 additions & 0 deletions packages/screenshots/Classes/Runner/codeception.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,18 @@ suites:
extensions:
enabled:
- TYPO3\Documentation\Screenshots\Runner\Codeception\Support\Extension\StyleguideEnvironment
Workspaces:
actor: Photographer
modules:
enabled:
- TYPO3\TestingFramework\Core\Acceptance\Helper\Login:
sessions:
# This sessions must exist in the database fixture to get a logged in state.
admin: 886526ce72b86870739cc41991144ec1
editor: ff83dfd81e20b34c27d3e97771a4525a
extensions:
enabled:
- TYPO3\Documentation\Screenshots\Runner\Codeception\Support\Extension\WorkspacesEnvironment

namespace: TYPO3\Documentation\Screenshots\Runner\Codeception\Support

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ <h1>TYPO3 Screenshots :: Make</h1>
<f:form.select
id="screenshotsSuite"
name="suiteIdFilter"
options="{Core: 'Core (TYPO3 backend)', Examples: 'Examples (TYPO3 backend + EXT:examples)', ExtensionBuilder: 'Extension Builder (TYPO3 backend + EXT:extension_builder)', Install: 'Install (TYPO3 installation process)', Introduction: 'Introduction (TYPO3 backend + EXT:introduction)', SitePackage: 'Site Package (TYPO3 backend + EXT:site_package)', Styleguide: 'Styleguide (TYPO3 backend + EXT:styleguide)'}"
options="{Core: 'Core (TYPO3 backend)', Examples: 'Examples (TYPO3 backend + EXT:examples)', ExtensionBuilder: 'Extension Builder (TYPO3 backend + EXT:extension_builder)', Install: 'Install (TYPO3 installation process)', Introduction: 'Introduction (TYPO3 backend + EXT:introduction)', SitePackage: 'Site Package (TYPO3 backend + EXT:site_package)', Styleguide: 'Styleguide (TYPO3 backend + EXT:styleguide)', Workspaces: 'Workspaces (TYPO3 backend + EXT:workspaces)'}"
prependOptionLabel="All"
prependOptionValue=""
value="{suiteIdFilter}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public function fetchSuitesCommandReturnsProperJson(): void
['path' => $vfsPath, 'suiteId' => 'News'],
['path' => $vfsPath, 'suiteId' => 'SitePackage'],
['path' => $vfsPath, 'suiteId' => 'Styleguide'],
['path' => $vfsPath, 'suiteId' => 'Workspaces'],
],
json_decode($tester->getDisplay(), true)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ public function getSelectableActionsIds(): void
'actionsIdentifierStyleguideCodeSnippets',
'actionsIdentifierStyleguideDraw',
'actionsIdentifierStyleguideCrop',
'actionsIdentifierWorkspaces',
];
self::assertEquals($expectedActionsIds, $actualActionsIds);
}
Expand Down
1 change: 1 addition & 0 deletions packages/screenshots/Tests/unit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<directory>../Classes/Runner/Codeception/News</directory>
<directory>../Classes/Runner/Codeception/SitePackage</directory>
<directory>../Classes/Runner/Codeception/Styleguide</directory>
<directory>../Classes/Runner/Codeception/Workspaces</directory>
<directory>../Classes/Runner/Codeception/Support/_generated</directory>
<directory>../Classes/Runner/Codeception/Support/Extension</directory>
<file>../Classes/Runner/Codeception/Support/Photographer.php</file>
Expand Down
14 changes: 14 additions & 0 deletions suites/workspaces/dist.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "t3docs/screenshots-workspaces",
"description" : "TYPO3 Screenshots Workspaces",
"require-dev": {
"typo3/cms-workspaces": "dev-master as 11.5.0"
},
"scripts": {
"setup-suite": [
"typo3cms install:setup --no-interaction --database-user-name root --database-user-password root --database-host-name db --admin-user-name admin --admin-password password --site-setup-type site",
"cp res/AdditionalConfiguration.php public/typo3conf/"
]
},
"extra": {}
}
6 changes: 6 additions & 0 deletions suites/workspaces/res/AdditionalConfiguration.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php
/**
* Nginx terminates SSL, so TYPO3 struggles with verifying the request port (443 <-> 80).
* Allow any port by passing here the domain name without defining the port.
*/
$GLOBALS['TYPO3_CONF_VARS']['SYS']['trustedHostsPattern'] = 'workspaces\.t3docs-screenshots\.ddev\.site';

0 comments on commit c46cdb9

Please sign in to comment.