wp-media / wp-rocket-e2e

Playwright E2E testing repo
GNU General Public License v3.0
0 stars 0 forks source link

Clear lcp/performance hints data tests #126

Closed Mai-Saad closed 2 months ago

Mai-Saad commented 4 months ago

Is your feature request related to a problem? Please describe. Since now we can check the database, we can cover clearing data scenarios in the e2e. Here are some basic scenarios to start with, then we can build on that.

Scenario1: Should clear performance hints data when click clear PH in admin bar Given WPR installed and activated And performance hints data added to DB When clear performance hints is clicked in admin bar then data is removed from the performance hints tables

Scenario2: Should clear performance hints when change permalinks Given WPR installed and activated And performance hints data added to DB When permalinks is changed then data is removed from the performance hints tables

Scenario3: Should clear performance hints when switch theme Given WPR installed and activated And performance hints data added to DB When switching the theme then data is removed from the performance hints tables

Scenario4: Should clear performance hints of the current URL Given WPR installed and activated And URL1 , URL2 are visited And performance hints data added to DB When click clear performance hints of this URL in page view of URL1 then data of this URL1 is removed from the performance hints tables And the data of URL2 still in the table

Scenario5: Should clear performance hints of the URL when edited Given WPR installed and activated And URL is visited And performance hints data added to DB When edit the content of the URL then data of this URL is removed from the performance hints tables

Scenario6: Should clear performance hints of the URL when deleted Given WPR installed and activated And URL is visited And performance hints data added to DB When URL page is deleted then data of this URL is removed from the performance hints tables

MathieuLamiot commented 3 months ago

Steps breakdown

We would need to adapt this step when we add other tables for performance hints (for instance the LRC table).

Other steps seems like navigation steps that would need custom functions (change permalinks, and When URL page is deleted).

I would suggest to go step by step, eventually with several PRs, one per scenario to begin with?

Effort: M

hanna-meda commented 3 months ago

@jeawhanlee, could you have a look over this grooming? And about change permalinks, where will we add this, shall it be in support/utils or just steps to related feature directly? Thank you.

MathieuLamiot commented 3 months ago

And about change permalinks, where will we add this, shall it be in support/utils or just steps to related feature directly?

I feel like changing permalinks will be re-used at some point (I think I saw already another E2E issue mentioning this step) so something generic in utils makes sense 👍

Mai-Saad commented 3 months ago

And performance hints data added to DB: We can create a step that adds some hard-coded rows into the database. It can be done with something like:

@MathieuLamiot why don't we visit some URLs so it will be added directly to DB?, after clear those URLs will be removed from DB

MathieuLamiot commented 3 months ago

@Mai-Saad That would work too yes. The risk is that, to be sure data is added, this visit has to be done after clearing the cache and Performance Hints data. So it adds a few steps to the test, while hard-coding data to be added in the DB separates a bit more the different tests and steps. both are fine with me

jeawhanlee commented 3 months ago

LGTM