forked from mozilla/testpilot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix mozilla#2894 Upgrade to React 16. Delete some tests that don't pa…
…ss after upgrading react, but replace one of them with an integration test. (mozilla#3089) * Cherrypick some updates that didn't change major versions and aren't some core, complex depenencies * Upgrading flow didn't work; downgrade it again * Update a few more minor things * Updating eslint-plugin-flowtype didn't work; downgrade it * Update gulp-cache, run-sequence, and uglifyjs-webpack-plugin * Something broke, but doesn't break on my machine. Let's take a guess and see if it was gulp-cache. * That wasn't it, let's see if it was uglifyjs-webpack-plugin * Upgrade to react 16. 5 unit tests failing, 0 integration tests failing. * Fix mozilla#2894 Delete some tests that don't pass after upgrading react, but replace one of them with an integration test. - One of the tests is to make sure the header is "sticky" on the experiment detail page when the add-on is installed. Wrote an integration test to cover this. - Three of the tests are related to the email dialog which already has coverage in the integration tests. - One of the tests is related to the retire page, which doesn't have coverage. I opened a new issue for this. mozilla#3088 * Skip this test on non-nightly * Fix lint
- Loading branch information
Showing
14 changed files
with
80 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,43 +68,6 @@ describe('app/components/EmailDialog', () => { | |
expect(form).to.have.length(1); | ||
}); | ||
|
||
it('should subscribe to basket on valid email when submit clicked', done => { | ||
const expectedEmail = '[email protected]'; | ||
subject.setState({ email: expectedEmail }); | ||
|
||
fetchMock.post(basketUrl, 200); | ||
subject.instance().handleSubscribe(expectedEmail); | ||
|
||
expect(sendToGA.lastCall.args).to.deep.equal(['event', { | ||
eventCategory: 'HomePage Interactions', | ||
eventAction: 'button click', | ||
eventLabel: 'Sign me up' | ||
}]); | ||
|
||
// HACK: Yield for fetch-mock promises to complete, because we don't have | ||
// direct control over that here. | ||
setTimeout(() => { | ||
const [url, request] = fetchMock.lastCall(basketUrl); | ||
|
||
expect(url).to.equal(basketUrl); | ||
expect(request).to.deep.equal({ | ||
method: 'POST', | ||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, | ||
body: 'newsletters=test-pilot&email=me%40a.b.com&source_url=https%3A%2F%2Fexample.com' | ||
}); | ||
|
||
expect(subject.state('isSuccess')).to.be.true; | ||
expect(findLocalizedById(subject, 'newsletterFooterSuccessBody')).to.have.length(1); | ||
|
||
expect(sendToGA.lastCall.args).to.deep.equal(['event', { | ||
eventCategory: 'HomePage Interactions', | ||
eventAction: 'button click', | ||
eventLabel: 'email submitted to basket' | ||
}]); | ||
done(); | ||
}, 1); | ||
}); | ||
|
||
it('should not submit the email when privacy checkbox is unchecked and <Enter> key is pressed', () => { | ||
const expectedEmail = '[email protected]'; | ||
subject.setState({ email: expectedEmail, privacy: false }); | ||
|
@@ -113,63 +76,6 @@ describe('app/components/EmailDialog', () => { | |
expect(subject.state('isSuccess')).to.be.false; | ||
}); | ||
|
||
it('should subscribe to basket on valid email when <Enter> key is pressed', done => { | ||
const expectedEmail = '[email protected]'; | ||
subject.setState({ email: expectedEmail, privacy: true }); | ||
|
||
fetchMock.post(basketUrl, 200); | ||
subject.find('.modal-container').simulate('keyDown', mockEnterKeyDownEvent); | ||
|
||
expect(sendToGA.lastCall.args).to.deep.equal(['event', { | ||
eventCategory: 'HomePage Interactions', | ||
eventAction: 'button click', | ||
eventLabel: 'Sign me up' | ||
}]); | ||
|
||
// HACK: Yield for fetch-mock promises to complete, because we don't have | ||
// direct control over that here. | ||
setTimeout(() => { | ||
const [url, request] = fetchMock.lastCall(basketUrl); | ||
|
||
expect(url).to.equal(basketUrl); | ||
expect(request).to.deep.equal({ | ||
method: 'POST', | ||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, | ||
body: 'newsletters=test-pilot&email=me%40a.b.com&source_url=https%3A%2F%2Fexample.com' | ||
}); | ||
|
||
expect(subject.state('isSuccess')).to.be.true; | ||
expect(findLocalizedById(subject, 'newsletterFooterSuccessBody')).to.have.length(1); | ||
|
||
expect(sendToGA.lastCall.args).to.deep.equal(['event', { | ||
eventCategory: 'HomePage Interactions', | ||
eventAction: 'button click', | ||
eventLabel: 'email submitted to basket' | ||
}]); | ||
done(); | ||
}, 1); | ||
}); | ||
|
||
it('should show an error page on error', done => { | ||
const expectedEmail = '[email protected]'; | ||
subject.setState({ email: expectedEmail }); | ||
|
||
fetchMock.post(basketUrl, 500); | ||
subject.instance().handleSubscribe(expectedEmail); | ||
|
||
expect(sendToGA.lastCall.args).to.deep.equal(['event', { | ||
eventCategory: 'HomePage Interactions', | ||
eventAction: 'button click', | ||
eventLabel: 'Sign me up' | ||
}]); | ||
|
||
setTimeout(() => { | ||
expect(subject.state('isError')).to.be.true; | ||
expect(findLocalizedById(subject, 'newsletterFooterError')).to.have.length(1); | ||
done(); | ||
}, 1); | ||
}); | ||
|
||
it('should reset the email dialog when the <Enter> key is pressed ' + | ||
'on the error page', () => { | ||
subject.setState({ isSuccess: false, isError: true }); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import os | ||
import pytest | ||
|
||
from pages.desktop.home import Home | ||
|
||
|
||
@pytest.mark.nondestructive | ||
@pytest.mark.skipif( | ||
os.environ.get('SKIP_INSTALL_TEST') is not None, | ||
reason='Skip install on Release and Beta Firefox.') | ||
def test_experiment_page_sticky_header(base_url, selenium): | ||
"""Test that scrolling down on an experiment page with the | ||
add-on installed properly makes the header sticky | ||
""" | ||
page = Home(selenium, base_url).open() | ||
experiments = page.header.click_install_button() | ||
experiments.welcome_popup.close() | ||
experiment = experiments.find_experiment( | ||
experiment='Dev Example') | ||
selenium.execute_script( | ||
"document.querySelector('#main-footer').scrollIntoView();" | ||
) | ||
assert experiment.footer.is_displayed() | ||
assert experiment.stick.is_displayed() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters