Skip to content
Snippets Groups Projects
Commit 48ab012f authored by jurgenhaas's avatar jurgenhaas
Browse files

Always overwrite config files that are ignored by git

Add cypress script
Add some cypress directories to .gitignore
parent 6d6c2325
No related branches found
No related tags found
1 merge request!56Merging develop into main
Pipeline #743373 passed
This commit is part of merge request !56. Comments created here will be created in the context of that merge request.
......@@ -256,11 +256,8 @@ class Handler extends BaseHandler {
/**
* Configure Drupal Project for Docker.
*
* @param bool $overwrite
* Whether to overwrite existing config files.
*/
public function configureProject(bool $overwrite = FALSE): void {
public function configureProject(): void {
// We only do the fancy stuff for developers.
if (!$this->isDevMode()) {
......@@ -387,7 +384,7 @@ class Handler extends BaseHandler {
}
continue;
}
if (($overwrite && empty($def['add2git'])) || !$fs->exists($file)) {
if (empty($def['add2git']) || !$fs->exists($file)) {
$source = isset($def['source']) && is_file($pluginRoot . '/templates/' . $def['source']) ?
$pluginRoot . '/templates/' . $def['source'] :
$pluginRoot . '/templates/' . ($def['source'] ?? '') . $template . '.twig';
......@@ -454,6 +451,11 @@ class Handler extends BaseHandler {
$this->gitIgnore('tests/backstop/backstop_data/html_report');
$this->gitLFS('tests/backstop/**/*.png');
// Ignore some Cypress directories
$this->gitIgnore('tests/cypress/downloads');
$this->gitIgnore('tests/cypress/screenshots');
$this->gitIgnore('tests/cypress/videos');
if (getenv('LAKEDROPS_BUILD_NG') !== 'yes') {
$this->updateTraefik();
}
......@@ -561,23 +563,27 @@ class Handler extends BaseHandler {
'dest' => $projectRoot . '/tests',
],
];
if ($this->config->readValue(['cypress', 'enable'])) {
$files['cypress.config.js'] = [
'source' => 'tests/',
'dest' => $projectRoot . '/tests',
'add2git' => TRUE,
];
$files['commands.js'] = [
'source' => 'tests/cypress/support/',
'dest' => $projectRoot . '/tests/cypress/support',
'add2git' => TRUE,
];
$files['e2e.js'] = [
'source' => 'tests/cypress/support/',
'dest' => $projectRoot . '/tests/cypress/support',
'add2git' => TRUE,
];
}
$files['cypress.config.js'] = [
'source' => 'tests/',
'dest' => $projectRoot . '/tests',
'add2git' => TRUE,
];
$files['cypress-run'] = [
'source' => 'tests/',
'dest' => $projectRoot . '/tests',
'add2git' => FALSE,
'mode' => 0775,
];
$files['commands.js'] = [
'source' => 'tests/cypress/support/',
'dest' => $projectRoot . '/tests/cypress/support',
'add2git' => TRUE,
];
$files['e2e.js'] = [
'source' => 'tests/cypress/support/',
'dest' => $projectRoot . '/tests/cypress/support',
'add2git' => TRUE,
];
if (getenv('LAKEDROPS_BUILD_NG') === 'yes') {
if ($this->config->readValue(['backup', 'enable'])) {
$files['config.yaml'] = [
......
......@@ -30,7 +30,7 @@ class UpdateCommand extends BaseCommand {
parent::execute($input, $output);
/** @var Handler $handler */
$handler = $this->handler;
$handler->configureProject(TRUE);
$handler->configureProject();
return 0;
}
......
#!/bin/bash
set -e
NAME={{ projectname }}_cypress_e2e
ID=$(docker container ls --all -q -f name=^${NAME}$)
if [[ -n ${ID} ]]; then
echo "Ataching to existing process ..."
docker start --attach --interactive ${NAME}
else
docker run -u 1000:$(stat -c "%g" /var/run/docker.sock) --rm --name=${NAME} \
--network host \
--env CYPRESS_baseUrl={{ projectprotocol }}://{{ projectdomain }}{{ projectport }} \
--env CYPRESS_mailhogUrl={{ projectprotocol }}://mailhog-{{ projectdomain }}{{ projectport }} \
--env PHP_CONTAINER={{ projectname }}-php-1 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $(php /usr/local/bin/volume.php --none)/tests/:/e2e \
-w /e2e \
registry.lakedrops.com/docker/cypress:latest \
cypress run --browser firefox --project /e2e
fi
EC=$?
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment