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

Add feature test for espionage report content based on espionage level difference #319

Open
4 tasks
lanedirt opened this issue Aug 26, 2024 · 0 comments
Open
4 tasks
Labels
enhancement New feature or request

Comments

@lanedirt
Copy link
Owner

PR #316 added logic which determines what parts of the espionage report to show based on the espionage level of attacker vs defender. It it desired to add feature tests for this behavior.

What the attacker sees in the espionage report depends on:

  • Amount of espionage probes sent.
  • Espionage level of attacker.
  • Espionage level of defender.

The rules to validate are available here: https://ogame.fandom.com/wiki/Espionage.

Todo:

Add feature tests to test various usecases. For example:

  • Sending 1 espionage probe where attacker and defender have the same espionage level = expecting to only see resources.
  • Sending 10 espionage probes where the attacker and defender have the same espionage level = expecting to see everything.
  • Sending 8 espionage probe where attacker has espionage level 2 and defender has espionage level 4 = expecting to see fleet and defense, but NOT building and tech.
  • More?

Technical:

The feature tests can be added to the tests/Feature/FleetDispatch/FleetDispatchEspionageTest.php file. Technically what the test should do:

  1. Send espionage mission to foreign planet by using sendMissionToOtherPlayer(). See existing tests which utilize this method.
  2. The sendMissionToOtherPlayer() method returns the (random) foreign planet it has targeted. Use this to update the foreign planet player's espionage tech levels for the test.
  3. Advance time via Carbon::setTestNow() to simulate time has passed to ensure espionage mission has arrived.
  4. Make a request to any page to update the arrived fleet missions.
  5. Assert that the current player has received the espionage report and check the contents of the espionage report via HTML inspection.

Tip: take a look at testDispatchFleetEspionageReport() which already has the expected technical flow but minus the tech level update and espionage report inspection.

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

No branches or pull requests

1 participant