diff --git a/.circleci/config.yml b/.circleci/config.yml index 055d647451..5516bfbc1f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -20,6 +20,11 @@ commands: - run: name: Checkout Gutenberg command: git submodule update --init --recursive + add-jest-reporter-dir: + steps: + - run: + name: Create reports directory + command: mkdir reports && mkdir reports/test-results jobs: checks: @@ -39,6 +44,7 @@ jobs: - checkout - checkout-gutenberg - yarn-install + - add-jest-reporter-dir - run: name: Set Environment Variables command: | @@ -48,6 +54,10 @@ jobs: - run: name: Run Checks command: bin/ci-checks-js.sh + environment: + JEST_JUNIT_OUTPUT: "reports/test-results/android-test-results.xml" + - store_test_results: + path: ./reports/test-results android-device-checks: docker: - image: circleci/android:api-28-node8-alpha @@ -57,6 +67,7 @@ jobs: name: Checkout Gutenberg command: git submodule update --init --recursive - yarn-install + - add-jest-reporter-dir - run: name: Set Environment Variables command: | @@ -72,6 +83,10 @@ jobs: - run: name: Run Device Tests command: yarn device-tests + environment: + JEST_JUNIT_OUTPUT: "reports/test-results/android-test-results.xml" + - store_test_results: + path: ./reports/test-results ios-device-checks: macos: xcode: "10.2.0" @@ -79,6 +94,7 @@ jobs: - checkout - checkout-gutenberg - yarn-install + - add-jest-reporter-dir - run: name: Set Environment Variables command: | @@ -112,6 +128,10 @@ jobs: name: Run Device Tests command: | yarn device-tests + environment: + JEST_JUNIT_OUTPUT: "reports/test-results/ios-test-results.xml" + - store_test_results: + path: ./reports/test-results workflows: gutenberg-mobile: diff --git a/.gitignore b/.gitignore index 461dd95afc..3002525057 100644 --- a/.gitignore +++ b/.gitignore @@ -104,3 +104,6 @@ buck-out/ appium-out.log bin/wp-cli.phar + +# Report generated from jest-junit +/junit.xml diff --git a/__device-tests__/helpers/utils.js b/__device-tests__/helpers/utils.js index 08d777fa3e..190acb9505 100644 --- a/__device-tests__/helpers/utils.js +++ b/__device-tests__/helpers/utils.js @@ -8,6 +8,7 @@ */ import childProcess from 'child_process'; import wd from 'wd'; +import crypto from 'crypto'; /** * Internal dependencies @@ -108,6 +109,16 @@ const setupDriver = async () => { }; const stopDriver = async ( driver: wd.PromiseChainWebdriver ) => { + if ( ! isLocalEnvironment() ) { + const jobID = driver.sessionID; + + const hash = crypto.createHmac( 'md5', jobID ) + .update( serverConfigs.sauce.auth ) + .digest( 'hex' ); + const jobURL = `https://saucelabs.com/jobs/${ jobID }?auth=${ hash }.`; + // eslint-disable-next-line no-console + console.log( `You can view the video of this test run at ${ jobURL }` ); + } if ( driver === undefined ) { return; } diff --git a/jest.config.js b/jest.config.js index 5a78236e23..b89dcdcb51 100644 --- a/jest.config.js +++ b/jest.config.js @@ -58,4 +58,5 @@ module.exports = { snapshotSerializers: [ 'enzyme-to-json/serializer', ], + reporters: [ 'default', 'jest-junit' ], }; diff --git a/package.json b/package.json index 36d861cb3b..ee36759010 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "@wordpress/eslint-plugin": "^2.0.0", "@wordpress/jest-preset-default": "^4.0.0", "appium": "^1.12.1", + "jest-junit": "^6.3.0", "babel-core": "^7.0.0-bridge.0", "babel-eslint": "^8.2.2", "babel-jest": "^24.1.0", @@ -76,12 +77,13 @@ "wpandroid": "yarn android --root $TMPDIR/gbmobile-wpandroidfakernroot --variant wasabiDebug --appIdSuffix beta --appFolder WordPress --main-activity=ui.WPLaunchActivity", "preios": "yarn preios:xcode10 && yarn preios:carthage", "preios:carthage": "cd react-native-aztec && yarn install-aztec-ios", + "preios:carthage:update": "cd react-native-aztec && yarn update-aztec-ios", "preios:xcode10": "cd node_modules/react-native && ./scripts/ios-install-third-party.sh && cd third-party/glog-0.3.5 && [ -f libglog.pc ] || ../../scripts/ios-configure-glog.sh", "ios": "react-native run-ios", "test": "cross-env NODE_ENV=test jest --verbose --config jest.config.js", "test:inside-gb": "cross-env NODE_ENV=test jest --verbose --config jest_gb.config.js", "test:debug": "cross-env NODE_ENV=test node --inspect-brk jest --runInBand --verbose --config jest.config.js", - "device-tests": "cross-env NODE_ENV=test jest --detectOpenHandles --verbose --config jest_ui.config.js", + "device-tests": "cross-env NODE_ENV=test jest --runInBand --reporters=default --reporters=jest-junit --detectOpenHandles --verbose --config jest_ui.config.js", "test:e2e": "yarn test:e2e:android && yarn test:e2e:ios", "test:e2e:android": "TEST_RN_PLATFORM=android yarn device-tests", "test:e2e:ios": "TEST_RN_PLATFORM=ios yarn device-tests", @@ -157,4 +159,4 @@ "resolutions": { "@react-native-community/cli": "^1.5.2" } -} +} \ No newline at end of file diff --git a/react-native-aztec/ios/Cartfile b/react-native-aztec/ios/Cartfile index cd0fc90191..cd15d3c1cc 100644 --- a/react-native-aztec/ios/Cartfile +++ b/react-native-aztec/ios/Cartfile @@ -1 +1 @@ -github "wordpress-mobile/AztecEditor-iOS" ~> 1.6.0-beta.1 +github "wordpress-mobile/AztecEditor-iOS" "26164fb0f24027ecacc7105201e6e8a4332c7906" diff --git a/react-native-aztec/ios/Cartfile.resolved b/react-native-aztec/ios/Cartfile.resolved index b42bfbab66..cd15d3c1cc 100644 --- a/react-native-aztec/ios/Cartfile.resolved +++ b/react-native-aztec/ios/Cartfile.resolved @@ -1 +1 @@ -github "wordpress-mobile/AztecEditor-iOS" "1.6.0-beta.1" +github "wordpress-mobile/AztecEditor-iOS" "26164fb0f24027ecacc7105201e6e8a4332c7906" diff --git a/react-native-aztec/ios/RNTAztecView/RCTAztecView.swift b/react-native-aztec/ios/RNTAztecView/RCTAztecView.swift index 1f2df42698..6bd10bde1e 100644 --- a/react-native-aztec/ios/RNTAztecView/RCTAztecView.swift +++ b/react-native-aztec/ios/RNTAztecView/RCTAztecView.swift @@ -265,6 +265,10 @@ class RCTAztecView: Aztec.TextView { // MARK: - Custom Edit Intercepts private func interceptEnter(_ text: String) -> Bool { + if text == "\t" { + return true + } + guard text == "\n", let onEnter = onEnter else { return false @@ -285,7 +289,12 @@ class RCTAztecView: Aztec.TextView { onBackspace(caretData) return true } - + + override var keyCommands: [UIKeyCommand]? { + // Remove defautls Tab and Shift+Tab commands, leaving just Shift+Enter command. + return [carriageReturnKeyCommand] + } + // MARK: - Native-to-RN Value Packing Logic func packForRN(_ text: String, withName name: String) -> [AnyHashable: Any] { diff --git a/yarn.lock b/yarn.lock index be49a80f46..6cf2c8ec98 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1043,6 +1043,14 @@ "@types/istanbul-lib-coverage" "^1.1.0" "@types/yargs" "^12.0.9" +"@jest/types@^24.7.0": + version "24.7.0" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-24.7.0.tgz#c4ec8d1828cdf23234d9b4ee31f5482a3f04f48b" + integrity sha512-ipJUa2rFWiKoBqMKP63Myb6h9+iT3FHRTF2M8OR6irxWzItisa8i4dcSg14IbvmXUnBlHBlUQPYUHWyX3UPpYA== + dependencies: + "@types/istanbul-lib-coverage" "^2.0.0" + "@types/yargs" "^12.0.9" + "@jimp/bmp@^0.5.4": version "0.5.4" resolved "https://registry.yarnpkg.com/@jimp/bmp/-/bmp-0.5.4.tgz#b7b375aa774f26154912569864d5466e71333ef1" @@ -1650,6 +1658,11 @@ resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-1.1.0.tgz#2cc2ca41051498382b43157c8227fea60363f94a" integrity sha512-ohkhb9LehJy+PA40rDtGAji61NCgdtKLAlFoYp4cnuuQEswwdK3vz9SOIkkyc3wrk8dzjphQApNs56yyXLStaQ== +"@types/istanbul-lib-coverage@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.0.tgz#1eb8c033e98cf4e1a4cedcaf8bcafe8cb7591e85" + integrity sha512-eAtOAFZefEnfJiRFQBGw1eYqa5GTLCZ1y86N0XSI/D6EB+E8z6VPV/UL7Gi5UEclFqoQk+6NRqEDsfmDLXn8sg== + "@types/node@*": version "11.11.3" resolved "https://registry.yarnpkg.com/@types/node/-/node-11.11.3.tgz#7c6b0f8eaf16ae530795de2ad1b85d34bf2f5c58" @@ -6773,6 +6786,16 @@ jest-jasmine2@^24.5.0: pretty-format "^24.5.0" throat "^4.0.0" +jest-junit@^6.3.0: + version "6.3.0" + resolved "https://registry.yarnpkg.com/jest-junit/-/jest-junit-6.3.0.tgz#99e64ebc54eddcb21238f0cc49f5820c89a8c785" + integrity sha512-3PH9UkpaomX6CUzqjlnk0m4yBCW/eroxV6v61OM6LkCQFO848P3YUhfIzu8ypZSBKB3vvCbB4WaLTKT0BrIf8A== + dependencies: + jest-validate "^24.0.0" + mkdirp "^0.5.1" + strip-ansi "^4.0.0" + xml "^1.0.1" + jest-leak-detector@^24.5.0: version "24.5.0" resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-24.5.0.tgz#21ae2b3b0da252c1171cd494f75696d65fb6fa89" @@ -6959,6 +6982,18 @@ jest-validate@21.1.0: leven "^2.1.0" pretty-format "^21.1.0" +jest-validate@^24.0.0: + version "24.7.0" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-24.7.0.tgz#70007076f338528ee1b1c8a8258b1b0bb982508d" + integrity sha512-cgai/gts9B2chz1rqVdmLhzYxQbgQurh1PEQSvSgPZ8KGa1AqXsqC45W5wKEwzxKrWqypuQrQxnF4+G9VejJJA== + dependencies: + "@jest/types" "^24.7.0" + camelcase "^5.0.0" + chalk "^2.0.1" + jest-get-type "^24.3.0" + leven "^2.1.0" + pretty-format "^24.7.0" + jest-validate@^24.5.0: version "24.5.0" resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-24.5.0.tgz#62fd93d81214c070bb2d7a55f329a79d8057c7de" @@ -9590,6 +9625,16 @@ pretty-format@^24.5.0: ansi-styles "^3.2.0" react-is "^16.8.4" +pretty-format@^24.7.0: + version "24.7.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-24.7.0.tgz#d23106bc2edcd776079c2daa5da02bcb12ed0c10" + integrity sha512-apen5cjf/U4dj7tHetpC7UEFCvtAgnNZnBDkfPv3fokzIqyOJckAG9OlAPC1BlFALnqT/lGB2tl9EJjlK6eCsA== + dependencies: + "@jest/types" "^24.7.0" + ansi-regex "^4.0.0" + ansi-styles "^3.2.0" + react-is "^16.8.4" + private@^0.1.6, private@~0.1.5: version "0.1.8" resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff" @@ -12355,6 +12400,11 @@ xml2js@^0.4.17, xml2js@^0.4.5: sax ">=0.6.0" xmlbuilder "~9.0.1" +xml@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/xml/-/xml-1.0.1.tgz#78ba72020029c5bc87b8a81a3cfcd74b4a2fc1e5" + integrity sha1-eLpyAgApxbyHuKgaPPzXS0ovweU= + xmlbuilder@^9.0.1, xmlbuilder@^9.0.7, xmlbuilder@~9.0.1: version "9.0.7" resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-9.0.7.tgz#132ee63d2ec5565c557e20f4c22df9aca686b10d"