WordPress.org

Make WordPress Core

Opened 4 years ago

Last modified 4 months ago

#35857 assigned task (blessed)

Add QUnit tests for Customizer preview, including Selective Refresh

Reported by: westonruter Owned by: ryankienstra
Milestone: Priority: normal
Severity: normal Version: 3.4
Component: Customize Keywords: needs-patch
Focuses: javascript Cc:
PR Number:

Description

Initial Customizer unit tests for PHP and JS were added in #28579. The QUnit tests were done specifically for the Customizer controls (pane) and not the Customizer preview. This was understandable since he preview was devoid of much unique JS functionality. With the introduction of the Selective Refresh component (#27355), this has changed. There needs to be a new QUnit test suite specifically for the Customizer preview.

See @valendesigns initial foundation work here: https://github.com/xwp/wp-customize-partial-refresh/pull/32/files#diff-6fcbfd120899db12c05cdb1f6142cd87

Change History (21)

#1 @westonruter
4 years ago

  • Type changed from defect (bug) to task (blessed)

#2 @jorbin
4 years ago

  • Owner set to westonruter
  • Status changed from new to assigned

This ticket was mentioned in Slack in #core by chriscct7. View the logs.


4 years ago

#4 @westonruter
4 years ago

  • Owner changed from westonruter to ryankienstra

Something that the QUnit tests for the Customizer thus far have somewhat lacked in thus far is properly setting up and tearing down the global state with each test. The tests for the Customizer pane largely are adding and removing things from the global state without regard for how those will impact other tests. In other words, they are more integration tests than unit tests… and they can be more fragile since they aren't encapsulated. To make the unit tests more robust in the preview, I suggest that we be more disciplined from the start at architecting the unit tests in a way that teach test does state setup beforeEach, and tears down any global state afterEach.

This ticket was mentioned in Slack in #core by chriscct7. View the logs.


4 years ago

#6 @chriscct7
4 years ago

@westonruter + @ryankienstra is this going to make the release or should it be punted out?

#7 @ryankienstra
4 years ago

Estimate

Hi @chriscct7 and @westonruter,
Sorry, these "Selective Refresh" unit tests probably won't be ready in a few days. A more likely timeframe is around a week.

I've been pushing to a work-in-progress GitHub pull request.

If this needs to be expedited so we at least have some tests in 4.5, that would be fine. But completing these unit tests in a few days probably won't be possible.

#8 @westonruter
4 years ago

Unit tests can be committed at practically any time, so I'm not concerned about them making a beta release.

This ticket was mentioned in Slack in #core by westonruter. View the logs.


4 years ago

#10 @mikeschroder
4 years ago

Fine with this riding, as it's only a ticket for tests, and they're not bounded by RC.
Better testing for new features is always good.

This ticket was mentioned in Slack in #core by mike. View the logs.


4 years ago

#12 @mikeschroder
4 years ago

Are you still planning on doing this, @westonruter @ryankienstra?

If not, we need to decide if this ticket is a requirement before release and can be punted to Future Release or not.

#13 @westonruter
4 years ago

  • Keywords 4.6-early added
  • Milestone changed from 4.5 to Future Release
  • Owner ryankienstra deleted

Punting.

#14 @westonruter
4 years ago

(If anyone has has a patch it can still be committed before 4.5 is released, but I'm punting to remove this from the radar as a 4.5 release requirement.)

#15 @ryankienstra
4 years ago

Latest Commits In Pull Request

This pull request has my latest commits. Including one that mocks a setting change, and tests that the partial refreshes properly.

I'm sorry for the delay in this work. Thanks to @westonruter for his input on this pull request.

#16 @westonruter
3 years ago

  • Milestone changed from Future Release to 4.6

#17 @westonruter
3 years ago

  • Keywords 4.6-early removed

#18 @ocean90
3 years ago

@ryankienstra Are you still working on a patch here? Would be nice to have tests here really soon so we can make sure that future changes don't break the initial committed version.

#19 @ocean90
3 years ago

  • Owner set to ryankienstra

#20 @ryankienstra
3 years ago

Unit Tests Mainly Complete
But Failing Travis CI Build

Hi @ocean90,
Sorry for the long delay here. These unit tests are mainly finished, as part of a GitHub pull request.

But they are failing a Travis CI build. One of the build tasks failed with this message:

Testing tests/qunit/customize-preview.html ...F
PhantomJS timed out, possibly due to:
- QUnit is not loaded correctly.
- A missing QUnit start() call.
- Or, a misconfiguration of this task.
Testing tests/qunit/index.html .

I'm not sure how to fix this, but I'll work on it.

Last edited 3 years ago by ryankienstra (previous) (diff)

#21 @ocean90
3 years ago

  • Milestone changed from 4.6 to Future Release

Punting due to lack of a patch. Feel free to move it back if you can get a patch ready before 4.6.

Note: See TracTickets for help on using tickets.