diff --git a/__device-tests__/gutenberg-editor-block-insertion.test.js b/__device-tests__/gutenberg-editor-block-insertion.test.js index 2e6c1c20e5..1622915183 100644 --- a/__device-tests__/gutenberg-editor-block-insertion.test.js +++ b/__device-tests__/gutenberg-editor-block-insertion.test.js @@ -15,7 +15,7 @@ import { } from './helpers/utils'; import testData from './helpers/test-data'; -jasmine.DEFAULT_TIMEOUT_INTERVAL = 400000; +jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000; describe( 'Gutenberg Editor tests for Block insertion', () => { let driver; diff --git a/__device-tests__/gutenberg-editor-heading.test.js b/__device-tests__/gutenberg-editor-heading.test.js index 50f0cd0b72..c3d62168c4 100644 --- a/__device-tests__/gutenberg-editor-heading.test.js +++ b/__device-tests__/gutenberg-editor-heading.test.js @@ -14,7 +14,7 @@ import { } from './helpers/utils'; import testData from './helpers/test-data'; -jasmine.DEFAULT_TIMEOUT_INTERVAL = 400000; +jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000; describe( 'Gutenberg Editor tests', () => { let driver; diff --git a/__device-tests__/gutenberg-editor-image.test.js b/__device-tests__/gutenberg-editor-image.test.js index 9613271d94..e504807156 100644 --- a/__device-tests__/gutenberg-editor-image.test.js +++ b/__device-tests__/gutenberg-editor-image.test.js @@ -16,7 +16,7 @@ import { } from './helpers/utils'; import testData from './helpers/test-data'; -jasmine.DEFAULT_TIMEOUT_INTERVAL = 400000; +jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000; describe( 'Gutenberg Editor Image Block tests', () => { let driver; diff --git a/__device-tests__/gutenberg-editor-lists-end.test.js b/__device-tests__/gutenberg-editor-lists-end.test.js index 2c626c9e02..ad6cc22372 100644 --- a/__device-tests__/gutenberg-editor-lists-end.test.js +++ b/__device-tests__/gutenberg-editor-lists-end.test.js @@ -14,7 +14,7 @@ import { } from './helpers/utils'; import testData from './helpers/test-data'; -jasmine.DEFAULT_TIMEOUT_INTERVAL = 400000; +jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000; describe( 'Gutenberg Editor tests for List block (end)', () => { let driver; diff --git a/__device-tests__/gutenberg-editor-lists.test.js b/__device-tests__/gutenberg-editor-lists.test.js index 19d2f43a1c..ad708491e1 100644 --- a/__device-tests__/gutenberg-editor-lists.test.js +++ b/__device-tests__/gutenberg-editor-lists.test.js @@ -14,9 +14,9 @@ import { } from './helpers/utils'; import testData from './helpers/test-data'; -jasmine.DEFAULT_TIMEOUT_INTERVAL = 400000; +jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000; -xdescribe( 'Gutenberg Editor tests for List block', () => { +describe( 'Gutenberg Editor tests for List block', () => { let driver; let editorPage; let allPassed = true; diff --git a/__device-tests__/gutenberg-editor-paragraph.test.js b/__device-tests__/gutenberg-editor-paragraph.test.js index fa402e75c1..770b0368d3 100644 --- a/__device-tests__/gutenberg-editor-paragraph.test.js +++ b/__device-tests__/gutenberg-editor-paragraph.test.js @@ -16,7 +16,7 @@ import { } from './helpers/utils'; import testData from './helpers/test-data'; -jasmine.DEFAULT_TIMEOUT_INTERVAL = 400000; +jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000; describe( 'Gutenberg Editor tests for Paragraph Block', () => { let driver; diff --git a/__device-tests__/gutenberg-editor-paste.test.js b/__device-tests__/gutenberg-editor-paste.test.js index 40220def41..4b5926bd64 100644 --- a/__device-tests__/gutenberg-editor-paste.test.js +++ b/__device-tests__/gutenberg-editor-paste.test.js @@ -18,7 +18,7 @@ import { } from './helpers/utils'; import testData from './helpers/test-data'; -jasmine.DEFAULT_TIMEOUT_INTERVAL = 400000; +jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000; describe( 'Gutenberg Editor paste tests', () => { // skip iOS for now diff --git a/__device-tests__/gutenberg-editor-rotatation.test.js b/__device-tests__/gutenberg-editor-rotatation.test.js index 251d3a5680..11e1c6495d 100644 --- a/__device-tests__/gutenberg-editor-rotatation.test.js +++ b/__device-tests__/gutenberg-editor-rotatation.test.js @@ -15,9 +15,9 @@ import { } from './helpers/utils'; import testData from './helpers/test-data'; -jasmine.DEFAULT_TIMEOUT_INTERVAL = 300000; +jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000; -xdescribe( 'Gutenberg Editor tests', () => { +describe( 'Gutenberg Editor tests', () => { let driver; let editorPage; let allPassed = true; diff --git a/gutenberg b/gutenberg index f3085c1eb0..fea63772b6 160000 --- a/gutenberg +++ b/gutenberg @@ -1 +1 @@ -Subproject commit f3085c1eb012d8a125fe683620a2d0a7a6d045a9 +Subproject commit fea63772b6e2f71e7422c999e436c44bd3914021 diff --git a/jest_ui.config.js b/jest_ui.config.js index 39d086316c..adf98100cd 100644 --- a/jest_ui.config.js +++ b/jest_ui.config.js @@ -5,6 +5,7 @@ const main = require( './jest.config.js' ); module.exports = { ...main, + timers: 'real', setupFiles: [], testMatch: [ '**/__device-tests__/**/*.test.[jt]s?(x)' ], testPathIgnorePatterns: [ diff --git a/package.json b/package.json index bceb4f96ac..93b4789ace 100644 --- a/package.json +++ b/package.json @@ -147,8 +147,8 @@ "node-libs-react-native": "^1.0.2", "node-sass": "^4.12.0", "react": "16.8.6", - "react-native": "jtreanor/react-native#v0.60.0-patched", - "react-native-dark-mode": "git+https://github.com/wordpress-mobile/react-native-dark-mode.git#f09bf1480e7b34536413ab3300f29e4375edb2c6", + "react-native": "jtreanor/react-native#v0.60.0-patched", + "react-native-dark-mode": "git+https://github.com/wordpress-mobile/react-native-dark-mode.git#f09bf1480e7b34536413ab3300f29e4375edb2c6", "react-native-hr": "git+https://github.com/Riglerr/react-native-hr.git#2d01a5cf77212d100e8b99e0310cce5234f977b3", "react-native-keyboard-aware-scroll-view": "git+https://github.com/wordpress-mobile/react-native-keyboard-aware-scroll-view.git#gb-v0.8.7", "react-native-modal": "^6.5.0", diff --git a/src/index.js b/src/index.js index 21de01c7f5..0abf7c80ec 100644 --- a/src/index.js +++ b/src/index.js @@ -7,7 +7,7 @@ /** * External dependencies */ -import { AppRegistry, I18nManager, YellowBox } from 'react-native'; +import { AppRegistry, I18nManager } from 'react-native'; import React from 'react'; /** @@ -23,12 +23,8 @@ import { getTranslation } from '../i18n-cache'; import initialHtml from './initial-html'; const gutenbergSetup = () => { - const apiFetch = require( '@wordpress/api-fetch' ).default; const wpData = require( '@wordpress/data' ); - // wp-api-fetch - apiFetch.use( apiFetch.createRootURLMiddleware( 'https://public-api.wordpress.com/' ) ); - // wp-data const userId = 1; const storageKey = 'WP_DATA_USER_' + userId; @@ -82,8 +78,9 @@ export class RootComponent extends React.Component { } export function registerApp() { - // Disable require circle warnings showing up in the app (they will still be visible in the console) - YellowBox.ignoreWarnings( [ 'Require cycle:' ] ); + // Disable warnings as they disrupt the user experience in dev mode + // eslint-disable-next-line no-console + console.disableYellowBox = true; gutenbergSetup(); diff --git a/src/index.test.js b/src/index.test.js index 3947ff9d21..0ca3779032 100644 --- a/src/index.test.js +++ b/src/index.test.js @@ -21,7 +21,14 @@ describe( 'RootComponent', () => { beforeAll( initializeEditor ); it( 'renders without crashing', () => { + jest.useFakeTimers(); const app = renderer.create( ); + // Gutenberg store currently has some asynchronous parts in the store setup + // Need to run all ticks so `isReady` is true in the editor store + // See: https://github.com/wordpress-mobile/gutenberg-mobile/pull/1366#discussion_r326813061 + renderer.act( () => { + jest.runAllTicks(); + } ); const rendered = app.toJSON(); expect( rendered ).toBeTruthy(); app.unmount(); @@ -29,10 +36,10 @@ describe( 'RootComponent', () => { it( 'renders without crashing with a block focused', () => { const app = renderer.create( ); - const blocks = select( 'core/block-editor' ).getBlocks(); - - // Methods that modify state are required to be called inside `act` renderer.act( () => { + jest.runAllTicks(); + const blocks = select( 'core/block-editor' ).getBlocks(); + // Methods that modify state are required to be called inside `act` dispatch( 'core/block-editor' ).selectBlock( blocks[ 0 ].clientId ); } ); diff --git a/symlinked-packages/@wordpress/block-directory b/symlinked-packages/@wordpress/block-directory new file mode 120000 index 0000000000..980baf1f8c --- /dev/null +++ b/symlinked-packages/@wordpress/block-directory @@ -0,0 +1 @@ +../../gutenberg/packages/block-directory/src \ No newline at end of file