From 76e07071a11cd6e4796ad846bc835a18c8f49647 Mon Sep 17 00:00:00 2001 From: Flarnie Marchan Date: Thu, 24 May 2018 14:11:25 -0700 Subject: [PATCH] [scheduler] 2/n Adding 'schedule' fixture (#12884) * Adding 'schedule' fixture **what is the change?:** We need to test the `schedule` module against real live browser APIs. As a quick solution we're writing a fixture for using in manual testing. Later we plan on adding automated browser testing, using this or a similar fixture as the test page. **why make this change?:** To further solidify test coverage for `schedule` before making further improvements/refactors to the module. **test plan:** `open fixtures/schedule/index.html` and inspect the results. It should be clear that things pass. We also temporarily broke the scheduler and verified that this fixture demonstrates the problems. **issue:** Internal task T29442940 * Made fixture tests display red or green border depending on pass/fail **what is the change?:** Added red/green solid/dashed border for test results when using the schedule fixture. We also tweaked the timing of the last test because it was on the line in terms of whether it passed or failed. **why make this change?:** To make it faster to use the fixture - it takes more time to read through the results line by line and check that they match what is expected. **test plan:** Looked at the fixture, and also tried modifying a test to show what it looks like when something fails. --- fixtures/schedule/index.html | 293 ++++++++++++++++++ .../src/__tests__/test_page.html | 10 - 2 files changed, 293 insertions(+), 10 deletions(-) create mode 100644 fixtures/schedule/index.html delete mode 100644 packages/react-scheduler/src/__tests__/test_page.html diff --git a/fixtures/schedule/index.html b/fixtures/schedule/index.html new file mode 100644 index 0000000000..24fd26aee9 --- /dev/null +++ b/fixtures/schedule/index.html @@ -0,0 +1,293 @@ + + + + + Schedule Test Page + + + +

Schedule Fixture

+

+ This fixture is for manual testing purposes, and the patterns used in + implementing it should not be used as a model. This is mainly for anyone + working on making changes to the `schedule` module. +

+

Tests:

+
    +
  1. + +

    Calls the callback with the frame when not blocked:

    +
    Expected:
    +
    +
    +
    -------------------------------------------------
    +
    If you see the same above and below it's correct. +
    -------------------------------------------------
    +
    Actual:
    +
    +
  2. +
  3. +

    Accepts multiple callbacks and calls within frame when not blocked

    + +
    Expected:
    +
    +
    +
    -------------------------------------------------
    +
    If you see the same above and below it's correct. +
    -------------------------------------------------
    +
    Actual:
    +
    +
  4. +
  5. +

    Schedules callbacks in correct order when they use scheduleWork to schedule themselves

    + +
    Expected:
    +
    +
    +
    -------------------------------------------------
    +
    If you see the same above and below it's correct. +
    -------------------------------------------------
    +
    Actual:
    +
    +
  6. +
  7. +

    Calls timed out callbacks and then any more pending callbacks, defers others if time runs out

    + +
    Expected:
    +
    +
    +
    -------------------------------------------------
    +
    If you see the same above and below it's correct. +
    -------------------------------------------------
    +
    Actual:
    +
    +
  8. +
+ + + + + diff --git a/packages/react-scheduler/src/__tests__/test_page.html b/packages/react-scheduler/src/__tests__/test_page.html deleted file mode 100644 index 3b5af08b39..0000000000 --- a/packages/react-scheduler/src/__tests__/test_page.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - React Scheduler test page - - -

Hello World

- -