Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/8.3' into 8.4
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsdesign committed Sep 27, 2024
2 parents 9bbea2a + cb36295 commit c4a3b3b
Show file tree
Hide file tree
Showing 30 changed files with 235 additions and 144 deletions.
8 changes: 3 additions & 5 deletions .sauce/config1Dimension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ showConsoleLog: true
sauce:
region: us-west-1
concurrency: 1 # Controls how many suites are executed at the same time.
retries: 3
# todo fix and enable retries
retries: 0
metadata:
tags:
- e2e
Expand All @@ -23,16 +24,13 @@ suites:
- "Tests/IntegrationTests/Fixtures/1Dimension/*.e2e.js"
platformName: "Windows 10"
screenResolution: "1280x1024"
smartRetry:
failedOnly: true
- name: "One dimensional Tests in Firefox on MacOS"
# todo use chrome here and fix ci https://github.com/neos/neos-ui/issues/3591
browserName: "firefox"
src:
- "Tests/IntegrationTests/Fixtures/1Dimension/*.e2e.js"
platformName: "macOS 13"
screenResolution: "1440x900"
smartRetry:
failedOnly: true
npm:
dependencies:
- testcafe-react-selectors
Expand Down
10 changes: 3 additions & 7 deletions .sauce/config2Dimension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: testcafe
sauce:
region: us-west-1
concurrency: 1 # Controls how many suites are executed at the same time.
retries: 3
retries: 0
metadata:
tags:
- e2e
Expand All @@ -22,16 +22,12 @@ suites:
- "Tests/IntegrationTests/Fixtures/2Dimension/*.e2e.js"
platformName: "Windows 10"
screenResolution: "1280x1024"
smartRetry:
failedOnly: true
- name: "Two dimensional Tests in Firefox on MacOS"
browserName: "firefox"
- name: "Two dimensional Tests in Chrome on MacOS"
browserName: "chrome"
src:
- "Tests/IntegrationTests/Fixtures/2Dimension/*.e2e.js"
platformName: "macOS 13"
screenResolution: "1440x900"
smartRetry:
failedOnly: true
npm:
dependencies:
- testcafe-react-selectors
Expand Down
2 changes: 1 addition & 1 deletion Build/Jenkins/update-neos-ui-compiled.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export NODE_OPTIONS="--max-old-space-size=4096"

nvm install && nvm use
make clean && make setup
NEOS_UI_VERSION="${GIT_TAG:-${GIT_BRANCH}-dev}" make build-production
NEOS_UI_VERSION="${GIT_TAG:-${GIT_BRANCH#*/}-dev}" make build-production

rm -Rf tmp_compiled_pkg
git clone [email protected]:neos/neos-ui-compiled.git tmp_compiled_pkg
Expand Down
10 changes: 9 additions & 1 deletion Classes/Aspects/AugmentationAspect.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,15 @@ public function contentElementAugmentation(JoinPointInterface $joinPoint)
$attributes['data-__neos-node-contextpath'] = $node->getContextPath();
$attributes['data-__neos-fusion-path'] = $fusionPath;

return $this->htmlAugmenter->addAttributes($content, $attributes);
// Define all attribute names as exclusive via the `exclusiveAttributes` parameter, to prevent the data of
// two different nodes to be concatenated into the attributes of a single html node.
// This way an outer div is added, if the wrapped content already has node related data-attributes set.
return $this->htmlAugmenter->addAttributes(
$content,
$attributes,
'div',
array_keys($attributes)
);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ test:

## Executes integration tests on saucelabs.
test-e2e-saucelabs:
bash Tests/IntegrationTests/e2e-saucelabs.sh
bash Tests/IntegrationTests/e2e.sh --saucelabs

## Executes integration tests locally.
test-e2e:
bash Tests/IntegrationTests/e2e.sh chrome:--disable-search-engine-choice-screen
bash Tests/IntegrationTests/e2e.sh --browser chrome:--disable-search-engine-choice-screen

## Executes integration tests locally in a docker-compose setup.
test-e2e-docker: build-e2e-testing
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ To speed up the e2e-test workflow/feedback loop you can start the system under t
* The neos dev instance is available at `localhost:8081`
* To enter the container run `docker compose -f Tests/IntegrationTests/docker-compose.neos-dev-instance.yaml exec php bash`
* `yarn run testcafe <browser> <testFile> <optional flags>`
* for example, this runs all tests in chrome: (NOTE starting with Chrome 127, --disable-search-engine-choice-screen is needed)
* for example, this runs all tests in chrome: (NOTE starting with Chrome 127, --disable-search-engine-choice-screen is needed until https://github.com/DevExpress/testcafe/pull/8248 is released)
`yarn run testcafe chrome:--disable-search-engine-choice-screen Tests/IntegrationTests/Fixtures/1Dimension`
* some helpful optional flags are
* `-T 'sidebars'` - grep tests by pattern and only execute those
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ test('SelectBox opens below and breaks out of the creation dialog if there\'s en

test('SelectBox opens above in creation dialog if there\'s not enough space below.', async t => {
await t
.resizeWindow(1200, 768)
.click(Selector('#neos-PageTree-AddNode'))
.click(ReactSelector('NodeTypeItem').withExactText('SelectBox opens above'))
.click(ReactSelector('NodeCreationDialog SelectBox'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
groups:
test:
label: Test
# move it before the general document meta-data so there is
# also space below when opening it in the e2e tests
position: start
properties:
TextField:
type: string
Expand Down
59 changes: 0 additions & 59 deletions Tests/IntegrationTests/e2e-saucelabs.sh

This file was deleted.

163 changes: 133 additions & 30 deletions Tests/IntegrationTests/e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,148 @@

set -ex

if [ -z "$1" ]; then
echo "No testcafe browser supplied, e.g. 'chrome:headless'"
fi
# Global variables
BROWSER=""
USE_SAUCELABS=false

cd ../../..
# Function to parse arguments and save values to global variables
parse_arguments() {
while [[ $# -gt 0 ]]; do
case "$1" in
-h|--help)
print_usage_information
exit 0
;;
-s|--saucelabs)
USE_SAUCELABS=true
;;
-b|--browser)
BROWSER="$2"
shift
;;
*)
echo "Unknown option: $1"
print_usage_information
exit 1
;;
esac
shift
done
}

rm -rf DummyDistributionPackages || true
mv DistributionPackages DummyDistributionPackages
mkdir DistributionPackages
print_usage_information() {
cat <<EOF
Usage: $0 [options]
ln -s "../Packages/Application/Neos.Neos.Ui/Tests/IntegrationTests/SharedNodeTypesPackage" DistributionPackages/Neos.TestNodeTypes
Options:
-h, --help Show this help message
-s, --saucelabs Run in remote browser from SauceLabs configured in .sauce
-b, --browser Run in specified local browser
EOF
}

for fixture in Packages/Application/Neos.Neos.Ui/Tests/IntegrationTests/Fixtures/*/; do
echo "$fixture"
function check_testcafe_browser {
if [ -z "$BROWSER" ] && [ "$USE_SAUCELABS" = false ]; then
echo "No testcafe browser supplied, e.g. 'chrome:headless'"
exit 1
fi
}

ln -s "../${fixture}SitePackage" DistributionPackages/Neos.TestSite
function check_saucelabs_setup {
if [ "$USE_SAUCELABS" = true ]; then
check_saucectl_variables
check_saucectl_installed
fi
}

# TODO: optimize this
composer reinstall neos/test-nodetypes
composer reinstall neos/test-site
# make sure neos is installed even if patching led to the removal (bug)
composer update neos/neos-development-collection
./flow flow:cache:flush --force
./flow flow:cache:warmup
./flow configuration:show --path Neos.ContentRepository.contentDimensions
# Check if SAUCE_USERNAME and SAUCE_ACCESS_KEY are set
function check_saucectl_variables {
if [[ -n "$SAUCE_USERNAME" && -n "$SAUCE_ACCESS_KEY" ]]; then
echo "SAUCE_USERNAME and SAUCE_ACCESS_KEY are set. Configuring saucectl..."
#saucectl configure
else
echo "SAUCE_USERNAME or SAUCE_ACCESS_KEY is not set. Skipping saucectl configuration."
exit 1
fi
}

if ./flow site:list | grep -q 'Node name'; then
./flow site:prune '*'
function check_saucectl_installed {
if ! command -v saucectl &> /dev/null; then
echo "saucectl is not installed. Installing saucectl..."
# Install saucectl via npm (assuming npm is installed)
npm install -g saucectl
fi
./flow site:import --package-key=Neos.TestSite
./flow resource:publish
}

# parse dimension from fixture file name
function get_dimension() {
dimension=$(basename "$1")
echo "$dimension"
}

# Function that gets a fixture as parameter. With the fixture we
# load the related site package and import the site.
function initialize_neos_site() {
local fixture=$1

cd Packages/Application/Neos.Neos.Ui
yarn run testcafe "$1" "../../../${fixture}*.e2e.js" \
--selector-timeout=10000 --assertion-timeout=30000
ln -s "../${fixture}SitePackage" DistributionPackages/Neos.TestSite

composer reinstall neos/test-nodetypes
composer reinstall neos/test-site
# make sure neos is installed even if patching led to the removal (bug)
composer update neos/neos-development-collection
./flow flow:cache:flush --force
./flow flow:cache:warmup
./flow configuration:show --path Neos.ContentRepository.contentDimensions

if ./flow site:list | grep -q 'Node name'; then
./flow site:prune '*'
fi
./flow site:import --package-key=Neos.TestSite
./flow resource:publish
}

function run_tests() {
cd ../../..
rm -f DistributionPackages/Neos.TestSite

done
rm -rf DummyDistributionPackages || true
mv DistributionPackages DummyDistributionPackages
mkdir DistributionPackages

ln -s "../Packages/Application/Neos.Neos.Ui/Tests/IntegrationTests/SharedNodeTypesPackage" DistributionPackages/Neos.TestNodeTypes

for fixture in Packages/Application/Neos.Neos.Ui/Tests/IntegrationTests/Fixtures/*/; do
dimension=$(get_dimension "$fixture")
initialize_neos_site "$fixture"

# go tp the Neos.Neos.Ui package and run the tests
cd Packages/Application/Neos.Neos.Ui

if [[ $BROWSER ]]; then
yarn run testcafe "$BROWSER" "../../../${fixture}*.e2e.js" --selector-timeout=10000 --assertion-timeout=30000 || hasFailure=1
fi

if [[ $USE_SAUCELABS ]]; then
saucectl run --config .sauce/config${dimension}.yml || hasFailure=1
fi

# cd back to the root directory and clean up
cd ../../..
rm -f DistributionPackages/Neos.TestSite
done

rm -rf DistributionPackages
mv DummyDistributionPackages DistributionPackages

if [[ $hasFailure -eq 1 ]] ; then
exit 1
fi
}

parse_arguments "$@"

# check if incoming parameters are correct
check_testcafe_browser
check_saucelabs_setup

rm -rf DistributionPackages
mv DummyDistributionPackages DistributionPackages
run_tests
10 changes: 2 additions & 8 deletions esbuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ const options = {
legalComments: "linked",
loader: {
'.js': 'tsx',
'.svg': 'dataurl',
'.dataurl.svg': 'dataurl',
'.svg': 'text',
'.vanilla-css': 'css',
'.woff2': 'file'
},
Expand All @@ -53,13 +54,6 @@ const options = {
}
})

// load ckeditor icons as plain text and not via `.svg: dataurl`
// (currently neccessary for the table select handle icon)
onLoad({filter: /node_modules\/@ckeditor\/.*\.svg$/}, async ({path}) => ({
contents: (await require('fs/promises').readFile(path)).toString(),
loader: 'text'
}))

// prefix Fontawesome with "neos-" to prevent clashes with customer Fontawesome
onLoad({filter: /@fortawesome\/fontawesome-svg-core\/styles\.css$/}, async ({path}) => {
const contents = (await require('fs/promises').readFile(path)).toString();
Expand Down
Loading

0 comments on commit c4a3b3b

Please sign in to comment.