Skip to content

Commit 8660cc8

Browse files
Issue #9: Add DOCROOT var on Taskfile.
1 parent 21e9d60 commit 8660cc8

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

tasks/playwright.yml

+13-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#file: noinspection YAMLSchemaValidation
22
version: '3'
3+
4+
vars:
5+
DOCROOT: '{{ default "web" .DOCROOT }}'
6+
37
tasks:
48
run:
59
desc: "Runs playwright functional tests."
@@ -45,7 +49,9 @@ tasks:
4549
4650
task playwright:prepare test_id=456
4751
48-
will import the database into `web/sites/simpletest/456/.ht.sqlite`.
52+
will import the database into `web/sites/simpletest/456/.ht.sqlite` or
53+
`docroot/sites/simpletest/456/.ht.sqlite` depending on the DOCROOT
54+
configuration.
4955
preconditions:
5056
- sh: test -f /tmp/sqlite/.ht.sqlite
5157
msg: 'playwright:install needs to be run before tests can run.'
@@ -54,16 +60,16 @@ tasks:
5460
export PLAYWRIGHT_SETUP=1
5561
5662
# Recreate the sites directory.
57-
rm -rf web/sites/simpletest/{{ shellQuote .test_id }}/
58-
mkdir -p web/sites/simpletest/{{ shellQuote .test_id }}/
63+
rm -rf {{ .DOCROOT }}/sites/simpletest/{{ shellQuote .test_id }}/
64+
mkdir -p {{ .DOCROOT }}/sites/simpletest/{{ shellQuote .test_id }}/
5965
mkdir -p /tmp/sqlite/{{ shellQuote .test_id }}/
6066
6167
# On locals, copying in only the files we need (and not all assets
6268
# downloaded via stage file proxy) saves several seconds.
6369
6470
# Copy in settings.php and our services files.
65-
cp -a web/sites/default/*.php web/sites/simpletest/{{ shellQuote .test_id }}/
66-
cp -a web/sites/default/*.yml web/sites/simpletest/{{ shellQuote .test_id }}/
71+
cp -a {{ .DOCROOT }}/sites/default/*.php {{ .DOCROOT }}/sites/simpletest/{{ shellQuote .test_id }}/
72+
cp -a {{ .DOCROOT }}/sites/default/*.yml {{ .DOCROOT }}/sites/simpletest/{{ shellQuote .test_id }}/
6773
6874
# Copy the database.
6975
cp -a /tmp/sqlite/.ht.sqlite /tmp/sqlite/{{ shellQuote .test_id }}/
@@ -115,8 +121,8 @@ tasks:
115121
# Delete the files and settings directories.
116122
# Fast tests that do not require a full page render may finish before Drupal
117123
# has fully written files like aggregated JavaScript to disk.
118-
while [ -d web/sites/simpletest/{{ shellQuote .test_id }}/ ]; do
119-
rm -rf web/sites/simpletest/{{ shellQuote .test_id }}/ 2>/dev/null || true
124+
while [ -d {{ .DOCROOT }}/sites/simpletest/{{ shellQuote .test_id }}/ ]; do
125+
rm -rf {{ .DOCROOT }}/sites/simpletest/{{ shellQuote .test_id }}/ 2>/dev/null || true
120126
done;
121127
122128
# Delete the database.

0 commit comments

Comments
 (0)