Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ This project adheres to [Semantic Versioning](http://semver.org/).

## [unreleased] Unreleased

### Fixed

- Updated `activatePlugin` and `deactivatePlugin` methods in `WPBrowser` and `WPWebDriver` modules to use WordPress 6.5+ compatible selectors

## [4.5.5] 2025-08-15;

### Changed

- Better `WPLoader` module output in exceptions (thanks @BrianHenryIE).
Expand Down
8 changes: 2 additions & 6 deletions src/Module/WPBrowser.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,8 @@ public function grabCookiesWithPattern(string $cookiePattern): ?array
public function activatePlugin(string|array $pluginSlug): void
{
foreach ((array)$pluginSlug as $plugin) {
$this->checkOption('//*[@data-slug="' . $plugin . '"]/th/input');
$this->click('a#activate-' . $plugin);
}
$this->selectOption('action', 'activate-selected');
$this->click("#doaction");
}

/**
Expand All @@ -113,9 +111,7 @@ public function activatePlugin(string|array $pluginSlug): void
public function deactivatePlugin(string|array $pluginSlug): void
{
foreach ((array) $pluginSlug as $plugin) {
$this->checkOption('//*[@data-slug="' . $plugin . '"]/th/input');
$this->click('a#deactivate-' . $plugin);
}
$this->selectOption('action', 'deactivate-selected');
$this->click('#doaction');
}
}
5 changes: 4 additions & 1 deletion src/Module/WPLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -1096,7 +1096,10 @@ private function includeCorePHPUniteSuiteBootstrapFile(): void

// The inclusion of the test bootstrap file, or a WordPress file included by it, called `exit` or `die`.
// Jump in on the flow to provide a meaningful message to the user.
throw new ModuleException(__CLASS__, 'WordPress bootstrap failed.' . PHP_EOL . ($buffer ?: $this->bootstrapOutput));
throw new ModuleException(
__CLASS__,
'WordPress bootstrap failed.' . PHP_EOL . ($buffer ?: $this->bootstrapOutput)
);
}

$buffer = trim($buffer);
Expand Down
18 changes: 6 additions & 12 deletions src/Module/WPWebDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,10 @@ public function grabFullUrl(): string
public function deactivatePlugin(string|array $pluginSlug): void
{
foreach ((array)$pluginSlug as $plugin) {
$option = '//*[@data-slug="' . $plugin . '"]/th/input';
$this->scrollTo($option, 0, -40);
$this->checkOption($option);
$selector = 'a#deactivate-' . $plugin;
$this->scrollTo($selector, 0, -40);
$this->click($selector);
}
$this->scrollTo('select[name="action"]', 0, -40);
$this->selectOption('action', 'deactivate-selected');
$this->click("#doaction");
}

/**
Expand Down Expand Up @@ -255,12 +252,9 @@ public function activatePlugin(string|array $pluginSlug): void
{
$plugins = (array)$pluginSlug;
foreach ($plugins as $plugin) {
$option = '//*[@data-slug="' . $plugin . '"]/th/input';
$this->scrollTo($option, 0, -40);
$this->checkOption($option);
$selector = 'a#activate-' . $plugin;
$this->scrollTo($selector, 0, -40);
$this->click($selector);
}
$this->scrollTo('select[name="action"]', 0, -40);
$this->selectOption('action', 'activate-selected');
$this->click("#doaction");
}
}