Commit Graph

15684 Commits

Author SHA1 Message Date
de4e76b65d Use is_array() instead of !empty() for a safer check
Just in case the option is changed and is not an array anymore.

[MAILPOET-4491]
2022-08-04 10:18:44 +02:00
ffecdf8528 Use update_option() instead of add_option()
See https://github.com/mailpoet/mailpoet/pull/4277#discussion_r933531137

[MAILPOET-4491]
2022-08-04 10:18:44 +02:00
ef89cae94a Include in the Beacon info about if MP was installed via WC or not
[MAILPOET-4491]
2022-08-04 10:18:44 +02:00
6a5207a366 Add new property to pass to Mixpanel to track if MP was installed via WC
[MAILPOET-4491]
2022-08-04 10:18:44 +02:00
13e06fe0cb Add helper method to check if MailPoet was installed via WooCommerce
The method will return true if MailPoet was installed via the
WooCommerce onboarding wizard and false otherwise.

[MAILPOET-4491]
2022-08-04 10:18:44 +02:00
57c02a2fd3 Inline form honey pot css style
Inline !important styling has more specificity that styling
added inside style tag, and is more likely to work on more
devices

[MAILPOET-4519]
2022-08-04 10:10:16 +02:00
ac473c412e Use WP functions from internal class
[MAILPOET-4516]
2022-08-03 16:52:02 +02:00
679d586d2b Fix settings action link order
[MAILPOET-4516]
2022-08-03 16:52:02 +02:00
85e7997197 Replace Paris models with Doctrine entities in AuthorizedEmailsController
[MAILPOET-4347]
2022-08-03 16:27:41 +02:00
d225f4e044 Replace Paris models with Doctrine entities in AuthorizedEmailsControllerTest
[MAILPOET-4347]
2022-08-03 16:27:41 +02:00
e7b32bdd4a Add method to set the status when creating a new Newsletter entity
This commit adds the method withStatus() to the newsletter factory
class so that it is possible to pass a variable with the status to the
factory. Before this change, it was necessary to class methods like
withActiveStatus() which make it impossible to create newsletters with
different status in the same call. This will be used in a subsequent
commit that is part of the same ticket to refactor
AuthorizedEmailsControllerTest.

[MAILPOET-4347]
2022-08-03 16:27:41 +02:00
b89a931e1a Improve CSS reset for fieldset and legend in form
These changes address issues found when testing with Storefront theme.
[MAILPOET-4471]
2022-08-03 11:27:06 +02:00
c170641d83 Fix form checkbox html
[MAILPOET-4471]
2022-08-03 11:27:06 +02:00
35d9a6b2d3 Update form acceptance test check
[MAILPOET-4471]
2022-08-03 11:27:06 +02:00
6777a9b560 Update unit tests to reflect form rendering changes
[MAILPOET-4471]
2022-08-03 11:27:06 +02:00
bf5d27cc79 Unify error message for invalid email with other messages
Other error messages are also ended with period.
[MAILPOET-4471]
2022-08-03 11:27:06 +02:00
7f525068b3 Improve legend tag rendering in forms
The legend html was not escaped and was ignoring block settings coming
from the form editor.
This commit adds a new helper function for rendering legend that respects
applies block settings and also escapes the output.
[MAILPOET-4471]
2022-08-03 11:27:06 +02:00
243e1bdac8 Change form fieldset CSS reset to also affect manage subscription form
Previously the reset was applied to .mailpoet_form class but manage subscription form
which also uses these form blocks doesn't have the class.
This commit moves the reset to an internal class that wraps every input and is used
also in the manage subscription page.
[MAILPOET-4471]
2022-08-03 11:27:06 +02:00
6671c573b8 Improve email error message in forms.
Added a 'type-message' for Parsley to display an error message when the input field is filled in incorrectly.
Also removed the global Parsley message to prevent it from overruling the 'required-message'.
[MAILPOET-4471]
2022-08-03 11:27:06 +02:00
75fce3800c Add styling for the for fieldsets to avoid default.
Add styling for the fieldsets to avoid getting the default styling with the black border and unecessary padding and margin.
Applying default or theme styles would cause a BC break for existing forms.
[MAILPOET-4471]
2022-08-03 11:27:06 +02:00
be220c4782 Add a fieldset and legend element to the radio buttons.
[MAILPOET-4471]
2022-08-03 11:27:06 +02:00
b891ca4164 Add a fieldset and legend element to the checkboxes.
[MAILPOET-4471]
2022-08-03 11:27:06 +02:00
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
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
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
8e9174442c Fix label for attribute in cron settings
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
c44758b90d Refactor action scheduler deactivation into DaemonActionSchedulerRunner::init
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
16807fe9e3 Update and fix comments related to usage of Action Scheduler in cron
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
d742164f21 Allow execution limit type to be float
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
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
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
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
977f9beb87 Refactor deactivation of MailPoet cron actions to run only once
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
2df7d2f686 Split integration tests after refactoring AS runner
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
d3e2bcdf34 Refactor daemon trigger and daemon run actions to extra classes
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
476ee1ede9 Refactor triggering new action scheduler executor into extra service
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
4f01d54742 Improve Action Scheduler related labels at help page
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
bb1d461c54 Fix code formatting issues in ActionSchedulerRunner class
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
dfae17ed94 Add missing return and parameter types to action scheduler related classes
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
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
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
91e72ee646 Lower execution limit of daemon in case it runs in action scheduler
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
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
cacb44444c Add DaemonActionSchedulerRunner integration test
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
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
b525f9f876 Deactivate action scheduler actions when another method is active
[MAILPOET-4274]
2022-08-03 10:36:57 +02:00
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
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
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
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