Skip to main content
An environment is one server your tests can run against. Every environment is backed by a mode, which decides where that server comes from: Both ship with the plugin. A third mode is something you write yourself — see Writing a mode.

Declaring environments

The name you pass to create becomes the task suffix and the report file name: local gives you plugwrightTestLocal and build/reports/plugwright/local.json. It also names the directory the environment writes to — src/test/e2e/generated/local, where the Paper server for that environment ends up. Two local environments in one build therefore run two separate servers without either one saying where. See Project Layout.
A build script with no environments { } block still works. The flat properties (minecraftVersion, runDir, downloadPlugins, and the rest) describe one implicit local environment, exactly as they did before. See Configuration.

Tasks

Which tasks exist depends on the mode. LocalMode contributes provisioning, cleaning and a server-run task; ExternalMode contributes ping, and nothing that touches files. Tasks for the primaryEnvironment also get an unsuffixed alias, so plugwrightRunServer still means what it used to. plugwrightTest is the exception: it belongs to the matrix.

The matrix

plugwrightTest runs every environment whose includeInMatrix is true, one runner process each, and prints a summary:
It launches the runner itself rather than depending on the per-environment tasks. A dependsOn chain would stop at the first failing environment and hide the results of the rest. Defaults differ by mode on purpose. LocalMode sets includeInMatrix to true — a server that only exists during the run belongs in every run. ExternalMode sets it to false, because a shared stand should not be pulled into someone’s local plugwrightTest unasked.
allowFailure keeps a failing environment from failing the matrix build. The failures are still reported as failures. Calling plugwrightTestStaging directly ignores both flags: an explicit request deserves an honest exit code.

Narrowing the matrix

Running environments in parallel

Off by default, and worth thinking about before you turn it on. Two local Paper servers means twice the -Xmx. Several environments sharing one outbound IP means more join throttling and more ban risk on a public stand. Account pools must not overlap. Output is interleaved, so each environment’s log is also written separately to build/reports/plugwright/<env>.log.

Per-environment test selection

excludeTests skips tests whose name contains any of the given substrings. It is matched against the test name, not the file name:
Skipped tests appear in the report with the reason. Silence would be worse than a failure here: a test that quietly disappears on one environment looks like coverage you don’t have. Tests can also select environments themselves, either by capability or by name. See Test Filtering.

Secrets

Passwords never belong in the config file Gradle writes into build/. Declare them as references instead:
secret.env reads an environment variable, secret.file the first line of a file. Both are resolved by the runner at run time, so the value stays out of the configuration cache and out of build artifacts. secret.systemProperty exists for symmetry but fails at run time — the runner is a separate Node process and cannot see JVM system properties.