- Issue created by @murz
- π¦π²Armenia murz Yerevan, Armenia
I implemented Drupal endpoints with helper actions for Drupal Functional tests in the module Test Helpers β :
-
/test-helpers-functional/create-user: Creates a new user, with optionally
adding permissions and log-in. -
/test-helpers-functional/login/{name}: Performs a login for the given user. -
/test-helpers-functional/set-envs: Installs and uninstalls one or several
modules at once, optionally with dependencies. -
/test-helpers-functional/get-env/{name}: Sets the environment variables on
the Drupal side. -
/test-helpers-functional/module-installer: Gets the environment variable
value from the Drupal side.
And corresponding Nightwatch commands:
-
thCreateUser(): Creates a new user, with optionally adding permissions and
log-in. -
thLogin(): Performs a login for the given user. -
thInstallModules(): Installs one or several modules at once, optionally with
dependencies. -
thUninstallModules(): Uninstalls one or several modules at once. -
thSetEnvs(): Sets the environment variables on the Drupal side. -
thGetEnv(): Gets the environment variable value from the Drupal side.
Those commands perform actions on the Drupal side, and work many times faster,
than Drupal Core alternatives (drupalInstall(),
drupalCreateUser(), etc).See the usage examples in the included self-tests in the directory
tests/modules/test_helpers_functional/tests/src/Nightwatch/Tests.And the results with this approach are great! The 'before()` step with them can be executed 5-10 times faster! It depends on the number of actions with installing modules, creating users, logins, etc, but in my projects I see acceleration from 20-30 seconds to 3-8 seconds, that is amazing!
So, please review the Test Helpers implementation, and if the approach is okay, I can port them to Drupal Core.
-
- Status changed to Postponed
12 months ago 11:17pm 28 October 2024 - π¦πΊAustralia larowlan π¦πΊπ.au GMT+10
In general I'm in favour of this approach but I would prefer it was done via console commands rather than via a browser. Pretty sure that can be done with custom steps
I think we should postpone this on π Consider dropping Nightwatch in favor of Functional Javascript tests Active as there's no point spending additional effort on it if we choose a different option