test: fix flaky message deletion assertions

JE
2h ago
+4-2

Proposed changes (including videos or screenshots)

The message-deletion test could fail after a successful deletion because deleteLastMessage() waited for the confirmation button to become disabled. A fast response can close the dialog before Playwright observes that temporary state. The helper now waits for the confirmation button to disappear.

The test also verifies that the specific message is visible before deletion and absent afterward. This allows it to run on its own, including when deleting the message leaves the room empty, without relying on a previous test to leave another message behind.

Issue(s)

FLAKY-1579

Steps to test or reproduce

  1. Start Rocket.Chat with TEST_MODE=true and its test database available.

  2. From apps/meteor, set BASE_URL and MONGO_URL if the test instance uses non-default addresses, then run:

    yarn test:e2e message-actions.spec.ts quote-messages.spec.ts \
      --grep 'should delete message|should delete a quoted message' \
      --repeat-each=5 --workers=1 --retries=0 --reporter=list
    
  3. Confirm both deletion tests pass all five repetitions, including the standalone message-deletion test with an otherwise empty room.

Further comments

The inspected CI failure and its Playwright trace show that chat.delete returned HTTP 200 with success: true, but the subsequent toBeDisabled() assertion timed out because the confirmation button was already gone.

Local validation used the cached Rocket.Chat 8.10 image with MongoDB 7.0; the inspected CI run used MongoDB 8.0.

  • Both affected deletion tests passed five times each with retries disabled: 10/10 passed.
  • Before the assertion change, the standalone message-deletion test failed all three local runs because deletion left no last message to inspect.
  • ESLint, Prettier, and git diff --check passed.

Summary by CodeRabbit

  • Tests
    • Improved automated coverage for message deletion.
    • Tests now verify the specific message is visible before deletion and no longer appears afterward.
    • Deletion flows now confirm that the confirmation dialog closes after the action completes.