diff --git a/.github/workflows/LintAndTest.yml b/.github/workflows/LintAndTest.yml new file mode 100644 index 000000000..23787df4e --- /dev/null +++ b/.github/workflows/LintAndTest.yml @@ -0,0 +1,30 @@ +name: Lint & Test + +on: + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + branches: + - master + - develop + +jobs: + lint-and-test: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: '10' + - name: Install Dependencies + run: | + yarn install --frozen-lockfile + - name: Build Licenses + run: | + node ./tools/licenses/fetchLicenses.js + - name: Lint + run: | + yarn lint + - name: Test + run: | + yarn test + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index b59cd64c0..000000000 --- a/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -language: node_js -node_js: - - "lts/dubnium" -cache: yarn - -install: - - yarn install --frozen-lockfile - -script: - - node ./tools/licenses/fetchLicenses.js - - yarn lint - - yarn test - -# Only build on pushes or PRs to these branches -branches: - only: - - master - - develop diff --git a/app/dawn-hub/Views/OnboardingViews/Step1_LogInForm/__tests__/Step1_LoginForm.test.jsx b/app/dawn-hub/Views/OnboardingViews/Step1_LogInForm/__tests__/Step1_LogInForm.test.jsx similarity index 89% rename from app/dawn-hub/Views/OnboardingViews/Step1_LogInForm/__tests__/Step1_LoginForm.test.jsx rename to app/dawn-hub/Views/OnboardingViews/Step1_LogInForm/__tests__/Step1_LogInForm.test.jsx index c64fb0a34..db47b2581 100644 --- a/app/dawn-hub/Views/OnboardingViews/Step1_LogInForm/__tests__/Step1_LoginForm.test.jsx +++ b/app/dawn-hub/Views/OnboardingViews/Step1_LogInForm/__tests__/Step1_LogInForm.test.jsx @@ -15,7 +15,7 @@ import React from 'react'; import renderer from 'react-test-renderer'; import { shallow } from 'enzyme'; import { MemoryRouter } from 'react-router'; -import Step1_LoginForm from '../Step1_LoginForm'; +import Step1_LogInForm from '../Step1_LogInForm'; const noop = () => {}; describe('app/hub/Views/Step1_LoginForm component', () => { @@ -33,7 +33,7 @@ describe('app/hub/Views/Step1_LoginForm component', () => { const component = renderer.create( - + ).toJSON(); expect(component).toMatchSnapshot(); @@ -49,7 +49,7 @@ describe('app/hub/Views/Step1_LoginForm component', () => { handleSubmit: jest.fn(), } - const component = shallow(); + const component = shallow(); expect(happyState.handleSubmit.mock.calls.length).toBe(0); component.find('form').simulate('submit'); expect(happyState.handleSubmit.mock.calls.length).toBe(1); @@ -65,7 +65,7 @@ describe('app/hub/Views/Step1_LoginForm component', () => { handleSubmit: jest.fn(), }; - const component = shallow(); + const component = shallow(); expect(sadState.handleSubmit.mock.calls.length).toBe(0); component.find('form').simulate('submit'); diff --git a/app/dawn-hub/Views/OnboardingViews/Step1_LogInForm/__tests__/__snapshots__/Step1_LoginForm.test.jsx.snap b/app/dawn-hub/Views/OnboardingViews/Step1_LogInForm/__tests__/__snapshots__/Step1_LogInForm.test.jsx.snap similarity index 100% rename from app/dawn-hub/Views/OnboardingViews/Step1_LogInForm/__tests__/__snapshots__/Step1_LoginForm.test.jsx.snap rename to app/dawn-hub/Views/OnboardingViews/Step1_LogInForm/__tests__/__snapshots__/Step1_LogInForm.test.jsx.snap diff --git a/app/dawn-hub/Views/OnboardingViews/Step4_ChoosePlanView/__tests__/ChoosePlanView.test.jsx b/app/dawn-hub/Views/OnboardingViews/Step4_ChoosePlanView/__tests__/ChoosePlanView.test.jsx index 8f815686f..73407dd44 100644 --- a/app/dawn-hub/Views/OnboardingViews/Step4_ChoosePlanView/__tests__/ChoosePlanView.test.jsx +++ b/app/dawn-hub/Views/OnboardingViews/Step4_ChoosePlanView/__tests__/ChoosePlanView.test.jsx @@ -16,6 +16,7 @@ import renderer from 'react-test-renderer'; import { shallow } from 'enzyme'; import { MemoryRouter } from 'react-router'; import ChoosePlanView from '../ChoosePlanView'; +import { SEARCH_GHOSTERY } from '../../Step3_ChooseDefaultSearchView/ChooseDefaultSearchConstants'; const noop = () => {}; @@ -25,7 +26,8 @@ describe('app/dawn-hub/Views/OnboardingViews/Step4_ChoosePlanView/ChoosePlanView selectedGhosteryGlow: true, actions: { setSetupStep: noop - } + }, + defaultSearch: SEARCH_GHOSTERY, }; describe('Snapshot tests with react-test-renderer', () => { test('ChoosePlanView is rendered correctly', () => { diff --git a/app/dawn-hub/Views/OnboardingViews/Step4_ChoosePlanView/__tests__/__snapshots__/ChoosePlanView.test.jsx.snap b/app/dawn-hub/Views/OnboardingViews/Step4_ChoosePlanView/__tests__/__snapshots__/ChoosePlanView.test.jsx.snap index 17346e643..e7ef3d63c 100644 --- a/app/dawn-hub/Views/OnboardingViews/Step4_ChoosePlanView/__tests__/__snapshots__/ChoosePlanView.test.jsx.snap +++ b/app/dawn-hub/Views/OnboardingViews/Step4_ChoosePlanView/__tests__/__snapshots__/ChoosePlanView.test.jsx.snap @@ -43,345 +43,49 @@ exports[`app/dawn-hub/Views/OnboardingViews/Step4_ChoosePlanView/ChoosePlanView.
- ghostery_dawn_onboarding_choose_an_option + ghostery_dawn_onboarding_based_on_your_privacy_preferences
-
+
+
-
-
-
- - - - - -
-
-
-
-
-

- Ghostery -

-
-

- hub_upgrade_plan_free -

-
-

- - hub_upgrade_basic_protection - -

-
-
- - ghostery_dawn_onboarding_private_search -
-
- - ghostery_dawn_onboarding_tracker_protection -
-
- - ghostery_dawn_onboarding_speedy_page_loads -
-
- - ghostery_dawn_onboarding_intelligence_technology -
-
-
-
-
-
-
- - - - - -
-
-
-
-

- Ghostery Plus -

-
-

- $4.99 -

-

- per_month -

-
-

- - hub_upgrade_additional_protection - -

-
-
- - ghostery_dawn_onboarding_private_search -
-
- - ghostery_dawn_onboarding_tracker_protection -
-
- - ghostery_dawn_onboarding_speedy_page_loads -
-
- - ghostery_dawn_onboarding_intelligence_technology -
-
- - ghostery_dawn_onboarding_ad_free -
-
- - ghostery_dawn_onboarding_supports_ghosterys_mission -
-
-
-
-
-
-
- - - - - -
-
-
-
-
-

- Ghostery Premium -

-
-

- $11.99 -

-

- per_month -

-
-

- - hub_upgrade_maximum_protection - -

-
-
- - ghostery_dawn_onboarding_private_search -
-
- - ghostery_dawn_onboarding_tracker_protection -
-
- - ghostery_dawn_onboarding_speedy_page_loads -
-
- - ghostery_dawn_onboarding_intelligence_technology -
-
- - ghostery_dawn_onboarding_ad_free -
-
- - ghostery_dawn_onboarding_supports_ghosterys_mission -
-
- - VPN -
-
- - ghostery_dawn_onboarding_unlimited_bandwidth -
-
-
-
+ ghostery_dawn_onboarding_ad_free_with_ghostery_plus_subscription
+ className="ChoosePlanView__adFreePromo" + > + (ghostery_dawn_onboarding_ad_free_promo) +
+
+ ghostery_dawn_onboarding_ad_free_promo_description +
+ + ghostery_dawn_onboarding_start_trial + +
+ ghostery_dawn_onboarding_see_all_plans +
+
`; diff --git a/app/panel/components/Settings/__tests__/OptIn.jsx b/app/panel/components/Settings/__tests__/OptIn.jsx index 3ac666606..f7eb8478d 100644 --- a/app/panel/components/Settings/__tests__/OptIn.jsx +++ b/app/panel/components/Settings/__tests__/OptIn.jsx @@ -22,6 +22,7 @@ describe('app/panel/Settings/OptIn.jsx', () => { const settingsData = { enable_metrics: false, enable_human_web: false, + enable_abtests: false, }; const component = renderer.create( @@ -37,6 +38,7 @@ describe('app/panel/Settings/OptIn.jsx', () => { const settingsData = { enable_metrics: true, enable_human_web: true, + enable_abtests: true, }; const component = renderer.create( @@ -54,6 +56,7 @@ describe('app/panel/Settings/OptIn.jsx', () => { const settingsData = { enable_metrics: true, enable_human_web: true, + enable_abtests: true, }; const toggleCheckbox = jest.fn(); diff --git a/app/panel/components/Settings/__tests__/__snapshots__/OptIn.jsx.snap b/app/panel/components/Settings/__tests__/__snapshots__/OptIn.jsx.snap index ef02188b0..8cbc32a7e 100644 --- a/app/panel/components/Settings/__tests__/__snapshots__/OptIn.jsx.snap +++ b/app/panel/components/Settings/__tests__/__snapshots__/OptIn.jsx.snap @@ -89,6 +89,7 @@ exports[`app/panel/Settings/OptIn.jsx Snapshot tests with react-test-renderer Op className="s-square-checkbox" > { if (typeof prefs !== 'undefined') { chrome.storage.local.set(prefs, () => { diff --git a/test/setup.js b/test/setup.js index e6c2ba6cc..d4eb81af3 100644 --- a/test/setup.js +++ b/test/setup.js @@ -19,8 +19,17 @@ import { enableFetchMocks } from 'jest-fetch-mock'; import Enzyme from 'enzyme'; import Adapter from 'enzyme-adapter-react-16'; -Enzyme.configure({ adapter: new Adapter() }); +// Disable logging +jest.mock('../src/utils/common', () => { + const commonActual = jest.requireActual('../src/utils/common'); + return { + ...commonActual, + log: () => false, + }; +}); + enableFetchMocks(); +Enzyme.configure({ adapter: new Adapter() }); // Fake the translation function to only return the translation key global.t = function(str) { diff --git a/test/utils/common.test.js b/test/utils/common.test.js index 9fcf96748..b8f52f290 100644 --- a/test/utils/common.test.js +++ b/test/utils/common.test.js @@ -11,7 +11,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0 */ -import { prefsSet, prefsGet } from '../../src/utils/common'; +import { prefsGet } from '../../src/utils/common'; describe('tests for prefsGet()', () => { // Setup prefsGet() by initializing chrome.storage.local.get()