+2017-04-11 Ryosuke Niwa <rniwa@webkit.org>
+
+ Retrying an A/B testing does not set the repetition count in some cases
+ https://bugs.webkit.org/show_bug.cgi?id=170695
+
+ Reviewed by Joseph Pecoraro.
+
+ When selecting an existing A/B test group, the analysis task page automatically sets the repetition count
+ of its retry to be that of the original test group. However, this information wasn't being passed correctly
+ to the code that actually created a test group. As a result, the retried test group's repetition count does
+ not match that of the original group or the number shown to the user on UI.
+
+ Fixed the bug by updating this._repetitionCount in setRepetitionCount.
+
+ * browser-tests/index.html:
+ * browser-tests/test-group-form-tests.js: Added. Added tests.
+ (.createTestGroupFormWithContext): Added.
+ * public/v3/components/test-group-form.js:
+ (TestGroupForm.prototype.setRepetitionCount):
+ (TestGroupForm.formContent):
+ (TestGroupForm):
+
2017-04-10 Ryosuke Niwa <rniwa@webkit.org>
Add the UI for scheduling a A/B testing with a custom root
--- /dev/null
+
+describe('TestGroupFormTests', () => {
+ const scripts = ['instrumentation.js', 'components/base.js', 'components/test-group-form.js'];
+
+ function createTestGroupFormWithContext(context)
+ {
+ return context.importScripts(scripts, 'ComponentBase', 'TestGroupForm').then((symbols) => {
+ const testGroupForm = new context.symbols.TestGroupForm;
+ context.document.body.appendChild(testGroupForm.element());
+ return testGroupForm;
+ });
+ }
+
+ it('must dispatch "startTesting" action with the number of repetitions the user clicks on "Start A/B testing"', () => {
+ const context = new BrowsingContext();
+ return createTestGroupFormWithContext(context).then((testGroupForm) => {
+ const calls = [];
+ testGroupForm.listenToAction('startTesting', (...args) => calls.push(args));
+ expect(calls).to.eql({});
+ testGroupForm.content('start-button').click();
+ expect(calls).to.eql([[4]]);
+ });
+ });
+
+ it('must update the repetition count when the user selected a different count', () => {
+ const context = new BrowsingContext();
+ return createTestGroupFormWithContext(context).then((testGroupForm) => {
+ const calls = [];
+ testGroupForm.listenToAction('startTesting', (...args) => calls.push(args));
+ expect(calls).to.eql({});
+ testGroupForm.content('start-button').click();
+ expect(calls).to.eql([[4]]);
+ const countForm = testGroupForm.content('repetition-count');
+ countForm.value = '6';
+ countForm.dispatchEvent(new Event('change'));
+ testGroupForm.content('start-button').click();
+ expect(calls).to.eql([[4], [6]]);
+ });
+ });
+
+ describe('setRepetitionCount', () => {
+ it('must update the visible repetition count', () => {
+ const context = new BrowsingContext();
+ return createTestGroupFormWithContext(context).then((testGroupForm) => {
+ expect(testGroupForm.content('repetition-count').value).to.be('4');
+ testGroupForm.setRepetitionCount(2);
+ return waitForComponentsToRender(context).then(() => {
+ expect(testGroupForm.content('repetition-count').value).to.be('2');
+ });
+ });
+ });
+
+ it('must update the repetition count passed to "startTesting" action', () => {
+ const context = new BrowsingContext();
+ return createTestGroupFormWithContext(context).then((testGroupForm) => {
+ const calls = [];
+ testGroupForm.listenToAction('startTesting', (...args) => calls.push(args));
+ expect(calls).to.eql({});
+ testGroupForm.content().querySelector('button').click();
+ expect(calls).to.eql([[4]]);
+ testGroupForm.setRepetitionCount(8);
+ testGroupForm.content().querySelector('button').click();
+ expect(calls).to.eql([[4], [8]]);
+ });
+ });
+ });
+});