Commit Graph

16613 Commits

Author SHA1 Message Date
Berkay Simsek
b891ca4164 Add a fieldset and legend element to the checkboxes.
[MAILPOET-4471]
2022-08-03 11:27:06 +02:00
Berkay Simsek
ba45281324 Add fieldset and legend to list selection
Made checkboxes in a form accessible according to the WCAG-standards by adding a fieldset around them and adding a legend describing the fieldset's purpose
(name).
[MAILPOET-4471]
2022-08-03 11:27:06 +02:00
Rostislav Wolny
45e1db5893 Make trigger run less frequent
Checking if there are task to execute every 2 minutes should be enough.
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
Rostislav Wolny
db254986ee Fix initial trigger scheduling
When scheduling using timestamp the action scheduler uses default UTC timezone
See 0a294e6df6/functions.php (L330-L339)
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
Rostislav Wolny
8e9174442c Fix label for attribute in cron settings
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
Rostislav Wolny
c44758b90d Refactor action scheduler deactivation into DaemonActionSchedulerRunner::init
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
Rostislav Wolny
16807fe9e3 Update and fix comments related to usage of Action Scheduler in cron
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
Rostislav Wolny
d742164f21 Allow execution limit type to be float
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
Rostislav Wolny
aa030fde9c Simplify triggering background jobs in acceptance tests
After enabling using the action scheduler via WP CLI it its much simpler to use WP CLI then
manipulating WP-Cron schedules.
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
Rostislav Wolny
869697e025 Allow Action Scheduler Cron trigger in cli environment
We don't want our loopback cron to run in cli environment
but we want to allow the action scheduler so that we can use it via wp cli
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
Rostislav Wolny
d6afe1c269 Update default scheduled tasks values for tests with MSS tasks
The default scheduled tasks should be setup so that there is no need to run cron and no background job is triggered in tests.
The previous setup was not covering case when MSS is set as active.
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
Rostislav Wolny
977f9beb87 Refactor deactivation of MailPoet cron actions to run only once
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
Rostislav Wolny
2df7d2f686 Split integration tests after refactoring AS runner
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
Rostislav Wolny
d3e2bcdf34 Refactor daemon trigger and daemon run actions to extra classes
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
Rostislav Wolny
476ee1ede9 Refactor triggering new action scheduler executor into extra service
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
Rostislav Wolny
4f01d54742 Improve Action Scheduler related labels at help page
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
Rostislav Wolny
bb1d461c54 Fix code formatting issues in ActionSchedulerRunner class
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
Rostislav Wolny
dfae17ed94 Add missing return and parameter types to action scheduler related classes
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
Rostislav Wolny
f745975c03 Prevent triggering migrations when tables are being removed
This was causing flakiness of acceptance test ReinstallFromScratchCest.php:reinstallFromScratch
and also potential issue for production.
In Activator::deactivate we remove MailPoet's DB tables. This takes some time.
In case there is another request during the deletion it may detect some tables are missing and trigger activation
and we end up creating MailPoet tables and removing them at the same time.

This commit adds locking to deactivate method so that any other attempt for activation ends up with an error.

[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
Rostislav Wolny
2ba1696d53 Add adaptive execution limit when daemon runs inside Action Scheduler
We use action_scheduler_maximum_execution_time_likely_to_be_exceeded filter for reading remaining execution limit
tracked in the Action Scheduler runner.
Then we use the remaining limit minus safety margin for the daemon execution.

[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
Rostislav Wolny
91e72ee646 Lower execution limit of daemon in case it runs in action scheduler
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
Rostislav Wolny
f178ea5f7a Fix ManageSubscriptionsLinkCest
Clicking on Send button triggers ActionScheduler and it may take longer
then 2 seconds. In such case the test ends up reloading on send page instead of
newsletter listing page.

This commit fixes the issue by adding wait for newsletter listing.
[MAILPOET-4724]
2022-08-03 10:36:57 +02:00
Rostislav Wolny
cacb44444c Add DaemonActionSchedulerRunner integration test
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
Rostislav Wolny
ddb63bfa9f Setup integration test to run without action scheduler cron
Action Scheduler was running in background causing random test failures.
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
Rostislav Wolny
b525f9f876 Deactivate action scheduler actions when another method is active
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
Rostislav Wolny
138354cfd8 Improve stability of SubscribeOnRegistrationPage acceptance test
This commit adds waiting for confirmation that settings were really saved before continuing with next steps.
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
Rostislav Wolny
95ed809db0 Improve stability of WooCommerceSetupPageCest acceptance test
This commit adds waiting for listing to finish loading before checking presence of
a customer email. We do it in other tests that work with listing, but it was missing
in this place.
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
Rostislav Wolny
28f497ec61 Improve ManageSubscribers acceptance test stability
The test was randomly failing when asserting subscriber state within subscriber edit form
and was also failing when attempting to click inactive subscribers filter in subscribers listing.
I found that both these issues were related to the web driver clicking too early when the form or
the list was still being rendered by React.

In this commit, I fixed those by adding some waiting on some elements and making sure the subscriber edit form is
already rendered.

The failures were flaky, and I could not identify what exactly caused these tests to start failing.
It is possible that some changes on the backend slightly affected API requests duration and the change in timing of rendering
was big enough to cause the flakiness.

[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
Rostislav Wolny
272e875643 Deactivate action scheduler recurring actions on plugin deactivation
We need to cleanup these recurring actions otherwise they would be rescheduled indefinitely.
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
Rostislav Wolny
e3fbf2421d Move action scheduler initialization to Initializer as one of first actions
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
Rostislav Wolny
791a0631b5 Add Acceptance test helper for triggering background job
It may take up to one minute for Action Scheduler to start.
This commit adds a helper method that sets WP Cron trigger for action scheduler and
MailPoet action in Action Scheduler to run immediately and triggers WP Cron
that triggers action scheduler by page reload.

[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
Rostislav Wolny
2c2c9dba6a Make sure WP Cron is not locked when acceptance tests start
Action Scheduler uses WP Cron as trigger.
When it is initially locked it takes more time for Action Scheduler to start
and some tests that rely on background job fail with timeout.
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
Rostislav Wolny
eedc18bb7f Trigger action scheduler runner immediately when starting sending
When users click send email in UI, they need to wait a minute or more to
see some emails started going out.

This commit adds additional trigger into sending queue API.
If emails is set to send it triggers Action Scheduler immediately.
Users will get immediate feedback that emails are sending.
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
Rostislav Wolny
5deea8a724 Fix CronWorkerRunner integration test
CronWorkerRunner sets internal timer in its constructor function.
This works fine in classic web page request. But in integration tests
in might be created and cached in DI, so for some late running tests
it throws timeout exception.
This commit fixes the issue by using fresh instance of CronWorkerRunner
instead of "cached" one from DI container.

[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
Rostislav Wolny
b979c76445 Switch acceptance tests to use Action Scheduler instead of Wordpress visitors
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
Rostislav Wolny
b02aa1e1a6 Add Action scheduler status into on help page
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
Rostislav Wolny
86562e99b9 Trigger additional executor only when MailPoet daemon runs
In afterProcess callback we trigger a new runner when there are still some scheduled tasks
to process. Before this change we did this for every action scheduler run and it was causing that
we triggered more HTTP requests than needed.
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
Rostislav Wolny
f59945d483 Add wrapper class for action scheduler in cron
The class add GROUP ID so that all MailPoet cron tasks are stored under the same group.
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
Rostislav Wolny
7e5d632148 Make Action Scheduler the default method for MailPoet background job
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
Rostislav Wolny
8d05da2c37 Add Action Scheduler as WordPress cron into advanced settings
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
Rostislav Wolny
2b44684c38 Add action scheduler method to cron trigger
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
Rostislav Wolny
ccfdd229ec Add action scheduler daemon runner
This commit adds a class that handles continuous processing of MailPoet cron daemon
using Action Scheduler's recurring actions.
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
Sam Najian
0ac617abf7 Check guzzlehttp/guzzle version before attempting to patch
[PREMIUM-199]
2022-08-02 15:01:42 +02:00
Sam Najian
b2a5f47da7 Override http_build_query for in guzzle package
The http_build_query used in guzzle/src/Client.php
is not compatible with PHPv8.0+ since it accepts null as
second parameter while in newer versions of PHP this is
either deprecated or removed

[PREMIUM-199]
2022-08-02 15:01:42 +02:00
David Remer
c9a464c4c9 Make 'HOURS' the default when creating a delay step
[MAILPOET-4418]
2022-08-02 14:39:33 +02:00
David Remer
ace82c9abb Change delayType signature.
Adds subtitle callback and removes singular and plural properties.

[MAILPOET-4418]
2022-08-02 14:39:33 +02:00
David Remer
c6164ad88f Center icon in ColoredIcon vertically
[MAILPOET-4418]
2022-08-02 14:39:33 +02:00
David Remer
78460bd248 Use ComponentType instead of JSX.Element for icon, use @wordpress/component icons
[MAILPOET-4418]
2022-08-02 14:39:33 +02:00
David Remer
39ca2343b8 Simplify the DOM and CSS of ColorIcon component
[MAILPOET-4418]
2022-08-02 14:39:33 +02:00
David Remer
1fbf29b7f6 Resize ColoredIcon
[MAILPOET-4418]
2022-08-02 14:39:33 +02:00