-
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
E2E: update tests #1217
Comments
Consider removal of packages mentioned in #1213 |
Consider moving dependencies from root workspace to @eventespress/e2e |
To implement flexible support for values like HOST or PORT, consider use of |
Once tests are converted, remove deprecated scripts from |
Bootstrap code from legacy E2E tests that runs before every suite from // Before every test suite run, delete all content created by the test. This ensures
// other posts/comments/etc. aren't dirtying tests and tests don't depend on
// each other's side-effects.
beforeAll(async () => {
await loginUser(); // log in into /wp-admin/wp-login.php to obtain auth cookies
// IS_WP_MULTISITE_NETWORK === true => run E2E against http://e2etests.makeeventsnotwar.com
// IS_WP_MULTISITE_NETWORK === false => run E2E against docker (@wordpress/env)
if(!IS_WP_MULTISITE_NETWORK){
await activatePlugin('event-espresso-core/espresso.php'); // go to /wp-admin/plugins.php and activate plugin
await activatePlugin('barista/ee-barista.php'); // go to /wp-admin/plugins.php and activate plugin
}
await Goto.eventsListPage(); // go to /wp-admin/admin.php?page=espresso_events
await defaultSettingsManager.gotoDefaultSettings(); // go to tab "Default Settings" in EE's admin page
// choose setting for "Activate Advanced Editor"
// 1 => Advanced Editor
// 0 => Legacy Editor
await defaultSettingsManager.selectDefaultEditor('1');
});
afterAll(async () => {
// IS_WP_MULTISITE_NETWORK === true => run E2E against http://e2etests.makeeventsnotwar.com
// IS_WP_MULTISITE_NETWORK === false => run E2E against docker (@wordpress/env)
if(!IS_WP_MULTISITE_NETWORK){
await deactivatePlugin('barista/ee-barista.php'); // go to /wp-admin/plugins.php and deactivate plugin
}
}); |
💡 Create a E2E to confirm it is configured and functional? |
Fixture for activating/deactivating plugin has proven to be flaky i.e. intermittent failures when running repeat tests. Will proceed with the following solution
|
Something overwrites Edit: overwrite comes from |
Looks like the issue was solved after running |
Base for actual E2E branches - |
@tn3rb Just FYI, I know this issue seemed like it was in limbo but actually lots of work was being done, I just didn't update TODOs on time |
@tn3rb Just FYI, when converting tests, I am following the testing scope of whatever was in the original E2E tests. This is to avoid scope creep. My vision is to convert existing E2E tests and hook them up as a part of our pipeline asap. Then we can open subsequent GH issues and/or PRs to improve those tests. I see that there is a lot of great value for the company by automating E2E so I'd rather follow incremental Agile approach instead of trying to get "picture perfect" E2E tests (waterfall). However… if you prefer to follow a different approach, please let me know and I'll adapt accordingly. |
Since #1228 is merged, all E2E branches are to be based off |
Experiencing intermittent failures again… Error: page.reload: Navigation failed because page was closed!
=========================== logs ===========================
waiting for navigation until "load"
navigated to "http://<host>:<port>/wp-admin/admin.php?page=espresso_events&action=create_new"
============================================================
118 |
119 | // reload page to check if default settings have applied
> 120 | await eventPage.reload();
| ^
121 |
122 | await expect(eventDropdown).toHaveValue(value);
123 |
at /<path>/events-page.spec.ts:120:20 |
During investigation I have noticed that auth cookies are missing |
Looks like increasing timeout per test to 60 seconds resolved the issue |
I need to consider that not all E2E tests will support concurrency, such as testing global settings |
The alternative to run tests in series is to actually support multiple databases. Consider official WordPress docker image. |
Before proceeding anyway, let's do a quick investigation to confirm this theory that running tests sequentially will resolve issue of having unexpected values in assert conditions |
Thinking more about… having a separate database instance per work might be way too hard to implement since that would require some kind of broker mechanism to spin up new WordPress instance and provision new database. |
By the way, running tests sequentially leads to no errors but timeframe is increased by x5-10 |
Investigating flakiness Runs
Note: test case is marked as |
When running tests in series, it appears that fixture Edit: Strangely enough, it is the initial/admin tab that fails to re-use auth cookie cookie. We actually expect to re-use same admin auth session. Similar, to how it is possible to open several WP admin pages under the same account. |
When the
|
It appears that even when auth cookie is present, test is getting timeout at the login page. What I have noticed is that redirect is indeed happening due to WordPress. Curiously enough, there is search param |
Once I have enabled screenshots and trace on await page.context().tracing.start({
screenshots: true,
snapshots: true,
sources: true,
}); await page.screenshot({
fullPage: true,
path: `<repo>/debug-ss/ss-${this.workerInfo.workerIndex}-${this.workerInfo.parallelIndex}.png`,
});
await page.context().tracing.stop({
path: `<repo>/debug-trace/trace-${this.workerInfo.workerIndex}-${this.workerInfo.parallelIndex}.zip`,
}); |
To avoid issues with "floating" time, I need to set it to something fixed and used static timestamps to avoid unexpected surprises. Consider this solution. |
As per my conversation with @tn3rb instead of doing implicit checks, e.g. count how many datetimes an event has, I should explicitly checks parameter, e.g. does a specific datetime exist for a given event? |
Scaffolding data via UI fixtures proved unreliable. I will investigate REST API route for scaffolding data. |
Error reporting constants
from https://www.php.net/manual/en/errorfunc.constants.php Bitmask value for |
Closing this in favour of |
Need to update E2E tests to make them compatible with Playwright runner
Primary TODOs
Events Page -
events-page.spec.ts
Categories - #1229
admin/event/categories/editCategory.test.ts
admin/event/categories/categoryShortcode.test.ts
admin/event/categories/createCategory.test.ts
Default Settings - #1230
admin/event/default/settings/defaultMaximumTickets.test.ts
admin/event/default/settings/defaultRegistrationStatus.test.ts
Links - #1236
admin/event/events-list/linkForDraft.test.ts
admin/event/events-list/linkForToday.test.ts
admin/event/events-list/linkForViewAllEvents.test.ts
admin/event/events-list/linkForThisMonth.test.ts
admin/event/events-list/linkForTrash.test.ts
Single Event -
single-event.spec.ts
- #1238shared/pagination.test.ts
shared/search.test.ts
shared/date-capacity-vs-ticket-qty.test.ts
shared/views/switch-view.test.ts
shared/views/card-view-date-range.test.ts
shared/copy-entity.test.ts
Registration -
registration.spec.ts
shared/two-dates-two-tickets.test.ts
public/single-page-checkout/registration-scenarios/sold-out.test.ts
public/single-page-checkout/registration-scenarios/index.test.ts
Add-ons -
rem.spec.ts
,wpUser.spec.ts
add-ons/rem/index.test.ts
add-ons/wpUser/index.test.ts
To Be Sorted⚠️
admin/event/events-list/bulkActions.test.ts
admin/event/events-list/pagination.test.ts
admin/event/events-list/search.test.ts
admin/event/events-list/filters.test.ts
admin/events/templates/archives/displayStatusBanner.test.ts
admin/events/templates/archives/displayTicketSelector.test.ts
admin/events/templates/archives/displayDescription.test.ts
admin/events/templates/archives/resetEventListSettings.test.ts
admin/events/templates/archives/displayVenueDetails.test.ts
admin/events/templates/archives/displayDatetimes.test.ts
admin/events/templates/archives/eventListingUrl.test.ts
admin/events/templates/archives/useCustomDisplayOrder.test.ts
admin/events/templates/archives/eventSlug.test.ts
admin/events/templates/archives/displayExpiredEvents.test.ts
admin/events/templates/ticket-selector/showTicketDetails.test.ts
admin/events/templates/ticket-selector/dateAndTimeFilterMaxChecked.test.ts
admin/events/templates/ticket-selector/showExpiredTickets.test.ts
admin/events/templates/ticket-selector/moreTicketSelectorOneMaxAttendees.test.ts
admin/events/templates/ticket-selector/showTicketSaleInfo.test.ts
admin/events/templates/ticket-selector/showDateAndTimeFilter.test.ts
admin/events/templates/ticket-selector/moreTicketSelectorTenMaxAttendees.test.ts
admin/events/templates/ticket-selector/freeTicketSelectorOneMaxAttendees.test.ts
admin/events/templates/ticket-selector/dateAndTimeFilterThreshold.test.ts
admin/events/templates/single/displayStatusBanner.test.ts
admin/events/templates/single/displayVenueDetails.test.ts
admin/events/templates/single/useCustomDisplayOrder.test.ts
admin/events/dates-list/filters/sortby.test.ts
admin/events/dates-list/filters/status.test.ts
admin/events/dates-list/filters/sales.test.ts
admin/events/dates-list/card.test.ts
admin/events/dates-list/index.test.ts
admin/events/dates-list/edit.test.ts
admin/events/dates-list/delete.test.ts
admin/events/editor/tickets-list/price-precision.test.ts
admin/events/editor/tickets-list/filters/sortby.test.ts
admin/events/editor/tickets-list/filters/status.test.ts
admin/events/editor/tickets-list/filters/sales.test.ts
admin/events/editor/tickets-list/card.test.ts
admin/events/editor/tickets-list/price-inline-vs-tpc.test.ts
admin/events/editor/tickets-list/index.test.ts
admin/events/editor/tickets-list/edit.test.ts
admin/events/editor/tickets-list/delete.test.ts
admin/events/editor/tickets-list/price.test.ts
admin/events/editor/ticket/price-calculator/index.test.ts
admin/events/editor/ticket/assignments-manager/toggle-assignments.test.ts
admin/events/editor/ticket/assignments-manager/index.test.ts
admin/events/editor/ticket/assignments-manager/filters.test.ts
admin/events/editor/ticket/assignments-manager/related-count-vs-assignments.test.ts
admin/events/editor/ticket/assignments-manager/single-vs-global-tam.test.ts
Configuration
show only PHP errors but suppress warnings(moved to #1234)Secondary TODOs (optional)
environment.spec.ts
)package.json
Remove dev dependencies for old E2E tests #1231@eventespress/e2e
Consolidate E2E deps under its own package #1243The text was updated successfully, but these errors were encountered: