Both ship with the plugin. A third mode is something you write yourself — see Writing a mode.
Declaring environments
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
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:
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
-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:
Secrets
Passwords never belong in the config file Gradle writes intobuild/. 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.