tests/integration/shellbuildtrees.py: Test build shell with script element
diff --git a/tests/integration/project/elements/build-shell/script.bst b/tests/integration/project/elements/build-shell/script.bst
new file mode 100644
index 0000000..d370a02
--- /dev/null
+++ b/tests/integration/project/elements/build-shell/script.bst
@@ -0,0 +1,8 @@
+kind: script
+
+build-depends:
+- base.bst
+
+config:
+  commands:
+  - "echo 'Hi' > /test"
diff --git a/tests/integration/shellbuildtrees.py b/tests/integration/shellbuildtrees.py
index d05504d..3268c3e 100644
--- a/tests/integration/shellbuildtrees.py
+++ b/tests/integration/shellbuildtrees.py
@@ -347,3 +347,21 @@
 
     # Sorry, a buildtree was never cached for this element
     result.assert_main_error(ErrorDomain.APP, "missing-buildtree-artifact-created-without-buildtree")
+
+
+@pytest.mark.datafiles(DATA_DIR)
+@pytest.mark.skipif(not HAVE_SANDBOX, reason="Only available with a functioning sandbox")
+def test_shell_script_element(datafiles, cli_integration):
+    project = str(datafiles)
+    element_name = "build-shell/script.bst"
+
+    result = cli_integration.run(project=project, args=["--cache-buildtrees", "always", "build", element_name])
+    result.assert_success()
+
+    # Run the shell and use the cached buildtree on this script element
+    result = cli_integration.run(
+        project=project, args=["shell", "--build", element_name, "--use-buildtree", "--", "cat", "/test"]
+    )
+
+    result.assert_success()
+    assert "Hi" in result.output