Skip to content
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

Only rename debug.log with errors relating to WPR #67

Closed
jeawhanlee opened this issue Apr 5, 2024 · 4 comments · Fixed by #181
Closed

Only rename debug.log with errors relating to WPR #67

jeawhanlee opened this issue Apr 5, 2024 · 4 comments · Fixed by #181
Assignees
Labels

Comments

@jeawhanlee
Copy link
Contributor

Is your feature request related to a problem? Please describe.
Right now we rename debug.log for every scenario that creates it whether the errors in the log are WPR related or not.

Describe the solution you'd like
We should check for errors in the debug.log that relates to WPR and rename it if any is found.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

@MathieuLamiot
Copy link
Contributor

Discussed as part of #54:

Expected behavior

  • Rocket-E2E error log check must discard log files that contain only errors not related to WP Rocket: to identify them, we shoud look for wpr_, Rocket, rocket in the error text.
  • Additionally, the error log check must have an option to discard a selected list of errors. For instance, in some test cases (install/uninstall/update/rollback) we want to discard errors like WordPress database error Table 'wp_wpr_rucss_used_css' already exists, No such file or directory, Failed opening, Cron reschedule event error for hook. This list must be maintainable by QA team.

If the error log check discards a log file (meaning there are only errors not related to WP Rocket and errors discarded if the option is enabled), then the error log file must not be kept and this check must succeed (not make the test fail).

@Mai-Saad
Copy link
Contributor

AS per discussion with @jeawhanlee the part to ignore certain error will be handled at the helper plugin and it needs other GH

@jeawhanlee
Copy link
Contributor Author

Scope a solution ✅

In https://github.com/wp-media/wp-rocket-e2e/blob/985ff540ba141a5f0a4619250b9196cb3a23abfb/utils/commands.ts

  • Create a new function to read & return file content on the server. function will accept a single parameter which is the file path.

In https://github.com/wp-media/wp-rocket-e2e/blob/0804e12dad70dee3455f5ed748d38e8756e8ab09/utils/helpers.ts

  • Create a new helper function to detect allowed needles in debug.log, function will return true if needles are detected, false otherwise. function will accept a single parameter which is the file content.

In

this.context = await browser.newContext({

  • Call the new command function for returning file content on server with the debug.log path
  • Call the new helper function that asserts if file contents contains expected needles.

Estimate the effort ✅

[XS]

@Khadreal
Copy link
Contributor

Khadreal commented Jan 6, 2025

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants