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

Electron4 changes #669

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
runtime = electron
target = 2.0.7
target = 5.0.0
target_arch = x64
config_arch=x64
disturl = https://atom.io/download/atom-shell
tag-version-prefix=""
build_from_source=true


# npm_config_target=1.2.3
# The architecture of Electron, see https://electronjs.org/docs/tutorial/support#supported-platforms
# for supported architectures.
# m_config_target_arch=x64
# Download headers for Electron.
# export npm_config_disturl=https://atom.io/download/electron
# Tell node-pre-gyp that we are building for Electron.
# export npm_config_runtime=electron
# Tell node-pre-gyp to build module from source code.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v8.9.0
v10.15.0
9 changes: 2 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,13 @@ matrix:
include:
- os: osx
language: node_js
node_js:
# Must use node 8 while on electron 2.x (for safe.spec tests.)
- 8
env:
- ELECTRON_CACHE=$HOME/.cache/electron
- ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder
- NODE_ENV=dev

- os: linux
language: node_js
node_js:
- 8
env:
- NODE_ENV=dev
addons:
Expand Down Expand Up @@ -89,8 +84,8 @@ script:
fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then xdg-open --version;
fi
- travis_retry eval "pkill -f electron || pkill -f jest || yarn run test-peruse --forceExit"
- travis_retry eval "pkill -f electron || pkill -f jest || yarn run test-exts --forceExit"
- travis_retry yarn run test-peruse --forceExit
- travis_retry yarn run test-exts --forceExit
- yarn build-e2e
- travis_retry yarn cross-env NODE_ENV=test TEST_CAFE=true IS_UNPACKED=true testcafe electron:. ./__testcafe__/peruse.spec.ts
- travis_retry yarn cross-env NODE_ENV=test TEST_CAFE=true IS_UNPACKED=true testcafe electron:. ./__testcafe__/navigation.spec.ts
Expand Down
10 changes: 5 additions & 5 deletions __tests__/components/AddressBar.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jest.mock( 'extensions/safe/ffi/refs/parsers', () => ( {} ) );

jest.mock( 'ref-array', () => jest.fn() );
//
jest.mock( 'ffi', () => jest.fn() );
jest.mock( 'ffi-napi', () => jest.fn() );
jest.mock( 'extensions/safe/ffi/authenticator', () => jest.fn() );

jest.mock( '@maidsafe/safe-node-app', () => jest.fn() );
Expand All @@ -23,11 +23,11 @@ jest.mock( 'extensions/safe/actions/safeBrowserApplication_actions' );
describe( 'AddressBar', () => {
let wrapper;
let instance;
let props;
let properties;
let store;

beforeEach( () => {
props = {
properties = {
windowId: 1,
address: 'about:blank',
isSelected: false,
Expand All @@ -50,11 +50,11 @@ describe( 'AddressBar', () => {

describe( 'constructor( props )', () => {
beforeEach( () => {
store = mockStore( props );
store = mockStore( properties );

wrapper = shallow(
<Provider store={store}>
<AddressBar {...props} />
<AddressBar {...properties} />
</Provider>
).dive();

Expand Down
10 changes: 5 additions & 5 deletions __tests__/components/AddressBarButtonsLHS.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jest.mock( 'extensions/safe/ffi/refs/parsers', () => ( {} ) );

jest.mock( 'ref-array', () => jest.fn() );
//
jest.mock( 'ffi', () => jest.fn() );
jest.mock( 'ffi-napi', () => jest.fn() );
jest.mock( 'extensions/safe/ffi/authenticator', () => jest.fn() );

jest.mock( '@maidsafe/safe-node-app', () => jest.fn() );
Expand All @@ -27,11 +27,11 @@ jest.mock( '$Utils/extendComponent' );
describe( 'AddressBarButtonsLHS', () => {
let wrapper;
let instance;
let props;
let properties;
let store;

beforeEach( () => {
props = {
properties = {
windowId: 1,
address: 'about:blank',
isSelected: false,
Expand All @@ -50,11 +50,11 @@ describe( 'AddressBarButtonsLHS', () => {

describe( 'constructor( props )', () => {
beforeEach( () => {
store = mockStore( props );
store = mockStore( properties );

wrapper = shallow(
<Provider store={store}>
<AddressBarButtonsLHS {...props} />
<AddressBarButtonsLHS {...properties} />
</Provider>
).dive();
instance = wrapper.instance();
Expand Down
10 changes: 5 additions & 5 deletions __tests__/components/AddressBarButtonsRHS.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jest.mock( 'extensions/safe/ffi/refs/parsers', () => ( {} ) );

jest.mock( 'ref-array', () => jest.fn() );
//
jest.mock( 'ffi', () => jest.fn() );
jest.mock( 'ffi-napi', () => jest.fn() );
jest.mock( 'extensions/safe/ffi/authenticator', () => jest.fn() );

jest.mock( '@maidsafe/safe-node-app', () => jest.fn() );
Expand All @@ -26,11 +26,11 @@ jest.mock( '$Utils/extendComponent' );
describe( 'AddressBarButtonsRHS', () => {
let wrapper;
let instance;
let props;
let properties;
let store;

beforeEach( () => {
props = {
properties = {
windowId: 1,
address: 'about:blank',
isSelected: false,
Expand All @@ -48,11 +48,11 @@ describe( 'AddressBarButtonsRHS', () => {

describe( 'constructor( props )', () => {
beforeEach( () => {
store = mockStore( props );
store = mockStore( properties );

wrapper = shallow(
<Provider store={store}>
<AddressBarButtonsRHS {...props} />
<AddressBarButtonsRHS {...properties} />
</Provider>
).dive();
instance = wrapper.instance();
Expand Down
30 changes: 15 additions & 15 deletions __tests__/components/AddressBarInput.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jest.mock( 'extensions/safe/ffi/refs/parsers', () => ( {} ) );

jest.mock( 'ref-array', () => jest.fn() );
//
jest.mock( 'ffi', () => jest.fn() );
jest.mock( 'ffi-napi', () => jest.fn() );
jest.mock( 'extensions/safe/ffi/authenticator', () => jest.fn() );

jest.mock( '@maidsafe/safe-node-app', () => jest.fn() );
Expand All @@ -22,11 +22,11 @@ jest.mock( 'extensions/safe/actions/safeBrowserApplication_actions' );
describe( 'AddressBarInput', () => {
let wrapper;
let instance;
let props;
let properties;
let store;

beforeEach( () => {
props = {
properties = {
windowId: 1,
address: 'about:blank',
isSelected: false,
Expand All @@ -46,11 +46,11 @@ describe( 'AddressBarInput', () => {

describe( 'constructor( props )', () => {
beforeEach( () => {
store = mockStore( props );
store = mockStore( properties );

wrapper = shallow(
<Provider store={store}>
<AddressBarInput {...props} />
<AddressBarInput {...properties} />
</Provider>
).dive();
instance = wrapper.instance();
Expand All @@ -63,11 +63,11 @@ describe( 'AddressBarInput', () => {

describe( 'events', () => {
beforeEach( () => {
store = mockStore( props );
store = mockStore( properties );

wrapper = mount(
<Provider store={store}>
<AddressBarInput {...props} />
<AddressBarInput {...properties} />
</Provider>
);
instance = wrapper.instance();
Expand All @@ -81,7 +81,7 @@ describe( 'AddressBarInput', () => {
const handleBlur = jest.fn();
wrapper = mount(
<Provider store={store}>
<AddressBarInput {...props} onBlur={handleBlur} />
<AddressBarInput {...properties} onBlur={handleBlur} />
</Provider>
);
const input = wrapper.find( 'Input' );
Expand All @@ -92,14 +92,14 @@ describe( 'AddressBarInput', () => {
it( 'check on onBlur,onBlur() is called', () => {
const input = wrapper.find( 'Input' );
input.simulate( 'blur' );
expect( props.onBlur ).toHaveBeenCalled();
expect( properties.onBlur ).toHaveBeenCalled();
} );

it( 'check on onFocus,handleFocus is called', () => {
const handleFocus = jest.fn();
wrapper = mount(
<Provider store={store}>
<AddressBarInput {...props} onFocus={handleFocus} />
<AddressBarInput {...properties} onFocus={handleFocus} />
</Provider>
);
instance = wrapper.instance();
Expand All @@ -111,25 +111,25 @@ describe( 'AddressBarInput', () => {
it( 'check on onFocus,onFocus() is called', () => {
wrapper = mount(
<Provider store={store}>
<AddressBarInput {...props} />
<AddressBarInput {...properties} />
</Provider>
);
instance = wrapper.instance();
const input = wrapper.find( 'Input' );
input.simulate( 'focus' );
expect( props.onFocus ).toHaveBeenCalled();
expect( properties.onFocus ).toHaveBeenCalled();
} );

it( 'check on onKeyPress if updateTab is called', () => {
const input = wrapper.find( 'Input' );
input.simulate( 'keyPress', { key: 'Enter', keyCode: 13, which: 13 } );
expect( props.updateTab ).toHaveBeenCalled();
expect( properties.updateTab ).toHaveBeenCalled();
} );

it( 'check on onKeyPress if updateTab is called with params', () => {
const input = wrapper.find( 'Input' );
input.simulate( 'keyPress', { key: 'Enter', keyCode: 13, which: 13 } );
expect( props.updateTab ).toHaveBeenCalledWith( {
expect( properties.updateTab ).toHaveBeenCalledWith( {
url: 'about:blank',
windowId: 1
} );
Expand All @@ -139,7 +139,7 @@ describe( 'AddressBarInput', () => {
const input = wrapper.find( 'Input' );
input.value = '123456';
input.simulate( 'change' );
expect( props.onSelect ).toHaveBeenCalled();
expect( properties.onSelect ).toHaveBeenCalled();
} );
} );
} );
15 changes: 5 additions & 10 deletions __tests__/components/TabBar.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import React from 'react';
import { mount, shallow } from 'enzyme';
import TabBar from '$Components/TabBar';
import MdClose from 'react-icons/lib/md/close';
import MdAdd from 'react-icons/lib/md/add';
import { Icon } from 'antd';
import { CLASSES } from '$Constants';
import { Spinner } from 'nessie-ui';

describe( 'TabBar', () => {
let wrapper;
Expand Down Expand Up @@ -54,12 +52,9 @@ describe( 'TabBar', () => {
expect( wrapper.find( '#favicon-img' ).length ).toBe( 1 );
} );

it( 'should have exactly 1 MdAdd component', () => {
expect( wrapper.find( MdAdd ).length ).toBe( 1 );
} );

it( 'should have exactly 1 MdClose component', () => {
expect( wrapper.find( MdClose ).length ).toBe( 1 );
it( 'should have exactly 2 Button components', () => {
// add and close
expect( wrapper.find( Icon ).length ).toBe( 2 );
} );
} );

Expand All @@ -80,7 +75,7 @@ describe( 'TabBar', () => {
} );

it( 'should have exactly 1 tab with loading indicator', () => {
expect( wrapper.find( Spinner ).length ).toBe( 1 );
expect( wrapper.find( Icon ).length ).toBe( 3 );
} );
} );

Expand Down
16 changes: 0 additions & 16 deletions app/browserPreload.ts

This file was deleted.

3 changes: 1 addition & 2 deletions app/components/PerusePages/Bookmarks/Bookmarks.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { Component } from 'react';
// import { Link } from 'react-router';
import { ipcRenderer, remote } from 'electron';
import { Page, H1, PageHeader } from 'nessie-ui';
import UrlList from '$Components/UrlList';
Expand All @@ -19,7 +18,7 @@ export default class Bookmarks extends Component<BookmarksProps, {}> {

render() {
const { bookmarks, isActiveTab, addTab } = this.props;
const bookmarkList = bookmarks.map( bookmark => bookmark.url );
const bookmarkList = bookmarks.map( ( bookmark ) => bookmark.url );
let moddedClass = styles.tab;
if ( isActiveTab ) {
moddedClass = styles.activeTab;
Expand Down
Loading