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

Fix #3250 - Makes form wizard the default #3252

Merged
merged 5 commits into from
Mar 30, 2020
Merged

Conversation

karlcow
Copy link
Member

@karlcow karlcow commented Mar 24, 2020

This PR fixes issue #3250

Proposed PR background

My feeling is that if we are out of the experimental phase, we probably need to just not go through the AB code at all, and all of it becomes a lot simpler.

We can keep in place the code for future AB experiments and open a new issue for removing the old form code and tests once @ksy36 has finished refactoring the rest of the code for the new form.

So on this hypothesis, let's create a new PR. I expect tests to break badly. That's an Achilles' heel of our current setup. The AB experiment was an experiment at the beginning. Never let an experiment grows without the proper setup. We need to fix it.

(env) ~/code/webcompat.com % pytest
============================= test session starts ==============================
platform darwin -- Python 3.7.4, pytest-5.3.5, py-1.8.1, pluggy-0.13.1
rootdir: /Users/karl/code/webcompat.com
collected 157 items

tests/unit/test_api_urls.py ...........                                  [  7%]
tests/unit/test_config.py ..                                             [  8%]
tests/unit/test_console_logs.py .....                                    [ 11%]
tests/unit/test_form.py .................                                [ 22%]
tests/unit/test_helpers.py ............................                  [ 40%]
tests/unit/test_http_caching.py ...                                      [ 42%]
tests/unit/test_issues.py ......                                         [ 45%]
tests/unit/test_rendering.py ......                                      [ 49%]
tests/unit/test_tools_changelog.py ..                                    [ 50%]
tests/unit/test_topsites.py ...                                          [ 52%]
tests/unit/test_uploads.py ...                                           [ 54%]
tests/unit/test_urls.py .................................                [ 75%]
tests/unit/test_webhook.py ......................................        [100%]

============================= 157 passed in 21.28s =============================

Unit testing seems to work. There was a simple fix. The big breakage should happen on the functional tests side. Let's create a PR and see how much CircleCI is not happy about it.

@karlcow karlcow requested a review from ksy36 March 24, 2020 02:25
@karlcow
Copy link
Member Author

karlcow commented Mar 24, 2020

No unit test coverage for chrome 75.0.3770.100 on Linux
chrome 75.0.3770.100 on Linux: 99 passed, 2 failed
TOTAL: tested 2 platforms, 198 passed, 4 failed
Stopping
Stopped
something bad happened inside intern.run()
{ Error: One or more tests failed
    at /home/circleci/repo/node_modules/intern/lib/executors/Executor.js:386:45
    at /home/circleci/repo/node_modules/@theintern/common/index.js:16:7174
    at process._tickCallback (internal/process/next_tick.js:68:7) reported: true }

Exited with code exit status 1

This test

127.0.0.1 - - [24/Mar/2020 02:28:50] "GET /issues/new HTTP/1.1" 200 -

× firefox on linux 4.15.0-1052-aws - Reporting (non-auth) - Description validation (1.113s)

    Error: [POST http://localhost:4444/wd/hub/session/97201fda-3d8f-4f01-8b55-252780618c70/element/b426a6ea-a2ab-4fcd-823f-bb9fbe157fc1/value / {"value":["b","u","g"," ","d","e","s","c","r","i","p","t","i","o","n"]}] Element <input id="description" class="form-field text-field required" name="description" type="hidden"> is not reachable by keyboard

    Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'

    System info: host: '7dea615d62c3', ip: '192.168.144.3', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0-1052-aws', java.version: '11.0.3'

    Driver info: driver.version: unknown

      at Test.Description validation [as test] @ tests/functional/reporting-non-auth.js:148:12

      @ src/lib/Test.ts:266:51

and this test

127.0.0.1 - - [24/Mar/2020 02:28:52] "GET /issues/new HTTP/1.1" 200 -

× firefox on linux 4.15.0-1052-aws - Reporting (non-auth) - Submits are enabled (0.385s)

    Error: [POST http://localhost:4444/wd/hub/session/97201fda-3d8f-4f01-8b55-252780618c70/element/c729c5a0-fe29-4119-9ee9-42873bce6c36/value / {"value":["t","e","s","t"," ","f","o","r"," ","d","e","s","k","t","o","p"," ","s","i","t","e"]}] Element <input id="description" class="form-field text-field required" name="description" type="hidden"> is not reachable by keyboard

    Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'

    System info: host: '7dea615d62c3', ip: '192.168.144.3', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0-1052-aws', java.version: '11.0.3'

    Driver info: driver.version: unknown

      at Test.Submits are enabled [as test] @ tests/functional/reporting-non-auth.js:226:12

      @ src/lib/Test.ts:266:51

Let's see if we can fix those two.

@karlcow
Copy link
Member Author

karlcow commented Mar 24, 2020

ok fixed one test… maybe. circleci will tell us if we are off.

@karlcow
Copy link
Member Author

karlcow commented Mar 24, 2020

Fixing the test will be painful.
Also why this is not working anymore.

It dies silently

node ./tests/functional/_intern.js "--functionalSuites=tests/functional/reporting-non-auth.js"

@karlcow
Copy link
Member Author

karlcow commented Mar 24, 2020

🤔 puzzling

    NoSuchElement: [POST http://localhost:4444/wd/hub/session/27d4733c1552221fdb27c20e4cd4f712/element / {"using":"css selector","value":".step-1"}] 
no such element: Unable to locate element: {"method":"css selector","selector":".step-1"}

what do i do wrong?

@karlcow
Copy link
Member Author

karlcow commented Mar 24, 2020

I wish i could run leadfoot inside the browser console.

@karlcow
Copy link
Member Author

karlcow commented Mar 24, 2020

oh wait the new form is already tested in /tests/functional/reporting-issue-wizard-non-auth.js
ok let's remove the other one. and remove the cookie and if it fails, I guess it could be because of caching and that would explain why it was failing.

@karlcow
Copy link
Member Author

karlcow commented Mar 24, 2020

ok this is more logical all tests are failing for the wizard form. so that means that the files are being cached.

× firefox on linux 4.15.0-1052-aws - Reporting with wizard - Wizard stepper - scenario 2 (10.254s)

    NoSuchElement: [POST http://localhost:4444/wd/hub/session/d1d9060f-fbfe-4f81-8c89-2314ac4dcb0d/element / {"using":"css selector","value":".button.step-1"}] Unable to locate element: .button.step-1

    For documentation on this error, please visit: https://www.seleniumhq.org/exceptions/no_such_element.html

    Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'

    System info: host: '66b5d67c4eeb', ip: '172.22.0.3', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0-1052-aws', java.version: '11.0.3'

    Driver info: driver.version: unknown

      at Test.Wizard stepper - scenario 2 [as test] @ tests/functional/reporting-issue-wizard-non-auth.js:164:12

      @ src/lib/Test.ts:266:51

@karlcow
Copy link
Member Author

karlcow commented Mar 24, 2020

I exhausted github through circleci for a little while. Let's wait.

@ksy36
Copy link
Contributor

ksy36 commented Mar 24, 2020

I've checked out the branch, looks like it's not working because this condition is still in the templates (layout.html, new-issue.html):

{%- if ab_active('exp') == 'form-v2' %}

@ksy36
Copy link
Contributor

ksy36 commented Mar 24, 2020

Also this should be removed? Probably no point of adding the label if all reports will be going through the new form

if ab_active('exp') == 'form-v2':
if isinstance(extra_labels, list):
extra_labels.append('form-v2-experiment')
else:
extra_labels = ['form-v2-experiment']

webcompat/views.py Show resolved Hide resolved
@karlcow
Copy link
Member Author

karlcow commented Mar 24, 2020

  • yes the labeling should be removed. Good point.
  • {%- if ab_active('exp') == 'form-v2' %} and still manually I receive the right thing, but yes I will check this too. Good call. Thanks.

@karlcow
Copy link
Member Author

karlcow commented Mar 25, 2020

ok this is much better now that I have fixed my issue with #3255 and a couple of other things.

Capture d’écran 2020-03-25 à 13 06 00

@karlcow
Copy link
Member Author

karlcow commented Mar 25, 2020

These are the tests failing

  • Image Uploads (non-auth) - Selecting an invalid image after a valid one
  • Image Uploads (non-auth) - Image extension validation
  • Reporting (auth) - Report button shows name
  • Reporting through postMessage - postMessaged object

@karlcow
Copy link
Member Author

karlcow commented Mar 25, 2020

Capture d’écran 2020-03-25 à 16 46 00

Only two tests to fix, and then we are good to rebase a bit the things and ride. :)

@karlcow
Copy link
Member Author

karlcow commented Mar 26, 2020

Capture d’écran 2020-03-26 à 12 00 44

ok all green locally. now let's rebase this. :)

karlcow added 4 commits March 26, 2020 12:15
Our AB testing experiment is finished. We could remove all this code or just make it more abstract for the next experiment we would want to do. So in this commit I removed the mention of form.
I'm not sure this test is fully neede or at least not in this form.
There might be room for a more generic tests related to if there is an AB experiment going on and we choose to add a label, how do we track and test this.
some tests have been removed because duplicated elsewhere. some partially rewritten. The new form is definitely more challending to test than the previous one and there is a lot of repeat. In fact I would probably see in the future a way where we can branch scenarios in the tests through meta function, instead of repeating the same code again and again.
Instead of keeping the choice in between the old form and the wizard form, we make the wizard form the default. we should create another issue to finally remove all the code related to the old form.
@karlcow
Copy link
Member Author

karlcow commented Mar 26, 2020

@ksy36 This is request for another review. the code changed quite a bit and i modified things with your recommendations.

@miketaylr I decided to make the wizard form the default.

also each commit as an extended description explaining the line of thoughts.

@@ -226,25 +225,23 @@ def get_variation(variation_key, variations_dict, defaults_dict):

# Get AB experiment variation values from the environement.
AB_VARIATIONS = {
'FORM_V1_VARIATION': os.environ.get('FORM_V1_VARIATION', '0 100'),
'FORM_V2_VARIATION': os.environ.get('FORM_V2_VARIATION', '100 100'),
'V1_VARIATION': os.environ.get('V1_VARIATION', '0 100'),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@karlcow can you make sure to update the environment variables on the server to match this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(i did this)

@miketaylr
Copy link
Member

I think we're good to merge and deploy (to staging first).

@miketaylr miketaylr merged commit 476c9c7 into webcompat:master Mar 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants