-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EP-5420: More thorough affiliate widgets tests #190
base: master
Are you sure you want to change the base?
Conversation
// Keep track of posts created during the tests so that we can delete them on tear down. | ||
static $postIDsToDelete = []; | ||
|
||
static function tearDownAfterClass(): void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See https://docs.phpunit.de/en/10.0/fixtures.html for documentation on PHPUnit's tearDownAfterClass
.
* @return void | ||
* @throws Exception | ||
*/ | ||
function deletePosts( array $postIDs ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't see any way to permanently delete posts without first moving them to the trash. Note that we don't have access to functions like wp_delete_post()
because we aren't in the WordPress instance.
try { | ||
$browser->deletePosts( WidgetsTest::$postIDsToDelete ); | ||
} catch ( Exception $e ) { | ||
error_log( 'Failed to delete test posts: ' . $e->getMessage() ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't really matter for CI, but should be flagged for local dev.
} | ||
|
||
/** | ||
* Find and return the Organic Affiliate widgets iframe. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll make this comment slightly more explicit since there are two iframes, the widget selection iframe (the editor logs in and customizes the widget) and the widget display iframe ("the widget"--what will be rendered on the actual site).
There have been multiples instances in the past of Affiliate widgets not rendering properly in the WordPress editor, both upon insertion (i.e., our SDK didn't re-process the page to properly render the newly inserted widget) and upon navigating back to the post (i.e., our SDK didn't process the page correctly to properly render the previously saved widget). This PR expands our Selenium tests to account for these two cases.