From 73bc4c988c91e64a0f619d54d6750cf587973a06 Mon Sep 17 00:00:00 2001 From: Tugdual de Kerviler Date: Fri, 1 May 2020 13:37:28 +0200 Subject: [PATCH 01/21] Try travis config for RN e2e tests --- .travis.yml | 91 +++++++++ .../react-native-editor/.circleci/config.yml | 177 ------------------ .../bin/sauce-pre-upload.sh | 8 +- 3 files changed, 95 insertions(+), 181 deletions(-) delete mode 100644 packages/react-native-editor/.circleci/config.yml diff --git a/.travis.yml b/.travis.yml index b39f8565c5683a..df3058cda29b74 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,6 +21,7 @@ branches: - rnmobile/master - /rnmobile\/release.*/ - /wp\/.*/ + - feat/import-gutenberg-mobile-no-squash env: global: @@ -95,6 +96,7 @@ install: jobs: include: + - name: Lint install: - npm ci @@ -209,5 +211,94 @@ jobs: - $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests - $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 4 == 3' < ~/.jest-e2e-tests ) + - name: E2E Mobile tests (Android) + os: linux + language: android + jdk: oraclejdk8 + sudo: required + before_cache: + - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock + - rm -fr $HOME/.gradle/caches/*/plugin-resolution/ + cache: + directories: + - $HOME/.gradle/caches/ + - $HOME/.gradle/wrapper/ + - $HOME/.android/build-cache + - /usr/local/android-sdk + env: + - TEST_RN_PLATFORM=android + - TEST_ENV=sauce + - JEST_JUNIT_OUTPUT="reports/test-results/android-test-results.xml" + - ANDROID_COMPILE_API=29 + - ANDROID_API=28 + - ANDROID_BUILD_TOOLS_VERSION=29.0.6 + - ANDROID_ABI=x86_64 + - ANDROID_EMU_FLAVOR=default # or google_apis + - ADB_INSTALL_TIMEOUT=8 + android: + components: + - tools + - platform-tools + - tools + - extra-android-m2repository + - extra-android-support + - build-tools-$ANDROID_BUILD_TOOLS_VERSION + - android-$ANDROID_API + - android-$COMPILE_API + before_install: + - echo 'count=0' > ~/.android/repositories.cfg + - yes | sdkmanager "tools" + - yes | sdkmanager "emulator" + - yes | sdkmanager "system-images;android-28;default;x86_64" + - yes | sdkmanager "system-images;android-$ANDROID_API;$ANDROID_EMU_FLAVOR;$ANDROID_ABI" + # Set up KVM on linux for hardware acceleration. Manually here so it only happens for emulator tests, takes ~30s + - sudo -E apt-get -yq --no-install-suggests --no-install-recommends install bridge-utils libpulse0 libvirt-bin libxcursor1 qemu-kvm virtinst ubuntu-vm-builder + - android list targets + - echo no | $ANDROID_HOME/tools/bin/avdmanager create avd --force -n Pixel_28 --package "system-images;android-$ANDROID_API;$ANDROID_EMU_FLAVOR;$ANDROID_ABI" -c 10M + - curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash + - nvm install + - echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p + install: + - npm ci + before_script: + - emulator -avd Pixel_28 -no-audio -verbose -no-snapshot -no-window -selinux permissive -qemu -m 2048 & + - android-wait-for-emulator + - adb shell input keyevent 82 & + script: + - npm run native test:e2e:android:local + + - name: E2E Mobile tests (iOS) + os: osx + language: objective-c + osx_image: xcode11.3 + env: + - TEST_RN_PLATFORM=ios + - TEST_ENV=sauce + before_install: + - curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash + - source ~/.nvm/nvm.sh + - nvm install + install: + - npm ci + script: + - npm run native test:e2e:ios:local + + - stage: deploy + if: (NOT type IN (pull_request)) AND (branch = master) + name: Deploy Playground + env: INSTALL_WORDPRESS=false + install: + - npm ci + before_deploy: + - npm run storybook:build + deploy: + provider: pages + skip_cleanup: true + github_token: $GITHUB_TOKEN + keep_history: true + local_dir: playground/dist + on: + branch: master + allow_failures: # nothing is allowed to fail at the moment diff --git a/packages/react-native-editor/.circleci/config.yml b/packages/react-native-editor/.circleci/config.yml deleted file mode 100644 index f4922088341a18..00000000000000 --- a/packages/react-native-editor/.circleci/config.yml +++ /dev/null @@ -1,177 +0,0 @@ -version: 2.1 - -commands: - yarn-install: - steps: - - restore_cache: - name: Restore Yarn Cache - keys: - - yarn-i18n-v4-cache-v{{ .Environment.CACHE_TRIGGER_VERSION }}-job-{{ .Environment.CIRCLE_JOB }}-{{ checksum "yarn.lock" }} - - run: - name: Yarn Install - command: yarn install --frozen-lockfile --prefer-offline --network-concurrency 1 - - save_cache: - name: Save Yarn Cache - key: yarn-i18n-v4-cache-v{{ .Environment.CACHE_TRIGGER_VERSION }}-job-{{ .Environment.CIRCLE_JOB }}-{{ checksum "yarn.lock" }} - paths: - - node_modules - - i18n-cache/data - checkout-gutenberg: - steps: - - 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: - parameters: - platform: - type: string - default: "" - check-tests: - type: boolean - default: false - check-correctness: - type: boolean - default: false - docker: - - image: circleci/node:10 - steps: - - checkout - - checkout-gutenberg - - yarn-install - - add-jest-reporter-dir - - run: - name: Set Environment Variables - command: | - echo 'export CHECK_CORRECTNESS=<>' >> $BASH_ENV - echo 'export CHECK_TESTS=<>' >> $BASH_ENV - echo 'export TEST_RN_PLATFORM=<>' >> $BASH_ENV - - 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-29-node - steps: - - checkout - - run: - name: Checkout Gutenberg - command: git submodule update --init --recursive - - yarn-install - - add-jest-reporter-dir - - run: - name: Set Environment Variables - command: | - echo 'export TEST_RN_PLATFORM=android' >> $BASH_ENV - echo 'export TEST_ENV=sauce' >> $BASH_ENV - - run: - name: Bundle Android and Generate debug .apk file for testing - command: yarn test:e2e:build-app:android - - run: - name: Upload apk to sauce labs - command: | - source bin/sauce-pre-upload.sh - curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" -X POST -H "Content-Type: application/octet-stream" https://saucelabs.com/rest/v1/storage/automattic/Gutenberg-$SAUCE_FILENAME.apk?overwrite=true --data-binary @./android/app/build/outputs/apk/debug/app-debug.apk - - 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: "11.2.1" - steps: - - checkout - - checkout-gutenberg - - yarn-install - - add-jest-reporter-dir - - run: - name: Set Environment Variables - command: | - echo 'export TEST_RN_PLATFORM=ios' >> $BASH_ENV - echo 'export TEST_ENV=sauce' >> $BASH_ENV - - run: - name: Prepare build cache key - command: find yarn.lock ios react-native-aztec/ios react-native-gutenberg-bridge/ios -type f -print0 | sort -z | xargs -0 shasum | tee ios-checksums.txt - - restore_cache: - name: Restore Build Cache - keys: - - ios-build-cache-{{ checksum "ios-checksums.txt" }} - - restore_cache: - name: Restore Dependencies Cache - keys: - - dependencies-v3-{{ checksum "ios/Gemfile.lock" }}-{{ checksum "ios/Podfile.lock" }}-{{ - checksum "yarn.lock" }} - - dependencies-v3-{{ checksum "ios/Gemfile.lock" }}-{{ checksum "ios/Podfile.lock" }} - - dependencies-v3-{{ checksum "ios/Gemfile.lock" }} - - dependencies-v3- - - run: - name: Build (if needed) - command: test -e ios/build/gutenberg/Build/Products/Release-iphonesimulator/GutenbergDemo.app || SKIP_BUNDLING=true yarn test:e2e:build-app:ios - - save_cache: - name: Save Dependencies Cache - key: dependencies-v3-{{ checksum "ios/Gemfile.lock" }}-{{ checksum "ios/Podfile.lock" }}-{{ - checksum "yarn.lock" }} - paths: - - ios/Pods - - ~/Library/Caches/CocoaPods - - ~/.cocoapods/repos/trunk - - ios/vendor - - run: - name: Bundle iOS - command: yarn test:e2e:bundle:ios - - run: - name: Generate .app file for testing - command: WORK_DIR=$(pwd) && cd ./ios/build/gutenberg/Build/Products/Release-iphonesimulator && zip -r $WORK_DIR/ios/GutenbergDemo.app.zip GutenbergDemo.app - - run: - name: Upload .app to sauce labs - command: | - source bin/sauce-pre-upload.sh - curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" -X POST -H "Content-Type: application/octet-stream" https://saucelabs.com/rest/v1/storage/automattic/Gutenberg-$SAUCE_FILENAME.app.zip?overwrite=true --data-binary @./ios/GutenbergDemo.app.zip - - run: - 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 - - run: - name: Prepare build cache - command: rm ios/build/gutenberg/Build/Products/Release-iphonesimulator/GutenbergDemo.app/main.jsbundle - - save_cache: - name: Save Build Cache - key: ios-build-cache-{{ checksum "ios-checksums.txt" }} - paths: - - ios/build/gutenberg/Build/Products/Release-iphonesimulator/GutenbergDemo.app - -workflows: - gutenberg-mobile: - jobs: - - checks: - name: Check Correctness - check-correctness: true - - checks: - name: Test iOS - platform: ios - check-tests: true - - checks: - name: Test Android - platform: android - check-tests: true - - ios-device-checks: - name: Test iOS on Device - - android-device-checks: - name: Test Android on Device diff --git a/packages/react-native-editor/bin/sauce-pre-upload.sh b/packages/react-native-editor/bin/sauce-pre-upload.sh index 234f013081f838..64dba88ec7e3f7 100755 --- a/packages/react-native-editor/bin/sauce-pre-upload.sh +++ b/packages/react-native-editor/bin/sauce-pre-upload.sh @@ -1,9 +1,9 @@ #!/bin/sh -# check if CIRCLE_BRANCH variable is set -if [[ -n "$CIRCLE_BRANCH" ]] ; then +# check if TRAVIS_PULL_REQUEST_BRANCH variable is set +if [[ -n "$TRAVIS_PULL_REQUEST_BRANCH" ]] ; then # replace / with - and assign to new var SAUCE_FILENAME - export SAUCE_FILENAME=${CIRCLE_BRANCH//[\/]/-}; + export SAUCE_FILENAME=${TRAVIS_PULL_REQUEST_BRANCH//[\/]/-}; else - echo "Expected CIRCLE_BRANCH env variable"; + echo "Expected TRAVIS_PULL_REQUEST_BRANCH env variable"; fi From 549f949089f2c00b4a2bbdf86bbd7c09cdf0d9dd Mon Sep 17 00:00:00 2001 From: Tugdual de Kerviler Date: Tue, 5 May 2020 11:51:40 +0200 Subject: [PATCH 02/21] fix --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index df3058cda29b74..08eec9424111ec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -253,7 +253,7 @@ jobs: - yes | sdkmanager "system-images;android-$ANDROID_API;$ANDROID_EMU_FLAVOR;$ANDROID_ABI" # Set up KVM on linux for hardware acceleration. Manually here so it only happens for emulator tests, takes ~30s - sudo -E apt-get -yq --no-install-suggests --no-install-recommends install bridge-utils libpulse0 libvirt-bin libxcursor1 qemu-kvm virtinst ubuntu-vm-builder - - android list targets + #- android list target - echo no | $ANDROID_HOME/tools/bin/avdmanager create avd --force -n Pixel_28 --package "system-images;android-$ANDROID_API;$ANDROID_EMU_FLAVOR;$ANDROID_ABI" -c 10M - curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash - nvm install From 6bd718ce8bb89888f50ce1653007c65d362d3e60 Mon Sep 17 00:00:00 2001 From: Ceyhun Ozugur Date: Tue, 5 May 2020 11:55:25 +0200 Subject: [PATCH 03/21] Create bundle folder for iOS before bundling for e2e --- packages/react-native-editor/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-native-editor/package.json b/packages/react-native-editor/package.json index 63d3fff13fcd47..fcf56db3f546e3 100644 --- a/packages/react-native-editor/package.json +++ b/packages/react-native-editor/package.json @@ -115,7 +115,7 @@ "test:e2e:bundle:android": "mkdir -p android/app/src/main/assets && react-native bundle --reset-cache --platform android --dev false --minify false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res", "test:e2e:build-app:android": "npm run test:e2e:bundle:android && cd android && ./gradlew clean && ./gradlew assembleDebug", "test:e2e:install-app:android": "cd android && ./gradlew installDebug", - "test:e2e:bundle:ios": "react-native bundle --reset-cache --platform=ios --dev=false --minify false --entry-file=index.js --bundle-output=./ios/build/gutenberg/Build/Products/Release-iphonesimulator/GutenbergDemo.app/main.jsbundle --assets-dest=./ios/build/gutenberg/Build/Products/Release-iphonesimulator/GutenbergDemo.app", + "test:e2e:bundle:ios": "mkdir -p ios/build/gutenberg/Build/Products/Release-iphonesimulator/GutenbergDemo.app && react-native bundle --reset-cache --platform=ios --dev=false --minify false --entry-file=index.js --bundle-output=./ios/build/gutenberg/Build/Products/Release-iphonesimulator/GutenbergDemo.app/main.jsbundle --assets-dest=./ios/build/gutenberg/Build/Products/Release-iphonesimulator/GutenbergDemo.app", "test:e2e:build-app:ios": "npm run test:e2e:bundle:ios && npm run ios -- --configuration Release --no-packager", "build:gutenberg": "cd gutenberg && npm install && npm run build", "clean": "npm run clean:build-artifacts; npm run clean:aztec; npm run cache clean; npm run clean:haste; npm run clean:jest; npm run clean:metro; npm run clean:react; npm run clean:watchman; npm run clean:node; npm run clean:pot", From c3e8ea1c10fe5e46d4f37d2e58be409f3d8a8cbc Mon Sep 17 00:00:00 2001 From: Ceyhun Ozugur Date: Tue, 5 May 2020 12:08:04 +0200 Subject: [PATCH 04/21] Trigger CI --- .travis.yml | 284 +--------------------------------------------------- 1 file changed, 1 insertion(+), 283 deletions(-) diff --git a/.travis.yml b/.travis.yml index 08eec9424111ec..a7c07418049b86 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,279 +1,17 @@ language: generic -services: - - docker - -notifications: - email: - on_success: never - on_failure: change - -cache: - directories: - - $HOME/.composer/cache - - $HOME/.jest-cache - - $HOME/.npm - - $HOME/.nvm/.cache - branches: only: - - master - - rnmobile/master - - /rnmobile\/release.*/ - - /wp\/.*/ - - feat/import-gutenberg-mobile-no-squash - -env: - global: - - WP_DEVELOP_DIR: ./wordpress - - LOCAL_SCRIPT_DEBUG: false - - INSTALL_WORDPRESS: true - -# Make sure NodeGit gets the correct C libs. -addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - libstdc++-4.9-dev - -before_install: - - nvm install --latest-npm - - | - if [[ "$INSTALL_WORDPRESS" = "true" ]]; then - # Upgrade docker-compose. - sudo rm /usr/local/bin/docker-compose - curl -sL https://github.com/docker/compose/releases/download/1.24.0/docker-compose-`uname -s`-`uname -m` > docker-compose - chmod +x docker-compose - sudo mv docker-compose /usr/local/bin - fi - -install: - # Build Gutenberg. - - npm ci - - npm run build - - | - if [[ "$INSTALL_WORDPRESS" = "true" ]]; then - # Download and unpack WordPress. - curl -sL https://github.com/WordPress/WordPress/archive/master.zip -o /tmp/wordpress-latest.zip - unzip -q /tmp/wordpress-latest.zip -d /tmp - mkdir -p wordpress/src - mv /tmp/WordPress-master/* wordpress/src - - # Create the upload directory with permissions that Travis can handle. - mkdir -p wordpress/src/wp-content/uploads - chmod 767 wordpress/src/wp-content/uploads - - # Grab the tools we need for WordPress' local-env. - curl -sL https://github.com/WordPress/wordpress-develop/archive/master.zip -o /tmp/wordpress-develop.zip - unzip -q /tmp/wordpress-develop.zip -d /tmp - mv \ - /tmp/wordpress-develop-master/tools \ - /tmp/wordpress-develop-master/tests \ - /tmp/wordpress-develop-master/.env \ - /tmp/wordpress-develop-master/docker-compose.yml \ - /tmp/wordpress-develop-master/wp-cli.yml \ - /tmp/wordpress-develop-master/*config-sample.php \ - /tmp/wordpress-develop-master/package.json wordpress - - # Install WordPress. The additional dependencies are required by the copied `wordpress-develop` tools. - cd wordpress - npm install dotenv wait-on - npm run env:start - sleep 10 - npm run env:install - cd .. - - # Connect Gutenberg to WordPress. - npm run env connect - npm run env cli plugin activate gutenberg - fi - - | - if [[ "$E2E_ROLE" = "author" ]]; then - npm run env cli -- user create author author@example.com --role=author --user_pass=authpass - npm run env cli -- post update 1 --post_author=2 - fi + - feat/import-gutenberg-mobile-no-squash-E2E-TESTS-fix-ios-ci jobs: include: - - - name: Lint - install: - - npm ci - script: - - npm run lint - - - name: Lint ES5 only - install: - - npm ci - - npm run build - script: - - npx eslint --parser-options=ecmaVersion:5 --no-eslintrc --no-ignore ./build/**/*.js - - - name: Typecheck - install: - - npm ci - script: - - npm run build:package-types - - - - name: Build artifacts - install: - # A "full" install is executed, since `npm ci` does not always exit - # with an error status code if the lock file is inaccurate. - # - # See: https://github.com/WordPress/gutenberg/issues/16157 - - npm install - script: - - npm run check-local-changes - - - name: License compatibility - install: - - npm ci - script: - - npm run check-licenses - - - name: JavaScript unit tests - env: INSTALL_WORDPRESS=false - install: - - npm ci - # It's not necessary to run the full build, since Jest can interpret - # source files with `babel-jest`. Some packages have their own custom - # build tasks, however. These must be run. - - npx lerna run build - script: - - npm run test-unit -- --ci --maxWorkers=2 --cacheDirectory="$HOME/.jest-cache" - - - name: JavaScript native mobile tests - install: - - npm ci - # It's not necessary to run the full build, since Jest can interpret - # source files with `babel-jest`. Some packages have their own custom - # build tasks, however. These must be run. - - npx lerna run build - script: - - npm run test-unit:native -- --ci --maxWorkers=2 --cacheDirectory="$HOME/.jest-cache" - - - name: PHP unit tests - script: - - npm run test-php && npm run test-unit-php-multisite - - - name: PHP unit tests (PHP 5.6) - env: LOCAL_PHP=5.6-fpm - script: - - npm run test-php && npm run test-unit-php-multisite - - - name: E2E tests (Admin) (1/4) - env: FORCE_REDUCED_MOTION=true - script: - - $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests - - $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 4 == 0' < ~/.jest-e2e-tests ) - - - name: E2E tests (Admin) (2/4) - env: FORCE_REDUCED_MOTION=true - script: - - $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests - - $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 4 == 1' < ~/.jest-e2e-tests ) - - - name: E2E tests (Admin) (3/4) - env: FORCE_REDUCED_MOTION=true - script: - - $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests - - $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 4 == 2' < ~/.jest-e2e-tests ) - - - name: E2E tests (Admin) (4/4) - env: FORCE_REDUCED_MOTION=true - script: - - $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests - - $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 4 == 3' < ~/.jest-e2e-tests ) - - - name: E2E tests (Author) (1/4) - env: E2E_ROLE=author FORCE_REDUCED_MOTION=true - script: - - $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests - - $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 4 == 0' < ~/.jest-e2e-tests ) - - - name: E2E tests (Author) (2/4) - env: E2E_ROLE=author FORCE_REDUCED_MOTION=true - script: - - $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests - - $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 4 == 1' < ~/.jest-e2e-tests ) - - - name: E2E tests (Author) (3/4) - env: E2E_ROLE=author FORCE_REDUCED_MOTION=true - script: - - $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests - - $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 4 == 2' < ~/.jest-e2e-tests ) - - - name: E2E tests (Author) (4/4) - env: E2E_ROLE=author FORCE_REDUCED_MOTION=true - script: - - $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests - - $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 4 == 3' < ~/.jest-e2e-tests ) - - - name: E2E Mobile tests (Android) - os: linux - language: android - jdk: oraclejdk8 - sudo: required - before_cache: - - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock - - rm -fr $HOME/.gradle/caches/*/plugin-resolution/ - cache: - directories: - - $HOME/.gradle/caches/ - - $HOME/.gradle/wrapper/ - - $HOME/.android/build-cache - - /usr/local/android-sdk - env: - - TEST_RN_PLATFORM=android - - TEST_ENV=sauce - - JEST_JUNIT_OUTPUT="reports/test-results/android-test-results.xml" - - ANDROID_COMPILE_API=29 - - ANDROID_API=28 - - ANDROID_BUILD_TOOLS_VERSION=29.0.6 - - ANDROID_ABI=x86_64 - - ANDROID_EMU_FLAVOR=default # or google_apis - - ADB_INSTALL_TIMEOUT=8 - android: - components: - - tools - - platform-tools - - tools - - extra-android-m2repository - - extra-android-support - - build-tools-$ANDROID_BUILD_TOOLS_VERSION - - android-$ANDROID_API - - android-$COMPILE_API - before_install: - - echo 'count=0' > ~/.android/repositories.cfg - - yes | sdkmanager "tools" - - yes | sdkmanager "emulator" - - yes | sdkmanager "system-images;android-28;default;x86_64" - - yes | sdkmanager "system-images;android-$ANDROID_API;$ANDROID_EMU_FLAVOR;$ANDROID_ABI" - # Set up KVM on linux for hardware acceleration. Manually here so it only happens for emulator tests, takes ~30s - - sudo -E apt-get -yq --no-install-suggests --no-install-recommends install bridge-utils libpulse0 libvirt-bin libxcursor1 qemu-kvm virtinst ubuntu-vm-builder - #- android list target - - echo no | $ANDROID_HOME/tools/bin/avdmanager create avd --force -n Pixel_28 --package "system-images;android-$ANDROID_API;$ANDROID_EMU_FLAVOR;$ANDROID_ABI" -c 10M - - curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash - - nvm install - - echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p - install: - - npm ci - before_script: - - emulator -avd Pixel_28 -no-audio -verbose -no-snapshot -no-window -selinux permissive -qemu -m 2048 & - - android-wait-for-emulator - - adb shell input keyevent 82 & - script: - - npm run native test:e2e:android:local - - name: E2E Mobile tests (iOS) os: osx language: objective-c osx_image: xcode11.3 env: - TEST_RN_PLATFORM=ios - - TEST_ENV=sauce before_install: - curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash - source ~/.nvm/nvm.sh @@ -282,23 +20,3 @@ jobs: - npm ci script: - npm run native test:e2e:ios:local - - - stage: deploy - if: (NOT type IN (pull_request)) AND (branch = master) - name: Deploy Playground - env: INSTALL_WORDPRESS=false - install: - - npm ci - before_deploy: - - npm run storybook:build - deploy: - provider: pages - skip_cleanup: true - github_token: $GITHUB_TOKEN - keep_history: true - local_dir: playground/dist - on: - branch: master - - allow_failures: - # nothing is allowed to fail at the moment From e8b3c1e7ee4ff2be7a03533640dbf867af5b64c9 Mon Sep 17 00:00:00 2001 From: Ceyhun Ozugur Date: Tue, 5 May 2020 13:01:13 +0200 Subject: [PATCH 05/21] Fix wrong simulator pick on Travis for e2e tests --- packages/react-native-editor/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-native-editor/package.json b/packages/react-native-editor/package.json index fcf56db3f546e3..8a482e103996b4 100644 --- a/packages/react-native-editor/package.json +++ b/packages/react-native-editor/package.json @@ -116,7 +116,7 @@ "test:e2e:build-app:android": "npm run test:e2e:bundle:android && cd android && ./gradlew clean && ./gradlew assembleDebug", "test:e2e:install-app:android": "cd android && ./gradlew installDebug", "test:e2e:bundle:ios": "mkdir -p ios/build/gutenberg/Build/Products/Release-iphonesimulator/GutenbergDemo.app && react-native bundle --reset-cache --platform=ios --dev=false --minify false --entry-file=index.js --bundle-output=./ios/build/gutenberg/Build/Products/Release-iphonesimulator/GutenbergDemo.app/main.jsbundle --assets-dest=./ios/build/gutenberg/Build/Products/Release-iphonesimulator/GutenbergDemo.app", - "test:e2e:build-app:ios": "npm run test:e2e:bundle:ios && npm run ios -- --configuration Release --no-packager", + "test:e2e:build-app:ios": "npm run test:e2e:bundle:ios && npm run ios -- --configuration Release --no-packager --simulator 'iPhone 11 (13.4)'", "build:gutenberg": "cd gutenberg && npm install && npm run build", "clean": "npm run clean:build-artifacts; npm run clean:aztec; npm run cache clean; npm run clean:haste; npm run clean:jest; npm run clean:metro; npm run clean:react; npm run clean:watchman; npm run clean:node; npm run clean:pot", "clean:runtime": "npm run clean:haste; npm run clean:react; npm run clean:metro; npm run clean:jest; npm run clean:watchman; npm run clean:babel-cache", From 9d10c53798df776e8bc6f1297500a0533dba89ce Mon Sep 17 00:00:00 2001 From: Ceyhun Ozugur Date: Tue, 5 May 2020 13:24:47 +0200 Subject: [PATCH 06/21] Change iOS simulator version used for e2e test to 13.3 --- packages/react-native-editor/__device-tests__/helpers/caps.js | 2 +- packages/react-native-editor/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-native-editor/__device-tests__/helpers/caps.js b/packages/react-native-editor/__device-tests__/helpers/caps.js index d9b32b936b7517..ea0c7559675678 100644 --- a/packages/react-native-editor/__device-tests__/helpers/caps.js +++ b/packages/react-native-editor/__device-tests__/helpers/caps.js @@ -15,7 +15,7 @@ const ios = { exports.iosLocal = { ...ios, - platformVersion: '13.4', + platformVersion: '13.3', deviceName: 'iPhone 11', }; diff --git a/packages/react-native-editor/package.json b/packages/react-native-editor/package.json index 8a482e103996b4..69fadce90fab20 100644 --- a/packages/react-native-editor/package.json +++ b/packages/react-native-editor/package.json @@ -116,7 +116,7 @@ "test:e2e:build-app:android": "npm run test:e2e:bundle:android && cd android && ./gradlew clean && ./gradlew assembleDebug", "test:e2e:install-app:android": "cd android && ./gradlew installDebug", "test:e2e:bundle:ios": "mkdir -p ios/build/gutenberg/Build/Products/Release-iphonesimulator/GutenbergDemo.app && react-native bundle --reset-cache --platform=ios --dev=false --minify false --entry-file=index.js --bundle-output=./ios/build/gutenberg/Build/Products/Release-iphonesimulator/GutenbergDemo.app/main.jsbundle --assets-dest=./ios/build/gutenberg/Build/Products/Release-iphonesimulator/GutenbergDemo.app", - "test:e2e:build-app:ios": "npm run test:e2e:bundle:ios && npm run ios -- --configuration Release --no-packager --simulator 'iPhone 11 (13.4)'", + "test:e2e:build-app:ios": "npm run test:e2e:bundle:ios && npm run ios -- --configuration Release --no-packager --simulator 'iPhone 11 (13.3)'", "build:gutenberg": "cd gutenberg && npm install && npm run build", "clean": "npm run clean:build-artifacts; npm run clean:aztec; npm run cache clean; npm run clean:haste; npm run clean:jest; npm run clean:metro; npm run clean:react; npm run clean:watchman; npm run clean:node; npm run clean:pot", "clean:runtime": "npm run clean:haste; npm run clean:react; npm run clean:metro; npm run clean:jest; npm run clean:watchman; npm run clean:babel-cache", From 94a1e41b0a82020bd577e95a1ca260dcd693951e Mon Sep 17 00:00:00 2001 From: Ceyhun Ozugur Date: Tue, 12 May 2020 18:02:14 +0200 Subject: [PATCH 07/21] Try GitHub actions --- .github/workflows/rnmobile-android-runner.yml | 31 +++ .github/workflows/rnmobile-ios-runner.yml | 64 ++++++ .travis.yml | 215 +++++++++++++++++- package-lock.json | 18 +- .../gutenberg-editor-block-insertion.test.js | 4 + .../__device-tests__/helpers/caps.js | 4 +- .../__device-tests__/helpers/utils.js | 87 +++++++ .../__device-tests__/pages/editor-page.js | 2 +- packages/react-native-editor/ios/Podfile.lock | 6 +- packages/react-native-editor/package.json | 2 +- 10 files changed, 405 insertions(+), 28 deletions(-) create mode 100644 .github/workflows/rnmobile-android-runner.yml create mode 100644 .github/workflows/rnmobile-ios-runner.yml diff --git a/.github/workflows/rnmobile-android-runner.yml b/.github/workflows/rnmobile-android-runner.yml new file mode 100644 index 00000000000000..f79428e752ea3b --- /dev/null +++ b/.github/workflows/rnmobile-android-runner.yml @@ -0,0 +1,31 @@ +on: push + +jobs: + test: + runs-on: macos-latest + + steps: + - name: checkout + uses: actions/checkout@v2 + + - name: Restore npm cache + uses: actions/cache@master + with: + path: ~/.npm + key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }} + restore-keys: | + ${{ runner.os }}-npm- + + - uses: reactivecircus/android-emulator-runner@v2 + with: + api-level: 28 + profile: pixel_xl + script: | + npm ci + npm run native test:e2e:android:local + + - uses: actions/upload-artifact@v2 + if: always() + with: + name: android-screen-recordings + path: packages/react-native-editor/android-screen-recordings diff --git a/.github/workflows/rnmobile-ios-runner.yml b/.github/workflows/rnmobile-ios-runner.yml new file mode 100644 index 00000000000000..8d24a631c3918f --- /dev/null +++ b/.github/workflows/rnmobile-ios-runner.yml @@ -0,0 +1,64 @@ +on: push + +jobs: + test: + runs-on: macos-latest + + steps: + - uses: actions/checkout@v2 + + - name: Restore npm cache + uses: actions/cache@master + with: + path: ~/.npm + key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }} + restore-keys: | + ${{ runner.os }}-npm- + + - name: Install dependencies + run: | + source ~/.nvm/nvm.sh + nvm install + npm ci + + - name: Prepare build cache key + run: find package-lock.json packages/react-native-editor/ios packages/react-native-aztec/ios packages/react-native-bridge/ios -type f -print0 | sort -z | xargs -0 shasum | tee ios-checksums.txt + + - name: Restore build cache + uses: actions/cache@v1 + with: + path: packages/react-native-editor/ios/build/gutenberg/Build/Products/Release-iphonesimulator/GutenbergDemo.app + key: ${{ runner.os }}-ios-build-${{ hashFiles('ios-checksums.txt') }} + + - name: Restore pods cache + uses: actions/cache@master + with: + path: | + packages/react-native-editor/ios/Pods + ~/Library/Caches/CocoaPods + ~/.cocoapods/repos/trunk + packages/react-native-editor/ios/vendor + key: ${{ runner.os }}-pods-${{ hashFiles('packages/react-native-editor/ios/Gemfile.lock') }}-${{ hashFiles('packages/react-native-editor/ios/Podfile.lock') }}-${{ hashFiles('package-lock.json') }} + restore-keys: | + ${{ runner.os }}-pods-${{ hashFiles('packages/react-native-editor/ios/Gemfile.lock') }}-${{ hashFiles('packages/react-native-editor/ios/Podfile.lock') }}-${{ hashFiles('package-lock.json') }} + ${{ runner.os }}-pods-${{ hashFiles('packages/react-native-editor/ios/Gemfile.lock') }}-${{ hashFiles('packages/react-native-editor/ios/Podfile.lock') }}- + ${{ runner.os }}-pods-${{ hashFiles('packages/react-native-editor/ios/Gemfile.lock') }}- + ${{ runner.os }}-pods- + + - name: Bundle iOS + run: npm run native test:e2e:bundle:ios + + - name: Build (if needed) + run: test -e packages/react-native-editor/ios/build/gutenberg/Build/Products/Release-iphonesimulator/GutenbergDemo.app/GutenbergDemo || SKIP_BUNDLING=true npm run native test:e2e:build-app:ios + + - name: Run iOS Device Tests + run: TEST_RN_PLATFORM=ios npm run native device-tests:local + + - name: Prepare build cache + run: rm packages/react-native-editor/ios/build/gutenberg/Build/Products/Release-iphonesimulator/GutenbergDemo.app/main.jsbundle + + - uses: actions/upload-artifact@v2 + if: always() + with: + name: ios-screen-recordings + path: packages/react-native-editor/ios-screen-recordings diff --git a/.travis.yml b/.travis.yml index a7c07418049b86..b39f8565c5683a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,22 +1,213 @@ language: generic +services: + - docker + +notifications: + email: + on_success: never + on_failure: change + +cache: + directories: + - $HOME/.composer/cache + - $HOME/.jest-cache + - $HOME/.npm + - $HOME/.nvm/.cache + branches: only: - - feat/import-gutenberg-mobile-no-squash-E2E-TESTS-fix-ios-ci + - master + - rnmobile/master + - /rnmobile\/release.*/ + - /wp\/.*/ + +env: + global: + - WP_DEVELOP_DIR: ./wordpress + - LOCAL_SCRIPT_DEBUG: false + - INSTALL_WORDPRESS: true + +# Make sure NodeGit gets the correct C libs. +addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - libstdc++-4.9-dev + +before_install: + - nvm install --latest-npm + - | + if [[ "$INSTALL_WORDPRESS" = "true" ]]; then + # Upgrade docker-compose. + sudo rm /usr/local/bin/docker-compose + curl -sL https://github.com/docker/compose/releases/download/1.24.0/docker-compose-`uname -s`-`uname -m` > docker-compose + chmod +x docker-compose + sudo mv docker-compose /usr/local/bin + fi + +install: + # Build Gutenberg. + - npm ci + - npm run build + - | + if [[ "$INSTALL_WORDPRESS" = "true" ]]; then + # Download and unpack WordPress. + curl -sL https://github.com/WordPress/WordPress/archive/master.zip -o /tmp/wordpress-latest.zip + unzip -q /tmp/wordpress-latest.zip -d /tmp + mkdir -p wordpress/src + mv /tmp/WordPress-master/* wordpress/src + + # Create the upload directory with permissions that Travis can handle. + mkdir -p wordpress/src/wp-content/uploads + chmod 767 wordpress/src/wp-content/uploads + + # Grab the tools we need for WordPress' local-env. + curl -sL https://github.com/WordPress/wordpress-develop/archive/master.zip -o /tmp/wordpress-develop.zip + unzip -q /tmp/wordpress-develop.zip -d /tmp + mv \ + /tmp/wordpress-develop-master/tools \ + /tmp/wordpress-develop-master/tests \ + /tmp/wordpress-develop-master/.env \ + /tmp/wordpress-develop-master/docker-compose.yml \ + /tmp/wordpress-develop-master/wp-cli.yml \ + /tmp/wordpress-develop-master/*config-sample.php \ + /tmp/wordpress-develop-master/package.json wordpress + + # Install WordPress. The additional dependencies are required by the copied `wordpress-develop` tools. + cd wordpress + npm install dotenv wait-on + npm run env:start + sleep 10 + npm run env:install + cd .. + + # Connect Gutenberg to WordPress. + npm run env connect + npm run env cli plugin activate gutenberg + fi + - | + if [[ "$E2E_ROLE" = "author" ]]; then + npm run env cli -- user create author author@example.com --role=author --user_pass=authpass + npm run env cli -- post update 1 --post_author=2 + fi jobs: include: - - name: E2E Mobile tests (iOS) - os: osx - language: objective-c - osx_image: xcode11.3 - env: - - TEST_RN_PLATFORM=ios - before_install: - - curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash - - source ~/.nvm/nvm.sh - - nvm install + - name: Lint + install: + - npm ci + script: + - npm run lint + + - name: Lint ES5 only + install: + - npm ci + - npm run build + script: + - npx eslint --parser-options=ecmaVersion:5 --no-eslintrc --no-ignore ./build/**/*.js + + - name: Typecheck + install: + - npm ci + script: + - npm run build:package-types + + + - name: Build artifacts + install: + # A "full" install is executed, since `npm ci` does not always exit + # with an error status code if the lock file is inaccurate. + # + # See: https://github.com/WordPress/gutenberg/issues/16157 + - npm install + script: + - npm run check-local-changes + + - name: License compatibility + install: + - npm ci + script: + - npm run check-licenses + + - name: JavaScript unit tests + env: INSTALL_WORDPRESS=false + install: + - npm ci + # It's not necessary to run the full build, since Jest can interpret + # source files with `babel-jest`. Some packages have their own custom + # build tasks, however. These must be run. + - npx lerna run build + script: + - npm run test-unit -- --ci --maxWorkers=2 --cacheDirectory="$HOME/.jest-cache" + + - name: JavaScript native mobile tests install: - npm ci + # It's not necessary to run the full build, since Jest can interpret + # source files with `babel-jest`. Some packages have their own custom + # build tasks, however. These must be run. + - npx lerna run build + script: + - npm run test-unit:native -- --ci --maxWorkers=2 --cacheDirectory="$HOME/.jest-cache" + + - name: PHP unit tests + script: + - npm run test-php && npm run test-unit-php-multisite + + - name: PHP unit tests (PHP 5.6) + env: LOCAL_PHP=5.6-fpm + script: + - npm run test-php && npm run test-unit-php-multisite + + - name: E2E tests (Admin) (1/4) + env: FORCE_REDUCED_MOTION=true + script: + - $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests + - $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 4 == 0' < ~/.jest-e2e-tests ) + + - name: E2E tests (Admin) (2/4) + env: FORCE_REDUCED_MOTION=true + script: + - $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests + - $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 4 == 1' < ~/.jest-e2e-tests ) + + - name: E2E tests (Admin) (3/4) + env: FORCE_REDUCED_MOTION=true + script: + - $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests + - $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 4 == 2' < ~/.jest-e2e-tests ) + + - name: E2E tests (Admin) (4/4) + env: FORCE_REDUCED_MOTION=true + script: + - $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests + - $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 4 == 3' < ~/.jest-e2e-tests ) + + - name: E2E tests (Author) (1/4) + env: E2E_ROLE=author FORCE_REDUCED_MOTION=true script: - - npm run native test:e2e:ios:local + - $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests + - $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 4 == 0' < ~/.jest-e2e-tests ) + + - name: E2E tests (Author) (2/4) + env: E2E_ROLE=author FORCE_REDUCED_MOTION=true + script: + - $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests + - $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 4 == 1' < ~/.jest-e2e-tests ) + + - name: E2E tests (Author) (3/4) + env: E2E_ROLE=author FORCE_REDUCED_MOTION=true + script: + - $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests + - $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 4 == 2' < ~/.jest-e2e-tests ) + + - name: E2E tests (Author) (4/4) + env: E2E_ROLE=author FORCE_REDUCED_MOTION=true + script: + - $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests + - $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 4 == 3' < ~/.jest-e2e-tests ) + + allow_failures: + # nothing is allowed to fail at the moment diff --git a/package-lock.json b/package-lock.json index 967b7929cc9e1d..270d09cb35d482 100644 --- a/package-lock.json +++ b/package-lock.json @@ -37250,9 +37250,9 @@ } }, "mkdirp-classic": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.2.tgz", - "integrity": "sha512-ejdnDQcR75gwknmMw/tx02AuRs8jCtqFoFqDZMjiNxsu85sRIJVXDKHuLYvUUPRBUtV2FpSZa9bL1BUa3BdR2g==" + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", + "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==" }, "mkdirp-promise": { "version": "5.0.1", @@ -41564,9 +41564,9 @@ } }, "tar-fs": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.0.1.tgz", - "integrity": "sha512-6tzWDMeroL87uF/+lin46k+Q+46rAJ0SyPGz7OW7wTgblI273hsBqk2C1j0/xNadNLKDTUL9BukSjB7cwgmlPA==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.0.tgz", + "integrity": "sha512-9uW5iDvrIMCVpvasdFHW0wJPez0K4JnMZtsuIeDI7HyMGJNxmDZDOCQROr7lXyS+iL/QMpj07qcjGYTSdRFXUg==", "dev": true, "requires": { "chownr": "^1.1.1", @@ -41589,9 +41589,9 @@ } }, "ws": { - "version": "7.2.5", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.2.5.tgz", - "integrity": "sha512-C34cIU4+DB2vMyAbmEKossWq2ZQDr6QEyuuCzWrM9zfw1sGc0mYiJ0UnG9zzNykt49C2Fi34hvr2vssFQRS6EA==", + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.3.0.tgz", + "integrity": "sha512-iFtXzngZVXPGgpTlP1rBqsUK82p9tKqsWRPg5L56egiljujJT3vGAYnHANvFxBieXrTFavhzhxW52jnaWV+w2w==", "dev": true }, "yauzl": { diff --git a/packages/react-native-editor/__device-tests__/gutenberg-editor-block-insertion.test.js b/packages/react-native-editor/__device-tests__/gutenberg-editor-block-insertion.test.js index cb1fa3cd4a5584..1095200dcf2555 100644 --- a/packages/react-native-editor/__device-tests__/gutenberg-editor-block-insertion.test.js +++ b/packages/react-native-editor/__device-tests__/gutenberg-editor-block-insertion.test.js @@ -60,6 +60,10 @@ describe( 'Gutenberg Editor tests for Block insertion', () => { await paragraphBlockElement.click(); await editorPage.addNewParagraphBlock(); + + // wait for accessibility ids to update + await driver.sleep( 1000 ); + paragraphBlockElement = await editorPage.getParagraphBlockAtPosition( 3 ); diff --git a/packages/react-native-editor/__device-tests__/helpers/caps.js b/packages/react-native-editor/__device-tests__/helpers/caps.js index ea0c7559675678..3355bf7d27b103 100644 --- a/packages/react-native-editor/__device-tests__/helpers/caps.js +++ b/packages/react-native-editor/__device-tests__/helpers/caps.js @@ -1,7 +1,7 @@ const ios = { browserName: '', platformName: 'iOS', - platformVersion: '13.3', + platformVersion: '13.4', deviceName: 'iPhone 11', os: 'iOS', deviceOrientation: 'portrait', @@ -15,7 +15,7 @@ const ios = { exports.iosLocal = { ...ios, - platformVersion: '13.3', + platformVersion: '13.4', deviceName: 'iPhone 11', }; diff --git a/packages/react-native-editor/__device-tests__/helpers/utils.js b/packages/react-native-editor/__device-tests__/helpers/utils.js index 2b55b11d9187b0..8fae1ac2aa6c30 100644 --- a/packages/react-native-editor/__device-tests__/helpers/utils.js +++ b/packages/react-native-editor/__device-tests__/helpers/utils.js @@ -5,6 +5,7 @@ import childProcess from 'child_process'; import wd from 'wd'; import crypto from 'crypto'; import path from 'path'; +import fs from 'fs'; /** * Internal dependencies @@ -35,6 +36,8 @@ const localIOSAppPath = process.env.IOS_APP_PATH || defaultIOSAppPath; const localAppiumPort = serverConfigs.local.port; // Port to spawn appium process for local runs let appiumProcess; +let iOSScreenRecordingProcess; +let androidScreenRecordingProcess; // Used to map unicode and special values to keycodes on Android // Docs for keycode values: https://developer.android.com/reference/android/view/KeyEvent.html @@ -53,6 +56,90 @@ const isLocalEnvironment = () => { return testEnvironment.toLowerCase() === 'local'; }; +const IOS_RECORDINGS_DIR = './ios-screen-recordings'; +const ANDROID_RECORDINGS_DIR = './android-screen-recordings'; + +const getScreenRecordingFileNameBase = ( testPath, id ) => { + const suiteName = path.basename( testPath, '.test.js' ); + return `${ suiteName }.${ id }`; +}; + +jasmine.getEnv().addReporter( { + specStarted: ( { testPath, id } ) => { + const fileName = + getScreenRecordingFileNameBase( testPath, id ) + '.mp4'; + + if ( isAndroid() ) { + if ( ! fs.existsSync( ANDROID_RECORDINGS_DIR ) ) { + fs.mkdirSync( ANDROID_RECORDINGS_DIR ); + } + + androidScreenRecordingProcess = childProcess.spawn( 'adb', [ + 'shell', + 'screenrecord', + '--verbose', + '--bit-rate', + '1M', + '--size', + '1440x2560', + `/sdcard/${ fileName }`, + ] ); + + return; + } + + if ( ! fs.existsSync( IOS_RECORDINGS_DIR ) ) { + fs.mkdirSync( IOS_RECORDINGS_DIR ); + } + + iOSScreenRecordingProcess = childProcess.spawn( + 'xcrun', + [ + 'simctl', + 'io', + 'booted', + 'recordVideo', + '--mask=black', + '--force', + fileName, + ], + { + cwd: IOS_RECORDINGS_DIR, + } + ); + }, + specDone: ( { testPath, id, status } ) => { + const fileNameBase = getScreenRecordingFileNameBase( testPath, id ); + + if ( isAndroid() ) { + androidScreenRecordingProcess.kill( 'SIGINT' ); + // wait for kill + childProcess.execSync( 'sleep 20' ); + + childProcess.execSync( + `adb pull /sdcard/${ fileNameBase }.mp4 ${ ANDROID_RECORDINGS_DIR }` + ); + + const oldPath = `${ ANDROID_RECORDINGS_DIR }/${ fileNameBase }.mp4`; + const newPath = `${ ANDROID_RECORDINGS_DIR }/${ fileNameBase }.${ status }.mp4`; + + if ( fs.existsSync( oldPath ) ) { + fs.renameSync( oldPath, newPath ); + } + return; + } + + iOSScreenRecordingProcess.kill( 'SIGINT' ); + + const oldPath = `${ IOS_RECORDINGS_DIR }/${ fileNameBase }.mp4`; + const newPath = `${ IOS_RECORDINGS_DIR }/${ fileNameBase }.${ status }.mp4`; + + if ( fs.existsSync( oldPath ) ) { + fs.renameSync( oldPath, newPath ); + } + }, +} ); + // Initialises the driver and desired capabilities for appium const setupDriver = async () => { const branch = process.env.CIRCLE_BRANCH || ''; diff --git a/packages/react-native-editor/__device-tests__/pages/editor-page.js b/packages/react-native-editor/__device-tests__/pages/editor-page.js index 8136367310bf81..36e25865c39e4a 100644 --- a/packages/react-native-editor/__device-tests__/pages/editor-page.js +++ b/packages/react-native-editor/__device-tests__/pages/editor-page.js @@ -345,7 +345,7 @@ export default class EditorPage { block ); await typeString( this.driver, textViewElement, text, clear ); - await this.driver.sleep( 1000 ); // Give time for the block to rerender (such as for accessibility) + await this.driver.sleep( 3000 ); // Give time for the block to rerender (such as for accessibility) } async sendTextToParagraphBlockAtPosition( position, text, clear ) { diff --git a/packages/react-native-editor/ios/Podfile.lock b/packages/react-native-editor/ios/Podfile.lock index 5e7e8312bbf3d7..af1f0446fd1b64 100644 --- a/packages/react-native-editor/ios/Podfile.lock +++ b/packages/react-native-editor/ios/Podfile.lock @@ -266,7 +266,7 @@ DEPENDENCIES: - React-jsi (from `../../../node_modules/react-native/ReactCommon/jsi`) - React-jsiexecutor (from `../../../node_modules/react-native/ReactCommon/jsiexecutor`) - React-jsinspector (from `../../../node_modules/react-native/ReactCommon/jsinspector`) - - react-native-get-random-values (from `../node_modules/react-native-get-random-values`) + - react-native-get-random-values (from `../../../node_modules/react-native-get-random-values`) - react-native-keyboard-aware-scroll-view (from `../../../node_modules/react-native-keyboard-aware-scroll-view`) - react-native-safe-area (from `../../../node_modules/react-native-safe-area`) - "react-native-slider (from `../../../node_modules/@react-native-community/slider`)" @@ -326,7 +326,7 @@ EXTERNAL SOURCES: React-jsinspector: :path: "../../../node_modules/react-native/ReactCommon/jsinspector" react-native-get-random-values: - :path: "../node_modules/react-native-get-random-values" + :path: "../../../node_modules/react-native-get-random-values" react-native-keyboard-aware-scroll-view: :path: "../../../node_modules/react-native-keyboard-aware-scroll-view" react-native-safe-area: @@ -386,7 +386,7 @@ SPEC CHECKSUMS: react-native-keyboard-aware-scroll-view: ffa9152671fec9a571197ed2d02e0fcb90206e60 react-native-safe-area: e8230b0017d76c00de6b01e2412dcf86b127c6a3 react-native-slider: f81b89fa0c1f9a65742d33f889a194ca6653a985 - react-native-video: a1aeeb872d4408ff2f1a2a780a49ff44bdeb9172 + react-native-video: 331eaf96cb034fedcc27f4f6ada3ac3cf6c0a78a React-RCTActionSheet: 600b4d10e3aea0913b5a92256d2719c0cdd26d76 React-RCTAnimation: 791a87558389c80908ed06cc5dfc5e7920dfa360 React-RCTBlob: d89293cc0236d9cb0933d85e430b0bbe81ad1d72 diff --git a/packages/react-native-editor/package.json b/packages/react-native-editor/package.json index 69fadce90fab20..858006681e3466 100644 --- a/packages/react-native-editor/package.json +++ b/packages/react-native-editor/package.json @@ -116,7 +116,7 @@ "test:e2e:build-app:android": "npm run test:e2e:bundle:android && cd android && ./gradlew clean && ./gradlew assembleDebug", "test:e2e:install-app:android": "cd android && ./gradlew installDebug", "test:e2e:bundle:ios": "mkdir -p ios/build/gutenberg/Build/Products/Release-iphonesimulator/GutenbergDemo.app && react-native bundle --reset-cache --platform=ios --dev=false --minify false --entry-file=index.js --bundle-output=./ios/build/gutenberg/Build/Products/Release-iphonesimulator/GutenbergDemo.app/main.jsbundle --assets-dest=./ios/build/gutenberg/Build/Products/Release-iphonesimulator/GutenbergDemo.app", - "test:e2e:build-app:ios": "npm run test:e2e:bundle:ios && npm run ios -- --configuration Release --no-packager --simulator 'iPhone 11 (13.3)'", + "test:e2e:build-app:ios": "npm run ios -- --configuration Release --no-packager --simulator 'iPhone 11 (13.4)'", "build:gutenberg": "cd gutenberg && npm install && npm run build", "clean": "npm run clean:build-artifacts; npm run clean:aztec; npm run cache clean; npm run clean:haste; npm run clean:jest; npm run clean:metro; npm run clean:react; npm run clean:watchman; npm run clean:node; npm run clean:pot", "clean:runtime": "npm run clean:haste; npm run clean:react; npm run clean:metro; npm run clean:jest; npm run clean:watchman; npm run clean:babel-cache", From da06141a85f71177f683d1ff879c781e0125bd0c Mon Sep 17 00:00:00 2001 From: Ceyhun Ozugur Date: Tue, 12 May 2020 20:12:08 +0200 Subject: [PATCH 08/21] Increase timeout --- .../react-native-editor/__device-tests__/pages/editor-page.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-native-editor/__device-tests__/pages/editor-page.js b/packages/react-native-editor/__device-tests__/pages/editor-page.js index 36e25865c39e4a..4b3bc317dac728 100644 --- a/packages/react-native-editor/__device-tests__/pages/editor-page.js +++ b/packages/react-native-editor/__device-tests__/pages/editor-page.js @@ -32,7 +32,7 @@ export default class EditorPage { this.accessibilityIdKey = 'contentDescription'; } - driver.setImplicitWaitTimeout( 5000 ); + driver.setImplicitWaitTimeout( 10000 ); } async getBlockList() { From ffa949ca0475b1df4266825b42e603efad716ed3 Mon Sep 17 00:00:00 2001 From: Ceyhun Ozugur Date: Tue, 12 May 2020 20:12:31 +0200 Subject: [PATCH 09/21] Decrease recording resolution --- packages/react-native-editor/__device-tests__/helpers/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-native-editor/__device-tests__/helpers/utils.js b/packages/react-native-editor/__device-tests__/helpers/utils.js index 8fae1ac2aa6c30..0fea61655b3bb6 100644 --- a/packages/react-native-editor/__device-tests__/helpers/utils.js +++ b/packages/react-native-editor/__device-tests__/helpers/utils.js @@ -81,7 +81,7 @@ jasmine.getEnv().addReporter( { '--bit-rate', '1M', '--size', - '1440x2560', + '720x1280', `/sdcard/${ fileName }`, ] ); From 905fdf524bc5fe555d0041b5df6c9505685a450c Mon Sep 17 00:00:00 2001 From: Ceyhun Ozugur Date: Wed, 13 May 2020 10:32:44 +0200 Subject: [PATCH 10/21] Add names to react native action workflows --- .github/workflows/rnmobile-android-runner.yml | 1 + .github/workflows/rnmobile-ios-runner.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/rnmobile-android-runner.yml b/.github/workflows/rnmobile-android-runner.yml index f79428e752ea3b..d3451e030cb39e 100644 --- a/.github/workflows/rnmobile-android-runner.yml +++ b/.github/workflows/rnmobile-android-runner.yml @@ -1,3 +1,4 @@ +name: Android React Native E2E Tests on: push jobs: diff --git a/.github/workflows/rnmobile-ios-runner.yml b/.github/workflows/rnmobile-ios-runner.yml index 8d24a631c3918f..179d5d9836e687 100644 --- a/.github/workflows/rnmobile-ios-runner.yml +++ b/.github/workflows/rnmobile-ios-runner.yml @@ -1,3 +1,4 @@ +name: iOS React Native E2E Tests on: push jobs: From a092f92ae66d3067abddb1b218b1a1b83b2231f7 Mon Sep 17 00:00:00 2001 From: Ceyhun Ozugur Date: Wed, 13 May 2020 10:41:32 +0200 Subject: [PATCH 11/21] Rename react native action workflows --- .github/workflows/rnmobile-android-runner.yml | 2 +- .github/workflows/rnmobile-ios-runner.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rnmobile-android-runner.yml b/.github/workflows/rnmobile-android-runner.yml index d3451e030cb39e..0a6f725b1723a6 100644 --- a/.github/workflows/rnmobile-android-runner.yml +++ b/.github/workflows/rnmobile-android-runner.yml @@ -1,4 +1,4 @@ -name: Android React Native E2E Tests +name: React Native E2E Tests (Android) on: push jobs: diff --git a/.github/workflows/rnmobile-ios-runner.yml b/.github/workflows/rnmobile-ios-runner.yml index 179d5d9836e687..d7d3b5612d888d 100644 --- a/.github/workflows/rnmobile-ios-runner.yml +++ b/.github/workflows/rnmobile-ios-runner.yml @@ -1,4 +1,4 @@ -name: iOS React Native E2E Tests +name: React Native E2E Tests (iOS) on: push jobs: From 7fb121e5e315c819765836dec709cee960a71388 Mon Sep 17 00:00:00 2001 From: Ceyhun Ozugur Date: Wed, 13 May 2020 12:46:15 +0200 Subject: [PATCH 12/21] Prevent accidental touches to home button on iOS while scrolling --- .../react-native-editor/__device-tests__/pages/editor-page.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-native-editor/__device-tests__/pages/editor-page.js b/packages/react-native-editor/__device-tests__/pages/editor-page.js index 4b3bc317dac728..8865272ec32332 100644 --- a/packages/react-native-editor/__device-tests__/pages/editor-page.js +++ b/packages/react-native-editor/__device-tests__/pages/editor-page.js @@ -212,14 +212,14 @@ export default class EditorPage { blockName ); const size = await this.driver.getWindowSize(); - const height = size.height - 5; + const height = size.height - 100; while ( ! ( await blockButton.isDisplayed() ) ) { await this.driver.execute( 'mobile: dragFromToForDuration', { fromX: 50, fromY: height, toX: 50, - toY: height - 450, + toY: height - 50, duration: 0.5, } ); } From 08c90a9f638359de24e53afad788eb096f71d52b Mon Sep 17 00:00:00 2001 From: Ceyhun Ozugur Date: Wed, 13 May 2020 16:51:58 +0200 Subject: [PATCH 13/21] Add gradle cache --- .github/workflows/rnmobile-android-runner.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rnmobile-android-runner.yml b/.github/workflows/rnmobile-android-runner.yml index 0a6f725b1723a6..aaf81d3760d2e0 100644 --- a/.github/workflows/rnmobile-android-runner.yml +++ b/.github/workflows/rnmobile-android-runner.yml @@ -17,13 +17,20 @@ jobs: restore-keys: | ${{ runner.os }}-npm- + - run: npm ci + + - name: Restore Gradle cache + uses: actions/cache@v1 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} + restore-keys: ${{ runner.os }}-gradle + - uses: reactivecircus/android-emulator-runner@v2 with: api-level: 28 profile: pixel_xl - script: | - npm ci - npm run native test:e2e:android:local + script: npm run native test:e2e:android:local - uses: actions/upload-artifact@v2 if: always() From eef9ede3506a5a20d8abe90d357796c588c18fb5 Mon Sep 17 00:00:00 2001 From: Ceyhun Ozugur Date: Thu, 14 May 2020 12:42:48 +0200 Subject: [PATCH 14/21] Run only subset of tests and in parallel --- .github/workflows/rnmobile-android-runner.yml | 8 +++++++- .github/workflows/rnmobile-ios-runner.yml | 10 ++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rnmobile-android-runner.yml b/.github/workflows/rnmobile-android-runner.yml index aaf81d3760d2e0..0b348f73d8ed86 100644 --- a/.github/workflows/rnmobile-android-runner.yml +++ b/.github/workflows/rnmobile-android-runner.yml @@ -4,6 +4,12 @@ on: push jobs: test: runs-on: macos-latest + strategy: + matrix: + native-test-name: [ + gutenberg-editor-heading, + gutenberg-editor-image, + ] steps: - name: checkout @@ -30,7 +36,7 @@ jobs: with: api-level: 28 profile: pixel_xl - script: npm run native test:e2e:android:local + script: npm run native test:e2e:android:local ${{ matrix.native-test-name }} - uses: actions/upload-artifact@v2 if: always() diff --git a/.github/workflows/rnmobile-ios-runner.yml b/.github/workflows/rnmobile-ios-runner.yml index d7d3b5612d888d..48aa55e5d27629 100644 --- a/.github/workflows/rnmobile-ios-runner.yml +++ b/.github/workflows/rnmobile-ios-runner.yml @@ -4,7 +4,13 @@ on: push jobs: test: runs-on: macos-latest - + strategy: + matrix: + native-test-name: [ + gutenberg-editor-heading, + gutenberg-editor-image, + ] + steps: - uses: actions/checkout@v2 @@ -53,7 +59,7 @@ jobs: run: test -e packages/react-native-editor/ios/build/gutenberg/Build/Products/Release-iphonesimulator/GutenbergDemo.app/GutenbergDemo || SKIP_BUNDLING=true npm run native test:e2e:build-app:ios - name: Run iOS Device Tests - run: TEST_RN_PLATFORM=ios npm run native device-tests:local + run: TEST_RN_PLATFORM=ios npm run native device-tests:local ${{ matrix.native-test-name }} - name: Prepare build cache run: rm packages/react-native-editor/ios/build/gutenberg/Build/Products/Release-iphonesimulator/GutenbergDemo.app/main.jsbundle From 1313dd064a3f0f55008f9d23575f7f3c63865ba3 Mon Sep 17 00:00:00 2001 From: Tugdual de Kerviler Date: Thu, 14 May 2020 15:35:31 +0200 Subject: [PATCH 15/21] Revert any changes to package-lock.json --- package-lock.json | 234 +++++++++++++++++----------------------------- 1 file changed, 87 insertions(+), 147 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0a2e044b2914a3..3077e98a4e305c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14445,26 +14445,24 @@ }, "dependencies": { "appium-support": { - "version": "2.47.1", - "resolved": "https://registry.npmjs.org/appium-support/-/appium-support-2.47.1.tgz", - "integrity": "sha512-c0zR9y7KH1kLpwkmf2EESaT0kkpcHpo+QDYZoQbqbjI8NLip9JDOffLMvYuLRAMEQoUcWQcLmJOVE+RI52N5MA==", + "version": "2.43.0", + "resolved": "https://registry.npmjs.org/appium-support/-/appium-support-2.43.0.tgz", + "integrity": "sha512-HELlIM6J0CI/ALHKbr8Z8TNjrnyw1QVdzLKCUX/l4Gw/MmaS4QvHNpuy3Bdd0MCxX/aw76q2F58HmCiwzHtAkg==", "dev": true, "requires": { "@babel/runtime": "^7.0.0", - "archiver": "^4.0.1", - "axios": "^0.19.2", + "archiver": "^3.1.1", "base64-stream": "^1.0.0", "bluebird": "^3.5.1", "bplist-creator": "^0", "bplist-parser": "^0.2", "extract-zip": "^1.6.0", - "form-data": "^3.0.0", "glob": "^7.1.2", - "jimp": "^0.10.0", + "jimp": "^0.9.0", "jsftp": "^2.1.2", "klaw": "^3.0.0", - "lockfile": "^1.0.4", "lodash": "^4.2.1", + "md5-file": "^4.0.0", "mjpeg-server": "^0.3.0", "mkdirp": "^1.0.0", "moment": "^2.24.0", @@ -14473,31 +14471,33 @@ "npmlog": "^4.1.2", "plist": "^3.0.1", "pluralize": "^8.0.0", - "pngjs": "^5.0.0", + "pngjs": "^3.0.0", + "request": "^2.83.0", + "request-promise": "^4.2.2", "rimraf": "^3.0.0", "sanitize-filename": "^1.6.1", "semver": "^7.0.0", "shell-quote": "^1.7.2", "source-map-support": "^0.5.5", "teen_process": "^1.5.1", - "uuid": "^8.0.0", + "uuid": "^7.0.2", "which": "^2.0.0", "yauzl": "^2.7.0" } }, "archiver": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/archiver/-/archiver-4.0.1.tgz", - "integrity": "sha512-/YV1pU4Nhpf/rJArM23W6GTUjT0l++VbjykrCRua1TSXrn+yM8Qs7XvtwSiRse0iCe49EPNf7ktXnPsWuSb91Q==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/archiver/-/archiver-3.1.1.tgz", + "integrity": "sha512-5Hxxcig7gw5Jod/8Gq0OneVgLYET+oNHcxgWItq4TbhOzRLKNAFUb9edAftiMKXvXfCB0vbGrJdZDNq0dWMsxg==", "dev": true, "requires": { "archiver-utils": "^2.1.0", "async": "^2.6.3", "buffer-crc32": "^0.2.1", - "glob": "^7.1.6", - "readable-stream": "^3.6.0", - "tar-stream": "^2.1.2", - "zip-stream": "^3.0.1" + "glob": "^7.1.4", + "readable-stream": "^3.4.0", + "tar-stream": "^2.1.0", + "zip-stream": "^2.1.2" } }, "archiver-utils": { @@ -14547,15 +14547,15 @@ } }, "compress-commons": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-3.0.0.tgz", - "integrity": "sha512-FyDqr8TKX5/X0qo+aVfaZ+PVmNJHJeckFBlq8jZGSJOgnynhfifoyl24qaqdUdDIBe0EVTHByN6NAkqYvE/2Xg==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-2.1.1.tgz", + "integrity": "sha512-eVw6n7CnEMFzc3duyFVrQEuY1BlHR3rYsSztyG32ibGMW722i3C6IizEGMFmfMU+A+fALvBIwxN3czffTcdA+Q==", "dev": true, "requires": { "buffer-crc32": "^0.2.13", "crc32-stream": "^3.0.1", "normalize-path": "^3.0.0", - "readable-stream": "^2.3.7" + "readable-stream": "^2.3.6" }, "dependencies": { "readable-stream": { @@ -14585,17 +14585,6 @@ "readable-stream": "^3.4.0" } }, - "form-data": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.0.tgz", - "integrity": "sha512-CKMFDglpbMi6PyN+brwB9Q/GOw0eAnsrEZDgcsH5Krhz5Od/haKHAX0NmQfha2zPPz0JpWzA7GJHGSnvCRLWsg==", - "dev": true, - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - } - }, "normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -14627,20 +14616,20 @@ } }, "uuid": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.0.0.tgz", - "integrity": "sha512-jOXGuXZAWdsTH7eZLtyXMqUb9EcWMGZNbL9YcGBJl4MH4nrxHmZJhEHvyLFrkxo+28uLb/NYRcStH48fnD0Vzw==", + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-7.0.3.tgz", + "integrity": "sha512-DPSke0pXhTZgoF/d+WSt2QaKMCFSfx7QegxEWT+JOuHF5aWrKEn0G+ztjuJg/gG8/ItK+rbPCD/yNv8yyih6Cg==", "dev": true }, "zip-stream": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-3.0.1.tgz", - "integrity": "sha512-r+JdDipt93ttDjsOVPU5zaq5bAyY+3H19bDrThkvuVxC0xMQzU1PJcS6D+KrP3u96gH9XLomcHPb+2skoDjulQ==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-2.1.3.tgz", + "integrity": "sha512-EkXc2JGcKhO5N5aZ7TmuNo45budRaFGHOmz24wtJR7znbNqDPmdZtUauKX6et8KAVseAMBOyWJqEpXcHTBsh7Q==", "dev": true, "requires": { "archiver-utils": "^2.1.0", - "compress-commons": "^3.0.0", - "readable-stream": "^3.6.0" + "compress-commons": "^2.1.1", + "readable-stream": "^3.4.0" } } } @@ -14834,26 +14823,24 @@ }, "dependencies": { "appium-support": { - "version": "2.47.1", - "resolved": "https://registry.npmjs.org/appium-support/-/appium-support-2.47.1.tgz", - "integrity": "sha512-c0zR9y7KH1kLpwkmf2EESaT0kkpcHpo+QDYZoQbqbjI8NLip9JDOffLMvYuLRAMEQoUcWQcLmJOVE+RI52N5MA==", + "version": "2.43.0", + "resolved": "https://registry.npmjs.org/appium-support/-/appium-support-2.43.0.tgz", + "integrity": "sha512-HELlIM6J0CI/ALHKbr8Z8TNjrnyw1QVdzLKCUX/l4Gw/MmaS4QvHNpuy3Bdd0MCxX/aw76q2F58HmCiwzHtAkg==", "dev": true, "requires": { "@babel/runtime": "^7.0.0", - "archiver": "^4.0.1", - "axios": "^0.19.2", + "archiver": "^3.1.1", "base64-stream": "^1.0.0", "bluebird": "^3.5.1", "bplist-creator": "^0", "bplist-parser": "^0.2", "extract-zip": "^1.6.0", - "form-data": "^3.0.0", "glob": "^7.1.2", - "jimp": "^0.10.0", + "jimp": "^0.9.0", "jsftp": "^2.1.2", "klaw": "^3.0.0", - "lockfile": "^1.0.4", "lodash": "^4.2.1", + "md5-file": "^4.0.0", "mjpeg-server": "^0.3.0", "mkdirp": "^1.0.0", "moment": "^2.24.0", @@ -14862,31 +14849,33 @@ "npmlog": "^4.1.2", "plist": "^3.0.1", "pluralize": "^8.0.0", - "pngjs": "^5.0.0", + "pngjs": "^3.0.0", + "request": "^2.83.0", + "request-promise": "^4.2.2", "rimraf": "^3.0.0", "sanitize-filename": "^1.6.1", "semver": "^7.0.0", "shell-quote": "^1.7.2", "source-map-support": "^0.5.5", "teen_process": "^1.5.1", - "uuid": "^8.0.0", + "uuid": "^7.0.2", "which": "^2.0.0", "yauzl": "^2.7.0" } }, "archiver": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/archiver/-/archiver-4.0.1.tgz", - "integrity": "sha512-/YV1pU4Nhpf/rJArM23W6GTUjT0l++VbjykrCRua1TSXrn+yM8Qs7XvtwSiRse0iCe49EPNf7ktXnPsWuSb91Q==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/archiver/-/archiver-3.1.1.tgz", + "integrity": "sha512-5Hxxcig7gw5Jod/8Gq0OneVgLYET+oNHcxgWItq4TbhOzRLKNAFUb9edAftiMKXvXfCB0vbGrJdZDNq0dWMsxg==", "dev": true, "requires": { "archiver-utils": "^2.1.0", "async": "^2.6.3", "buffer-crc32": "^0.2.1", - "glob": "^7.1.6", - "readable-stream": "^3.6.0", - "tar-stream": "^2.1.2", - "zip-stream": "^3.0.1" + "glob": "^7.1.4", + "readable-stream": "^3.4.0", + "tar-stream": "^2.1.0", + "zip-stream": "^2.1.2" } }, "archiver-utils": { @@ -14936,15 +14925,15 @@ } }, "compress-commons": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-3.0.0.tgz", - "integrity": "sha512-FyDqr8TKX5/X0qo+aVfaZ+PVmNJHJeckFBlq8jZGSJOgnynhfifoyl24qaqdUdDIBe0EVTHByN6NAkqYvE/2Xg==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-2.1.1.tgz", + "integrity": "sha512-eVw6n7CnEMFzc3duyFVrQEuY1BlHR3rYsSztyG32ibGMW722i3C6IizEGMFmfMU+A+fALvBIwxN3czffTcdA+Q==", "dev": true, "requires": { "buffer-crc32": "^0.2.13", "crc32-stream": "^3.0.1", "normalize-path": "^3.0.0", - "readable-stream": "^2.3.7" + "readable-stream": "^2.3.6" }, "dependencies": { "readable-stream": { @@ -14974,17 +14963,6 @@ "readable-stream": "^3.4.0" } }, - "form-data": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.0.tgz", - "integrity": "sha512-CKMFDglpbMi6PyN+brwB9Q/GOw0eAnsrEZDgcsH5Krhz5Od/haKHAX0NmQfha2zPPz0JpWzA7GJHGSnvCRLWsg==", - "dev": true, - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - } - }, "normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -15016,20 +14994,20 @@ } }, "uuid": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.0.0.tgz", - "integrity": "sha512-jOXGuXZAWdsTH7eZLtyXMqUb9EcWMGZNbL9YcGBJl4MH4nrxHmZJhEHvyLFrkxo+28uLb/NYRcStH48fnD0Vzw==", + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-7.0.3.tgz", + "integrity": "sha512-DPSke0pXhTZgoF/d+WSt2QaKMCFSfx7QegxEWT+JOuHF5aWrKEn0G+ztjuJg/gG8/ItK+rbPCD/yNv8yyih6Cg==", "dev": true }, "zip-stream": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-3.0.1.tgz", - "integrity": "sha512-r+JdDipt93ttDjsOVPU5zaq5bAyY+3H19bDrThkvuVxC0xMQzU1PJcS6D+KrP3u96gH9XLomcHPb+2skoDjulQ==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-2.1.3.tgz", + "integrity": "sha512-EkXc2JGcKhO5N5aZ7TmuNo45budRaFGHOmz24wtJR7znbNqDPmdZtUauKX6et8KAVseAMBOyWJqEpXcHTBsh7Q==", "dev": true, "requires": { "archiver-utils": "^2.1.0", - "compress-commons": "^3.0.0", - "readable-stream": "^3.6.0" + "compress-commons": "^2.1.1", + "readable-stream": "^3.4.0" } } } @@ -15908,26 +15886,24 @@ }, "dependencies": { "appium-support": { - "version": "2.47.1", - "resolved": "https://registry.npmjs.org/appium-support/-/appium-support-2.47.1.tgz", - "integrity": "sha512-c0zR9y7KH1kLpwkmf2EESaT0kkpcHpo+QDYZoQbqbjI8NLip9JDOffLMvYuLRAMEQoUcWQcLmJOVE+RI52N5MA==", + "version": "2.43.0", + "resolved": "https://registry.npmjs.org/appium-support/-/appium-support-2.43.0.tgz", + "integrity": "sha512-HELlIM6J0CI/ALHKbr8Z8TNjrnyw1QVdzLKCUX/l4Gw/MmaS4QvHNpuy3Bdd0MCxX/aw76q2F58HmCiwzHtAkg==", "dev": true, "requires": { "@babel/runtime": "^7.0.0", - "archiver": "^4.0.1", - "axios": "^0.19.2", + "archiver": "^3.1.1", "base64-stream": "^1.0.0", "bluebird": "^3.5.1", "bplist-creator": "^0", "bplist-parser": "^0.2", "extract-zip": "^1.6.0", - "form-data": "^3.0.0", "glob": "^7.1.2", - "jimp": "^0.10.0", + "jimp": "^0.9.0", "jsftp": "^2.1.2", "klaw": "^3.0.0", - "lockfile": "^1.0.4", "lodash": "^4.2.1", + "md5-file": "^4.0.0", "mjpeg-server": "^0.3.0", "mkdirp": "^1.0.0", "moment": "^2.24.0", @@ -15936,31 +15912,33 @@ "npmlog": "^4.1.2", "plist": "^3.0.1", "pluralize": "^8.0.0", - "pngjs": "^5.0.0", + "pngjs": "^3.0.0", + "request": "^2.83.0", + "request-promise": "^4.2.2", "rimraf": "^3.0.0", "sanitize-filename": "^1.6.1", "semver": "^7.0.0", "shell-quote": "^1.7.2", "source-map-support": "^0.5.5", "teen_process": "^1.5.1", - "uuid": "^8.0.0", + "uuid": "^7.0.2", "which": "^2.0.0", "yauzl": "^2.7.0" } }, "archiver": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/archiver/-/archiver-4.0.1.tgz", - "integrity": "sha512-/YV1pU4Nhpf/rJArM23W6GTUjT0l++VbjykrCRua1TSXrn+yM8Qs7XvtwSiRse0iCe49EPNf7ktXnPsWuSb91Q==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/archiver/-/archiver-3.1.1.tgz", + "integrity": "sha512-5Hxxcig7gw5Jod/8Gq0OneVgLYET+oNHcxgWItq4TbhOzRLKNAFUb9edAftiMKXvXfCB0vbGrJdZDNq0dWMsxg==", "dev": true, "requires": { "archiver-utils": "^2.1.0", "async": "^2.6.3", "buffer-crc32": "^0.2.1", - "glob": "^7.1.6", - "readable-stream": "^3.6.0", - "tar-stream": "^2.1.2", - "zip-stream": "^3.0.1" + "glob": "^7.1.4", + "readable-stream": "^3.4.0", + "tar-stream": "^2.1.0", + "zip-stream": "^2.1.2" } }, "archiver-utils": { @@ -16010,15 +15988,15 @@ } }, "compress-commons": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-3.0.0.tgz", - "integrity": "sha512-FyDqr8TKX5/X0qo+aVfaZ+PVmNJHJeckFBlq8jZGSJOgnynhfifoyl24qaqdUdDIBe0EVTHByN6NAkqYvE/2Xg==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-2.1.1.tgz", + "integrity": "sha512-eVw6n7CnEMFzc3duyFVrQEuY1BlHR3rYsSztyG32ibGMW722i3C6IizEGMFmfMU+A+fALvBIwxN3czffTcdA+Q==", "dev": true, "requires": { "buffer-crc32": "^0.2.13", "crc32-stream": "^3.0.1", "normalize-path": "^3.0.0", - "readable-stream": "^2.3.7" + "readable-stream": "^2.3.6" }, "dependencies": { "readable-stream": { @@ -16048,17 +16026,6 @@ "readable-stream": "^3.4.0" } }, - "form-data": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.0.tgz", - "integrity": "sha512-CKMFDglpbMi6PyN+brwB9Q/GOw0eAnsrEZDgcsH5Krhz5Od/haKHAX0NmQfha2zPPz0JpWzA7GJHGSnvCRLWsg==", - "dev": true, - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - } - }, "normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -16090,9 +16057,9 @@ } }, "uuid": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.0.0.tgz", - "integrity": "sha512-jOXGuXZAWdsTH7eZLtyXMqUb9EcWMGZNbL9YcGBJl4MH4nrxHmZJhEHvyLFrkxo+28uLb/NYRcStH48fnD0Vzw==", + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-7.0.3.tgz", + "integrity": "sha512-DPSke0pXhTZgoF/d+WSt2QaKMCFSfx7QegxEWT+JOuHF5aWrKEn0G+ztjuJg/gG8/ItK+rbPCD/yNv8yyih6Cg==", "dev": true }, "xmldom": { @@ -16102,14 +16069,14 @@ "dev": true }, "zip-stream": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-3.0.1.tgz", - "integrity": "sha512-r+JdDipt93ttDjsOVPU5zaq5bAyY+3H19bDrThkvuVxC0xMQzU1PJcS6D+KrP3u96gH9XLomcHPb+2skoDjulQ==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-2.1.3.tgz", + "integrity": "sha512-EkXc2JGcKhO5N5aZ7TmuNo45budRaFGHOmz24wtJR7znbNqDPmdZtUauKX6et8KAVseAMBOyWJqEpXcHTBsh7Q==", "dev": true, "requires": { "archiver-utils": "^2.1.0", - "compress-commons": "^3.0.0", - "readable-stream": "^3.6.0" + "compress-commons": "^2.1.1", + "readable-stream": "^3.4.0" } } } @@ -21089,15 +21056,6 @@ "axe-core": "^3.5.3" } }, - "axios": { - "version": "0.19.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz", - "integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==", - "dev": true, - "requires": { - "follow-redirects": "1.5.10" - } - }, "axobject-query": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-2.0.2.tgz", @@ -29587,15 +29545,6 @@ "integrity": "sha512-Dx69IXGCq1qsUExWuG+5wkiMqVM/zGx/reXSJSLogECwp3x6KeNQZ+NAetgxEFpnC41rD8U3+jRCW68+LNzdtw==", "dev": true }, - "follow-redirects": { - "version": "1.5.10", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz", - "integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==", - "dev": true, - "requires": { - "debug": "=3.1.0" - } - }, "for-in": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", @@ -38541,15 +38490,6 @@ "path-exists": "^3.0.0" } }, - "lockfile": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/lockfile/-/lockfile-1.0.4.tgz", - "integrity": "sha512-cvbTwETRfsFh4nHsL1eGWapU1XFi5Ot9E85sWAwia7Y7EgB7vfqcZhTKZ+l7hCGxSPoushMv5GKhT5PdLv03WA==", - "dev": true, - "requires": { - "signal-exit": "^3.0.2" - } - }, "lodash": { "version": "4.17.15", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", From 160e9a40dbcce0fdcfc911cc30f1610e8f4bcac8 Mon Sep 17 00:00:00 2001 From: Ceyhun Ozugur Date: Thu, 14 May 2020 18:11:51 +0200 Subject: [PATCH 16/21] Use v1 for actions/cache --- .github/workflows/rnmobile-android-runner.yml | 2 +- .github/workflows/rnmobile-ios-runner.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rnmobile-android-runner.yml b/.github/workflows/rnmobile-android-runner.yml index 0b348f73d8ed86..dca51aa0749de8 100644 --- a/.github/workflows/rnmobile-android-runner.yml +++ b/.github/workflows/rnmobile-android-runner.yml @@ -16,7 +16,7 @@ jobs: uses: actions/checkout@v2 - name: Restore npm cache - uses: actions/cache@master + uses: actions/cache@v1 with: path: ~/.npm key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }} diff --git a/.github/workflows/rnmobile-ios-runner.yml b/.github/workflows/rnmobile-ios-runner.yml index 48aa55e5d27629..77129db4199360 100644 --- a/.github/workflows/rnmobile-ios-runner.yml +++ b/.github/workflows/rnmobile-ios-runner.yml @@ -15,7 +15,7 @@ jobs: - uses: actions/checkout@v2 - name: Restore npm cache - uses: actions/cache@master + uses: actions/cache@v1 with: path: ~/.npm key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }} @@ -38,7 +38,7 @@ jobs: key: ${{ runner.os }}-ios-build-${{ hashFiles('ios-checksums.txt') }} - name: Restore pods cache - uses: actions/cache@master + uses: actions/cache@v1 with: path: | packages/react-native-editor/ios/Pods From 392d479dd8e6a6fbb50e9d0b68ae54c1af701b41 Mon Sep 17 00:00:00 2001 From: Ceyhun Ozugur Date: Thu, 14 May 2020 18:45:04 +0200 Subject: [PATCH 17/21] Update native e2e tests from gutenberg-mobile/develop --- .../gutenberg-editor-block-insertion.test.js | 79 +++-- .../gutenberg-editor-gallery.test.js | 11 +- .../gutenberg-editor-heading.test.js | 44 +-- .../gutenberg-editor-image.test.js | 50 +-- .../gutenberg-editor-latest-posts.test.js | 6 +- .../gutenberg-editor-lists-end.test.js | 9 +- .../gutenberg-editor-lists.test.js | 25 +- .../gutenberg-editor-more.test.js | 2 +- .../gutenberg-editor-paragraph.test.js | 81 ++--- .../gutenberg-editor-paste.test.js | 29 +- .../gutenberg-editor-rotation.test.js | 21 +- .../gutenberg-editor-separator.test.js | 2 +- .../gutenberg-editor-spacer.test.js | 2 +- .../__device-tests__/pages/editor-page.js | 302 +++++++----------- 14 files changed, 305 insertions(+), 358 deletions(-) diff --git a/packages/react-native-editor/__device-tests__/gutenberg-editor-block-insertion.test.js b/packages/react-native-editor/__device-tests__/gutenberg-editor-block-insertion.test.js index dc44e1625ff1d6..2d8ce89ffda3ef 100644 --- a/packages/react-native-editor/__device-tests__/gutenberg-editor-block-insertion.test.js +++ b/packages/react-native-editor/__device-tests__/gutenberg-editor-block-insertion.test.js @@ -12,12 +12,13 @@ import { } from './helpers/utils'; import testData from './helpers/test-data'; -jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000; +jest.setTimeout( 1000000 ); describe( 'Gutenberg Editor tests for Block insertion', () => { let driver; let editorPage; let allPassed = true; + const paragraphBlockName = 'Paragraph'; // Use reporter for setting status for saucelabs Job if ( ! isLocalEnvironment() ) { @@ -41,37 +42,31 @@ describe( 'Gutenberg Editor tests for Block insertion', () => { } ); it( 'should be able to insert block into post', async () => { - await editorPage.addNewParagraphBlock(); - let paragraphBlockElement = await editorPage.getParagraphBlockAtPosition( - 1 + await editorPage.addNewBlock( paragraphBlockName ); + let paragraphBlockElement = await editorPage.getBlockAtPosition( + paragraphBlockName ); if ( isAndroid() ) { await paragraphBlockElement.click(); } - await editorPage.sendTextToParagraphBlockAtPosition( - 1, - testData.longText - ); + + await editorPage.sendTextToParagraphBlock( 1, testData.longText ); // Should have 3 paragraph blocks at this point - paragraphBlockElement = await editorPage.getParagraphBlockAtPosition( + paragraphBlockElement = await editorPage.getBlockAtPosition( + paragraphBlockName, 2 ); await paragraphBlockElement.click(); - await editorPage.addNewParagraphBlock(); + await editorPage.addNewBlock( paragraphBlockName ); - // wait for accessibility ids to update - await driver.sleep( 1000 ); - - paragraphBlockElement = await editorPage.getParagraphBlockAtPosition( + paragraphBlockElement = await editorPage.getBlockAtPosition( + paragraphBlockName, 3 ); await paragraphBlockElement.click(); - await editorPage.sendTextToParagraphBlockAtPosition( - 3, - testData.mediumText - ); + await editorPage.sendTextToParagraphBlock( 3, testData.mediumText ); await editorPage.verifyHtmlContent( testData.blockInsertionHtml ); @@ -80,47 +75,52 @@ describe( 'Gutenberg Editor tests for Block insertion', () => { // Workaround for now since deleting the first element causes a crash on CI for Android if ( isAndroid() ) { - paragraphBlockElement = await editorPage.getParagraphBlockAtPosition( + paragraphBlockElement = await editorPage.getBlockAtPosition( + paragraphBlockName, 3, - { autoscroll: true } + { + autoscroll: true, + } ); + await paragraphBlockElement.click(); - await editorPage.removeParagraphBlockAtPosition( 3 ); + await editorPage.removeBlockAtPosition( paragraphBlockName, 3 ); for ( let i = 3; i > 0; i-- ) { // wait for accessibility ids to update await driver.sleep( 1000 ); - paragraphBlockElement = await editorPage.getParagraphBlockAtPosition( + paragraphBlockElement = await editorPage.getBlockAtPosition( + paragraphBlockName, i, - { autoscroll: true } + { + autoscroll: true, + } ); await paragraphBlockElement.click(); - await editorPage.removeParagraphBlockAtPosition( i ); + await editorPage.removeBlockAtPosition( paragraphBlockName, i ); } } else { for ( let i = 4; i > 0; i-- ) { // wait for accessibility ids to update await driver.sleep( 1000 ); - paragraphBlockElement = await editorPage.getParagraphBlockAtPosition( - 1 + paragraphBlockElement = await editorPage.getBlockAtPosition( + paragraphBlockName ); await clickMiddleOfElement( driver, paragraphBlockElement ); - await editorPage.removeParagraphBlockAtPosition( 1 ); + await editorPage.removeBlockAtPosition( paragraphBlockName ); } } } ); it( 'should be able to insert block at the beginning of post from the title', async () => { - await editorPage.addNewParagraphBlock(); - let paragraphBlockElement = await editorPage.getParagraphBlockAtPosition( - 1 + await editorPage.addNewBlock( paragraphBlockName ); + let paragraphBlockElement = await editorPage.getBlockAtPosition( + paragraphBlockName ); if ( isAndroid() ) { await paragraphBlockElement.click(); } - await editorPage.sendTextToParagraphBlockAtPosition( - 1, - testData.longText - ); + + await editorPage.sendTextToParagraphBlock( 1, testData.longText ); // Should have 3 paragraph blocks at this point if ( isAndroid() ) { @@ -134,15 +134,12 @@ describe( 'Gutenberg Editor tests for Block insertion', () => { await titleElement.click(); await titleElement.click(); - await editorPage.addNewParagraphBlock(); - paragraphBlockElement = await editorPage.getParagraphBlockAtPosition( - 1 + await editorPage.addNewBlock( paragraphBlockName ); + paragraphBlockElement = await editorPage.getBlockAtPosition( + paragraphBlockName ); await clickMiddleOfElement( driver, paragraphBlockElement ); - await editorPage.sendTextToParagraphBlockAtPosition( - 1, - testData.mediumText - ); + await editorPage.sendTextToParagraphBlock( 1, testData.mediumText ); await paragraphBlockElement.click(); await editorPage.verifyHtmlContent( testData.blockInsertionHtmlFromTitle diff --git a/packages/react-native-editor/__device-tests__/gutenberg-editor-gallery.test.js b/packages/react-native-editor/__device-tests__/gutenberg-editor-gallery.test.js index d90542ce1ff09d..5872ad69803d0f 100644 --- a/packages/react-native-editor/__device-tests__/gutenberg-editor-gallery.test.js +++ b/packages/react-native-editor/__device-tests__/gutenberg-editor-gallery.test.js @@ -4,12 +4,13 @@ import EditorPage from './pages/editor-page'; import { setupDriver, isLocalEnvironment, stopDriver } from './helpers/utils'; -jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000; +jest.setTimeout( 1000000 ); describe( 'Gutenberg Editor Gallery Block tests', () => { let driver; let editorPage; let allPassed = true; + const galleryBlockName = 'Gallery'; // Use reporter for setting status for saucelabs Job if ( ! isLocalEnvironment() ) { @@ -32,11 +33,13 @@ describe( 'Gutenberg Editor Gallery Block tests', () => { } ); it( 'should be able to add a gallery block', async () => { - await editorPage.addNewGalleryBlock(); - const galleryBlock = await editorPage.getGalleryBlockAtPosition( 1 ); + await editorPage.addNewBlock( galleryBlockName ); + const galleryBlock = await editorPage.getBlockAtPosition( + galleryBlockName + ); expect( galleryBlock ).toBeTruthy(); - await editorPage.removeGalleryBlockAtPosition( 1 ); + await editorPage.removeBlockAtPosition( galleryBlockName ); } ); afterAll( async () => { diff --git a/packages/react-native-editor/__device-tests__/gutenberg-editor-heading.test.js b/packages/react-native-editor/__device-tests__/gutenberg-editor-heading.test.js index 8fec3cdeb4b0b2..83bc5184e78ae0 100644 --- a/packages/react-native-editor/__device-tests__/gutenberg-editor-heading.test.js +++ b/packages/react-native-editor/__device-tests__/gutenberg-editor-heading.test.js @@ -10,12 +10,14 @@ import { } from './helpers/utils'; import testData from './helpers/test-data'; -jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000; +jest.setTimeout( 1000000 ); describe( 'Gutenberg Editor tests', () => { let driver; let editorPage; let allPassed = true; + const paragraphBlockName = 'Paragraph'; + const headingBlockName = 'Heading'; // Use reporter for setting status for saucelabs Job if ( ! isLocalEnvironment() ) { @@ -38,49 +40,55 @@ describe( 'Gutenberg Editor tests', () => { } ); it( 'should be able to create a post with heading and paragraph blocks', async () => { - await editorPage.addNewHeadingBlock(); - let headingBlockElement = await editorPage.getHeadingBlockAtPosition( - 1 + await editorPage.addNewBlock( headingBlockName ); + let headingBlockElement = await editorPage.getBlockAtPosition( + headingBlockName ); - if ( isAndroid() ) { await headingBlockElement.click(); } await editorPage.sendTextToHeadingBlock( headingBlockElement, - testData.heading + testData.heading, + false ); - await editorPage.addNewParagraphBlock(); - let paragraphBlockElement = await editorPage.getParagraphBlockAtPosition( + await editorPage.addNewBlock( paragraphBlockName ); + let paragraphBlockElement = await editorPage.getBlockAtPosition( + paragraphBlockName, 2 ); - await editorPage.sendTextToParagraphBlock( + await editorPage.typeTextToParagraphBlock( paragraphBlockElement, testData.mediumText ); - await editorPage.addNewParagraphBlock(); - paragraphBlockElement = await editorPage.getParagraphBlockAtPosition( + await editorPage.addNewBlock( paragraphBlockName ); + paragraphBlockElement = await editorPage.getBlockAtPosition( + paragraphBlockName, 3 ); - await editorPage.sendTextToParagraphBlock( + await editorPage.typeTextToParagraphBlock( paragraphBlockElement, testData.mediumText ); - await editorPage.addNewHeadingBlock(); - headingBlockElement = await editorPage.getHeadingBlockAtPosition( 4 ); - await editorPage.sendTextToHeadingBlock( + await editorPage.addNewBlock( headingBlockName ); + headingBlockElement = await editorPage.getBlockAtPosition( + headingBlockName, + 4 + ); + await editorPage.typeTextToParagraphBlock( headingBlockElement, testData.heading ); - await editorPage.addNewParagraphBlock(); - paragraphBlockElement = await editorPage.getParagraphBlockAtPosition( + await editorPage.addNewBlock( paragraphBlockName ); + paragraphBlockElement = await editorPage.getBlockAtPosition( + paragraphBlockName, 5 ); - await editorPage.sendTextToParagraphBlock( + await editorPage.typeTextToParagraphBlock( paragraphBlockElement, testData.mediumText ); diff --git a/packages/react-native-editor/__device-tests__/gutenberg-editor-image.test.js b/packages/react-native-editor/__device-tests__/gutenberg-editor-image.test.js index 56accc92b66297..d54eb9113f148d 100644 --- a/packages/react-native-editor/__device-tests__/gutenberg-editor-image.test.js +++ b/packages/react-native-editor/__device-tests__/gutenberg-editor-image.test.js @@ -12,12 +12,14 @@ import { } from './helpers/utils'; import testData from './helpers/test-data'; -jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000; +jest.setTimeout( 1000000 ); describe( 'Gutenberg Editor Image Block tests', () => { let driver; let editorPage; let allPassed = true; + const imageBlockName = 'Image'; + const paragraphBlockName = 'Paragraph'; // Use reporter for setting status for saucelabs Job if ( ! isLocalEnvironment() ) { @@ -40,8 +42,8 @@ describe( 'Gutenberg Editor Image Block tests', () => { } ); it( 'should be able to add an image block', async () => { - await editorPage.addNewImageBlock(); - let imageBlock = await editorPage.getImageBlockAtPosition( 1 ); + await editorPage.addNewBlock( imageBlockName ); + let imageBlock = await editorPage.getBlockAtPosition( imageBlockName ); // Can only add image from media library on iOS if ( ! isAndroid() ) { @@ -54,52 +56,28 @@ describe( 'Gutenberg Editor Image Block tests', () => { await editorPage.dismissKeyboard(); // end workaround - imageBlock = await editorPage.getImageBlockAtPosition( 1 ); - await imageBlock.click(); + imageBlock = await editorPage.getBlockAtPosition( imageBlock ); await swipeUp( driver, imageBlock ); await editorPage.enterCaptionToSelectedImageBlock( - testData.imageCaption + testData.imageCaption, + true ); await editorPage.dismissKeyboard(); - imageBlock = await editorPage.getImageBlockAtPosition( 1 ); - await imageBlock.click(); } - await editorPage.removeImageBlockAtPosition( 1 ); - } ); - - it( 'should be able to add an image block with multiple paragraph blocks', async () => { - await editorPage.addNewImageBlock(); - let imageBlock = await editorPage.getImageBlockAtPosition( 1 ); - - // Can only add image from media library on iOS - if ( ! isAndroid() ) { - await editorPage.selectEmptyImageBlock( imageBlock ); - await editorPage.chooseMediaLibrary(); - - imageBlock = await editorPage.getImageBlockAtPosition( 1 ); - await imageBlock.click(); - await swipeUp( driver, imageBlock ); - await editorPage.enterCaptionToSelectedImageBlock( - testData.imageCaption - ); - await editorPage.dismissKeyboard(); - } - - await editorPage.addNewParagraphBlock(); - const paragraphBlockElement = await editorPage.getParagraphBlockAtPosition( + await editorPage.addNewBlock( paragraphBlockName ); + const paragraphBlockElement = await editorPage.getBlockAtPosition( + paragraphBlockName, 2 ); if ( isAndroid() ) { await paragraphBlockElement.click(); } - await editorPage.sendTextToParagraphBlockAtPosition( - 2, - testData.longText - ); + + await editorPage.sendTextToParagraphBlock( 2, testData.shortText ); // skip HTML check for Android since we couldn't add image from media library if ( ! isAndroid() ) { - await editorPage.verifyHtmlContent( testData.imageCompletehtml ); + await editorPage.verifyHtmlContent( testData.imageShorteHtml ); } } ); diff --git a/packages/react-native-editor/__device-tests__/gutenberg-editor-latest-posts.test.js b/packages/react-native-editor/__device-tests__/gutenberg-editor-latest-posts.test.js index 15074eba1ce094..160965d1afe967 100644 --- a/packages/react-native-editor/__device-tests__/gutenberg-editor-latest-posts.test.js +++ b/packages/react-native-editor/__device-tests__/gutenberg-editor-latest-posts.test.js @@ -33,9 +33,9 @@ describe( 'Gutenberg Editor Latest Post Block tests', () => { } ); it( 'should be able to add a Latests-Posts block', async () => { - await editorPage.addNewLatestPostsBlock(); - const latestPostsBlock = await editorPage.getLatestPostsBlockAtPosition( - 1 + await editorPage.addNewBlock( lastPostBlockName ); + const latestPostsBlock = await editorPage.getBlockAtPosition( + lastPostBlockName ); expect( latestPostsBlock ).toBeTruthy(); diff --git a/packages/react-native-editor/__device-tests__/gutenberg-editor-lists-end.test.js b/packages/react-native-editor/__device-tests__/gutenberg-editor-lists-end.test.js index 208ca36bfe9ef7..a39edd83c9fc29 100644 --- a/packages/react-native-editor/__device-tests__/gutenberg-editor-lists-end.test.js +++ b/packages/react-native-editor/__device-tests__/gutenberg-editor-lists-end.test.js @@ -10,12 +10,13 @@ import { } from './helpers/utils'; import testData from './helpers/test-data'; -jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000; +jest.setTimeout( 1000000 ); describe( 'Gutenberg Editor tests for List block (end)', () => { let driver; let editorPage; let allPassed = true; + const listBlockName = 'List'; // Use reporter for setting status for saucelabs Job if ( ! isLocalEnvironment() ) { @@ -38,8 +39,10 @@ describe( 'Gutenberg Editor tests for List block (end)', () => { } ); it( 'should be able to end a List block', async () => { - await editorPage.addNewListBlock(); - const listBlockElement = await editorPage.getListBlockAtPosition( 1 ); + await editorPage.addNewBlock( listBlockName ); + const listBlockElement = await editorPage.getBlockAtPosition( + listBlockName + ); // Click List block on Android to force EditText focus if ( isAndroid() ) { diff --git a/packages/react-native-editor/__device-tests__/gutenberg-editor-lists.test.js b/packages/react-native-editor/__device-tests__/gutenberg-editor-lists.test.js index 7120997fbdda3f..d837d87bea5e80 100644 --- a/packages/react-native-editor/__device-tests__/gutenberg-editor-lists.test.js +++ b/packages/react-native-editor/__device-tests__/gutenberg-editor-lists.test.js @@ -10,12 +10,13 @@ import { } from './helpers/utils'; import testData from './helpers/test-data'; -jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000; +jest.setTimeout( 1000000 ); describe( 'Gutenberg Editor tests for List block', () => { let driver; let editorPage; let allPassed = true; + const listBlockName = 'List'; // Use reporter for setting status for saucelabs Job if ( ! isLocalEnvironment() ) { @@ -38,9 +39,10 @@ describe( 'Gutenberg Editor tests for List block', () => { } ); it( 'should be able to add a new List block', async () => { - await editorPage.addNewListBlock(); - const listBlockElement = await editorPage.getListBlockAtPosition( 1 ); - + await editorPage.addNewBlock( listBlockName ); + const listBlockElement = await editorPage.getBlockAtPosition( + listBlockName + ); // Click List block on Android to force EditText focus if ( isAndroid() ) { await listBlockElement.click(); @@ -65,6 +67,21 @@ describe( 'Gutenberg Editor tests for List block', () => { await editorPage.verifyHtmlContent( testData.listHtml ); } ); + it( 'should update format to ordered list, using toolbar button', async () => { + const listBlockElement = await editorPage.getBlockAtPosition( + listBlockName + ); + + // Click List block to force EditText focus + await listBlockElement.click(); + + // Send a click on the order list format button + await editorPage.clickOrderedListToolBarButton(); + + // switch to html and verify html + await editorPage.verifyHtmlContent( testData.listHtmlOrdered ); + } ); + afterAll( async () => { if ( ! isLocalEnvironment() ) { driver.sauceJobStatus( allPassed ); diff --git a/packages/react-native-editor/__device-tests__/gutenberg-editor-more.test.js b/packages/react-native-editor/__device-tests__/gutenberg-editor-more.test.js index 1e8e4f2b2ba4ce..7b6aed2b2266c3 100644 --- a/packages/react-native-editor/__device-tests__/gutenberg-editor-more.test.js +++ b/packages/react-native-editor/__device-tests__/gutenberg-editor-more.test.js @@ -4,7 +4,7 @@ import EditorPage from './pages/editor-page'; import { setupDriver, isLocalEnvironment, stopDriver } from './helpers/utils'; -jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000; +jest.setTimeout( 1000000 ); describe( 'Gutenberg Editor Spacer Block test', () => { let driver; diff --git a/packages/react-native-editor/__device-tests__/gutenberg-editor-paragraph.test.js b/packages/react-native-editor/__device-tests__/gutenberg-editor-paragraph.test.js index 86a9d66cc6813c..00017552cd329c 100644 --- a/packages/react-native-editor/__device-tests__/gutenberg-editor-paragraph.test.js +++ b/packages/react-native-editor/__device-tests__/gutenberg-editor-paragraph.test.js @@ -8,16 +8,18 @@ import { clickMiddleOfElement, clickBeginningOfElement, stopDriver, + swipeUp, isAndroid, } from './helpers/utils'; import testData from './helpers/test-data'; -jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000; +jest.setTimeout( 1000000 ); describe( 'Gutenberg Editor tests for Paragraph Block', () => { let driver; let editorPage; let allPassed = true; + const paragraphBlockName = 'Paragraph'; // Use reporter for setting status for saucelabs Job if ( ! isLocalEnvironment() ) { @@ -40,29 +42,31 @@ describe( 'Gutenberg Editor tests for Paragraph Block', () => { } ); it( 'should be able to add a new Paragraph block', async () => { - await editorPage.addNewParagraphBlock(); - const paragraphBlockElement = await editorPage.getParagraphBlockAtPosition( - 1 + await editorPage.addNewBlock( paragraphBlockName ); + const paragraphBlockElement = await editorPage.getBlockAtPosition( + paragraphBlockName ); if ( isAndroid() ) { await paragraphBlockElement.click(); } - await editorPage.sendTextToParagraphBlock( + + await editorPage.typeTextToParagraphBlock( paragraphBlockElement, testData.shortText ); - await editorPage.removeParagraphBlockAtPosition( 1 ); + await editorPage.removeBlockAtPosition( paragraphBlockName ); } ); it( 'should be able to split one paragraph block into two', async () => { - await editorPage.addNewParagraphBlock(); - const paragraphBlockElement = await editorPage.getParagraphBlockAtPosition( - 1 + await editorPage.addNewBlock( paragraphBlockName ); + const paragraphBlockElement = await editorPage.getBlockAtPosition( + paragraphBlockName ); if ( isAndroid() ) { await paragraphBlockElement.click(); } - await editorPage.sendTextToParagraphBlock( + + await editorPage.typeTextToParagraphBlock( paragraphBlockElement, testData.shortText ); @@ -70,13 +74,14 @@ describe( 'Gutenberg Editor tests for Paragraph Block', () => { paragraphBlockElement ); await clickMiddleOfElement( driver, textViewElement ); - await editorPage.sendTextToParagraphBlock( + await editorPage.typeTextToParagraphBlock( paragraphBlockElement, - '\n' + '\n', + false ); expect( - ( await editorPage.hasParagraphBlockAtPosition( 1 ) ) && - ( await editorPage.hasParagraphBlockAtPosition( 2 ) ) + ( await editorPage.hasBlockAtPosition( 1, paragraphBlockName ) ) && + ( await editorPage.hasBlockAtPosition( 2, paragraphBlockName ) ) ).toBe( true ); const text0 = await editorPage.getTextForParagraphBlockAtPosition( 1 ); @@ -87,19 +92,20 @@ describe( 'Gutenberg Editor tests for Paragraph Block', () => { new RegExp( `${ text0 + text1 }|${ text0 } ${ text1 }` ) ); - await editorPage.removeParagraphBlockAtPosition( 2 ); - await editorPage.removeParagraphBlockAtPosition( 1 ); + await editorPage.removeBlockAtPosition( paragraphBlockName, 2 ); + await editorPage.removeBlockAtPosition( paragraphBlockName ); } ); it( 'should be able to merge 2 paragraph blocks into 1', async () => { - await editorPage.addNewParagraphBlock(); - let paragraphBlockElement = await editorPage.getParagraphBlockAtPosition( - 1 + await editorPage.addNewBlock( paragraphBlockName ); + let paragraphBlockElement = await editorPage.getBlockAtPosition( + paragraphBlockName ); if ( isAndroid() ) { await paragraphBlockElement.click(); } - await editorPage.sendTextToParagraphBlock( + + await editorPage.typeTextToParagraphBlock( paragraphBlockElement, testData.shortText ); @@ -107,28 +113,30 @@ describe( 'Gutenberg Editor tests for Paragraph Block', () => { paragraphBlockElement ); await clickMiddleOfElement( driver, textViewElement ); - await editorPage.sendTextToParagraphBlock( + await editorPage.typeTextToParagraphBlock( paragraphBlockElement, '\n' ); expect( - ( await editorPage.hasParagraphBlockAtPosition( 1 ) ) && - ( await editorPage.hasParagraphBlockAtPosition( 2 ) ) + ( await editorPage.hasBlockAtPosition( 1, paragraphBlockName ) ) && + ( await editorPage.hasBlockAtPosition( 2, paragraphBlockName ) ) ).toBe( true ); const text0 = await editorPage.getTextForParagraphBlockAtPosition( 1 ); const text1 = await editorPage.getTextForParagraphBlockAtPosition( 2 ); - paragraphBlockElement = await editorPage.getParagraphBlockAtPosition( + paragraphBlockElement = await editorPage.getBlockAtPosition( + paragraphBlockName, 2 ); if ( isAndroid() ) { await paragraphBlockElement.click(); } + textViewElement = await editorPage.getTextViewForParagraphBlock( paragraphBlockElement ); await clickBeginningOfElement( driver, textViewElement ); - await editorPage.sendTextToParagraphBlock( + await editorPage.typeTextToParagraphBlock( paragraphBlockElement, '\u0008' ); @@ -136,27 +144,26 @@ describe( 'Gutenberg Editor tests for Paragraph Block', () => { const text = await editorPage.getTextForParagraphBlockAtPosition( 1 ); expect( text0 + text1 ).toMatch( text ); - expect( await editorPage.hasParagraphBlockAtPosition( 2 ) ).toBe( - false - ); - await editorPage.removeParagraphBlockAtPosition( 1 ); + expect( + await editorPage.hasBlockAtPosition( 2, paragraphBlockName ) + ).toBe( false ); + await editorPage.removeBlockAtPosition( paragraphBlockName ); } ); it( 'should be able to create a post with multiple paragraph blocks', async () => { - await editorPage.addNewParagraphBlock(); - const paragraphBlockElement = await editorPage.getParagraphBlockAtPosition( - 1 + await editorPage.addNewBlock( paragraphBlockName ); + const paragraphBlockElement = await editorPage.getBlockAtPosition( + paragraphBlockName ); if ( isAndroid() ) { await paragraphBlockElement.click(); } - await editorPage.sendTextToParagraphBlockAtPosition( - 1, - testData.longText - ); + + await editorPage.sendTextToParagraphBlock( 1, testData.longText ); for ( let i = 3; i > 0; i-- ) { - await editorPage.removeParagraphBlockAtPosition( i ); + await swipeUp( driver ); + await editorPage.removeBlockAtPosition( paragraphBlockName, i ); } } ); diff --git a/packages/react-native-editor/__device-tests__/gutenberg-editor-paste.test.js b/packages/react-native-editor/__device-tests__/gutenberg-editor-paste.test.js index 96a734e4c7bc30..75f18abd3c2511 100644 --- a/packages/react-native-editor/__device-tests__/gutenberg-editor-paste.test.js +++ b/packages/react-native-editor/__device-tests__/gutenberg-editor-paste.test.js @@ -14,7 +14,7 @@ import { } from './helpers/utils'; import testData from './helpers/test-data'; -jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000; +jest.setTimeout( 1000000 ); describe( 'Gutenberg Editor paste tests', () => { // skip iOS for now @@ -26,6 +26,7 @@ describe( 'Gutenberg Editor paste tests', () => { let driver; let editorPage; let allPassed = true; + const paragraphBlockName = 'Paragraph'; // Use reporter for setting status for saucelabs Job if ( ! isLocalEnvironment() ) { @@ -45,16 +46,15 @@ describe( 'Gutenberg Editor paste tests', () => { } ); it( 'copies plain text from one paragraph block and pastes in another', async () => { - await editorPage.addNewParagraphBlock(); - const paragraphBlockElement = await editorPage.getParagraphBlockAtPosition( - 1 + await editorPage.addNewBlock( paragraphBlockName ); + const paragraphBlockElement = await editorPage.getBlockAtPosition( + paragraphBlockName ); - if ( isAndroid() ) { await paragraphBlockElement.click(); } - await editorPage.sendTextToParagraphBlock( + await editorPage.typeTextToParagraphBlock( paragraphBlockElement, testData.pastePlainText ); @@ -68,11 +68,11 @@ describe( 'Gutenberg Editor paste tests', () => { await tapCopyAboveElement( driver, textViewElement ); // create another paragraph block - await editorPage.addNewParagraphBlock(); - const paragraphBlockElement2 = await editorPage.getParagraphBlockAtPosition( + await editorPage.addNewBlock( paragraphBlockName ); + const paragraphBlockElement2 = await editorPage.getBlockAtPosition( + paragraphBlockName, 2 ); - if ( isAndroid() ) { await paragraphBlockElement2.click(); } @@ -92,10 +92,9 @@ describe( 'Gutenberg Editor paste tests', () => { it( 'copies styled text from one paragraph block and pastes in another', async () => { // create paragraph block with styled text by editing html await editorPage.setHtmlContentAndroid( testData.pasteHtmlText ); - const paragraphBlockElement = await editorPage.getParagraphBlockAtPosition( - 1 + const paragraphBlockElement = await editorPage.getBlockAtPosition( + paragraphBlockName ); - if ( isAndroid() ) { await paragraphBlockElement.click(); } @@ -110,11 +109,11 @@ describe( 'Gutenberg Editor paste tests', () => { await tapCopyAboveElement( driver, textViewElement ); // create another paragraph block - await editorPage.addNewParagraphBlock(); - const paragraphBlockElement2 = await editorPage.getParagraphBlockAtPosition( + await editorPage.addNewBlock( paragraphBlockName ); + const paragraphBlockElement2 = await editorPage.getBlockAtPosition( + paragraphBlockName, 2 ); - if ( isAndroid() ) { await paragraphBlockElement2.click(); } diff --git a/packages/react-native-editor/__device-tests__/gutenberg-editor-rotation.test.js b/packages/react-native-editor/__device-tests__/gutenberg-editor-rotation.test.js index 9c82ab7392c8ce..85e426aa5dff3f 100644 --- a/packages/react-native-editor/__device-tests__/gutenberg-editor-rotation.test.js +++ b/packages/react-native-editor/__device-tests__/gutenberg-editor-rotation.test.js @@ -11,12 +11,13 @@ import { } from './helpers/utils'; import testData from './helpers/test-data'; -jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000; +jest.setTimeout( 1000000 ); describe( 'Gutenberg Editor tests', () => { let driver; let editorPage; let allPassed = true; + const paragraphBlockName = 'Paragraph'; // Use reporter for setting status for saucelabs Job if ( ! isLocalEnvironment() ) { @@ -39,15 +40,15 @@ describe( 'Gutenberg Editor tests', () => { } ); it( 'should be able to add blocks , rotate device and continue adding blocks', async () => { - await editorPage.addNewParagraphBlock(); - let paragraphBlockElement = await editorPage.getParagraphBlockAtPosition( - 1 + await editorPage.addNewBlock( paragraphBlockName ); + let paragraphBlockElement = await editorPage.getBlockAtPosition( + paragraphBlockName ); if ( isAndroid() ) { await paragraphBlockElement.click(); } - await editorPage.sendTextToParagraphBlock( + await editorPage.typeTextToParagraphBlock( paragraphBlockElement, testData.mediumText ); @@ -58,22 +59,24 @@ describe( 'Gutenberg Editor tests', () => { await driver.hideDeviceKeyboard(); } - await editorPage.addNewParagraphBlock(); + await editorPage.addNewBlock( paragraphBlockName ); if ( isAndroid() ) { await driver.hideDeviceKeyboard(); } - paragraphBlockElement = await editorPage.getParagraphBlockAtPosition( + paragraphBlockElement = await editorPage.getBlockAtPosition( + paragraphBlockName, 2 ); while ( ! paragraphBlockElement ) { await driver.hideDeviceKeyboard(); - paragraphBlockElement = await editorPage.getParagraphBlockAtPosition( + paragraphBlockElement = await editorPage.getBlockAtPosition( + paragraphBlockName, 2 ); } - await editorPage.sendTextToParagraphBlock( + await editorPage.typeTextToParagraphBlock( paragraphBlockElement, testData.mediumText ); diff --git a/packages/react-native-editor/__device-tests__/gutenberg-editor-separator.test.js b/packages/react-native-editor/__device-tests__/gutenberg-editor-separator.test.js index 7c669e6c574fa5..438e1a5c1c9c5b 100644 --- a/packages/react-native-editor/__device-tests__/gutenberg-editor-separator.test.js +++ b/packages/react-native-editor/__device-tests__/gutenberg-editor-separator.test.js @@ -4,7 +4,7 @@ import EditorPage from './pages/editor-page'; import { setupDriver, isLocalEnvironment, stopDriver } from './helpers/utils'; -jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000; +jest.setTimeout( 1000000 ); describe( 'Gutenberg Editor Separator Block test', () => { let driver; diff --git a/packages/react-native-editor/__device-tests__/gutenberg-editor-spacer.test.js b/packages/react-native-editor/__device-tests__/gutenberg-editor-spacer.test.js index 056abacedc6052..2aa09cc523bb15 100644 --- a/packages/react-native-editor/__device-tests__/gutenberg-editor-spacer.test.js +++ b/packages/react-native-editor/__device-tests__/gutenberg-editor-spacer.test.js @@ -4,7 +4,7 @@ import EditorPage from './pages/editor-page'; import { setupDriver, isLocalEnvironment, stopDriver } from './helpers/utils'; -jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000; +jest.setTimeout( 1000000 ); describe( 'Gutenberg Editor Spacer Block test', () => { let driver; diff --git a/packages/react-native-editor/__device-tests__/pages/editor-page.js b/packages/react-native-editor/__device-tests__/pages/editor-page.js index 2c71fa3704e254..03a830bab927f2 100644 --- a/packages/react-native-editor/__device-tests__/pages/editor-page.js +++ b/packages/react-native-editor/__device-tests__/pages/editor-page.js @@ -1,9 +1,3 @@ -/** - * External dependencies - */ -// eslint-disable-next-line import/no-extraneous-dependencies -import wd from 'wd'; - /** * Internal dependencies */ @@ -16,22 +10,13 @@ import { } from '../helpers/utils'; export default class EditorPage { - driver: wd.PromiseChainWebdriver; - accessibilityIdKey: string; - accessibilityIdXPathAttrib: string; + driver; + accessibilityIdKey; + accessibilityIdXPathAttrib; paragraphBlockName = 'Paragraph'; - listBlockName = 'List'; - headingBlockName = 'Heading'; - imageBlockName = 'Image'; - galleryBlockName = 'Gallery'; - - // This is needed to adapt to changes in the way accessibility ids are being - // assigned after migrating to AndroidX and React Native 0.60. See: - // https://github.com/wordpress-mobile/gutenberg-mobile/pull/1112#issuecomment-501165250 - // for more details. - accessibilityIdSuffix = ''; - - constructor( driver: wd.PromiseChainWebdriver ) { + orderedListButtonName = 'Convert to ordered list'; + + constructor( driver ) { this.driver = driver; this.accessibilityIdKey = 'name'; this.accessibilityIdXPathAttrib = 'name'; @@ -39,10 +24,9 @@ export default class EditorPage { if ( isAndroid() ) { this.accessibilityIdXPathAttrib = 'content-desc'; this.accessibilityIdKey = 'contentDescription'; - this.accessibilityIdSuffix = ', '; } - driver.setImplicitWaitTimeout( 10000 ); + driver.setImplicitWaitTimeout( 5000 ); } async getBlockList() { @@ -53,9 +37,9 @@ export default class EditorPage { // and accessibilityId attributes on this object and selects the block // position uses one based numbering async getBlockAtPosition( - position: number, - blockName: string, - options: { autoscroll: boolean } = { autoscroll: false } + blockName, + position = 1, + options = { autoscroll: false } ) { const blockLocator = `//*[contains(@${ this.accessibilityIdXPathAttrib }, "${ blockName } Block. Row ${ position }")]`; const elements = await this.driver.elementsByXPath( blockLocator ); @@ -94,7 +78,11 @@ export default class EditorPage { // scroll down await swipeUp( this.driver ); } - return this.getBlockAtPosition( position, blockName, options ); + return await this.getBlockAtPosition( + blockName, + position, + options + ); } return lastElementFound; } @@ -111,16 +99,14 @@ export default class EditorPage { return elements[ elements.length - 1 ]; } - async hasBlockAtPosition( position: number, blockName: string = '' ) { + async hasBlockAtPosition( position = 1, blockName = '' ) { return ( undefined !== - ( await this.getBlockAtPosition( position, blockName ) ) + ( await this.getBlockAtPosition( blockName, position ) ) ); } - async getTitleElement( - options: { autoscroll: boolean } = { autoscroll: false } - ) { + async getTitleElement( options = { autoscroll: false } ) { //TODO: Improve the identifier for this element const elements = await this.driver.elementsByXPath( `//*[contains(@${ this.accessibilityIdXPathAttrib }, "Post title.")]` @@ -133,7 +119,7 @@ export default class EditorPage { } async getTextViewForHtmlViewContent() { - const accessibilityId = `html-view-content${ this.accessibilityIdSuffix }`; + const accessibilityId = 'html-view-content'; let blockLocator = `//*[@${ this.accessibilityIdXPathAttrib }="${ accessibilityId }"]`; if ( ! isAndroid() ) { @@ -144,7 +130,7 @@ export default class EditorPage { // Converts to lower case and checks for a match to lowercased html content // Ensure to take additional steps to handle text being changed by auto correct - async verifyHtmlContent( html: string ) { + async verifyHtmlContent( html ) { await toggleHtmlMode( this.driver, true ); const htmlContentView = await this.getTextViewForHtmlViewContent(); @@ -155,7 +141,7 @@ export default class EditorPage { } // set html editor content explicitly - async setHtmlContentAndroid( html: string ) { + async setHtmlContentAndroid( html ) { await toggleHtmlMode( this.driver, true ); const htmlContentView = await this.getTextViewForHtmlViewContent(); @@ -183,7 +169,7 @@ export default class EditorPage { // Block toolbar functions // ========================= - async addNewBlock( blockName: string ) { + async addNewBlock( blockName ) { // Click add button let identifier = 'Add block'; if ( isAndroid() ) { @@ -195,10 +181,55 @@ export default class EditorPage { await addButton.click(); // Click on block of choice + const blockButton = await this.findBlockButton( blockName ); + if ( isAndroid() ) { + await blockButton.click(); + } else { + await this.driver.execute( 'mobile: tap', { + element: blockButton, + x: 10, + y: 10, + } ); + } + } + + // Attempts to find the given block button in the block inserter control. + async findBlockButton( blockName ) { + if ( isAndroid() ) { + // Checks if the Block Button is available, and if not will scroll to the second half of the available buttons. + while ( + ! ( await this.driver.hasElementByAccessibilityId( blockName ) ) + ) { + await this.driver.pressKeycode( 20 ); // Press the Down arrow to force a scroll. + } + + return await this.driver.elementByAccessibilityId( blockName ); + } + const blockButton = await this.driver.elementByAccessibilityId( blockName ); - await blockButton.click(); + const size = await this.driver.getWindowSize(); + const height = size.height - 5; + + while ( ! ( await blockButton.isDisplayed() ) ) { + await this.driver.execute( 'mobile: dragFromToForDuration', { + fromX: 50, + fromY: height, + toX: 50, + toY: height - 450, + duration: 0.5, + } ); + } + + return blockButton; + } + + async clickToolBarButton( buttonName ) { + const toolBarButton = await this.driver.elementByAccessibilityId( + buttonName + ); + await toolBarButton.click(); } // ========================= @@ -206,43 +237,40 @@ export default class EditorPage { // ========================= // position of the block to move up - async moveBlockUpAtPosition( position: number, blockName: string = '' ) { + async moveBlockUpAtPosition( position, blockName = '' ) { if ( ! ( await this.hasBlockAtPosition( position, blockName ) ) ) { throw Error( `No Block at position ${ position }` ); } - const parentId = `${ blockName } Block. Row ${ position }.${ this.accessibilityIdSuffix }`; - const parentLocator = `//*[@${ this.accessibilityIdXPathAttrib }="${ parentId }"]`; - const blockId = `Move block up from row ${ position } to row ${ position - - 1 }${ this.accessibilityIdSuffix }`; + const parentLocator = `//*[@${ this.accessibilityIdXPathAttrib }="${ blockName } Block. Row ${ position }."]`; let blockLocator = `${ parentLocator }/following-sibling::*`; blockLocator += isAndroid() ? '' : '//*'; - blockLocator += `[@${ this.accessibilityIdXPathAttrib }="${ blockId }"]`; + blockLocator += `[@${ + this.accessibilityIdXPathAttrib + }="Move block up from row ${ position } to row ${ position - 1 }"]`; const moveUpButton = await this.driver.elementByXPath( blockLocator ); await moveUpButton.click(); } // position of the block to move down - async moveBlockDownAtPosition( position: number, blockName: string = '' ) { + async moveBlockDownAtPosition( position, blockName = '' ) { if ( ! ( await this.hasBlockAtPosition( position, blockName ) ) ) { throw Error( `No Block at position ${ position }` ); } - const parentId = `${ blockName } Block. Row ${ position }.`; - const parentLocator = `//*[contains(@${ this.accessibilityIdXPathAttrib }, "${ parentId }")]`; - - const blockId = `Move block down from row ${ position } to row ${ position + - 1 }${ this.accessibilityIdSuffix }`; + const parentLocator = `//*[contains(@${ this.accessibilityIdXPathAttrib }, "${ blockName } Block. Row ${ position }.")]`; let blockLocator = `${ parentLocator }/following-sibling::*`; blockLocator += isAndroid() ? '' : '//*'; - blockLocator += `[@${ this.accessibilityIdXPathAttrib }="${ blockId }"]`; + blockLocator += `[@${ + this.accessibilityIdXPathAttrib + }="Move block down from row ${ position } to row ${ position + 1 }"]`; const moveDownButton = await this.driver.elementByXPath( blockLocator ); await moveDownButton.click(); } // position of the block to remove // Block will no longer be present if this succeeds - async removeBlockAtPosition( position: number, blockName: string = '' ) { + async removeBlockAtPosition( blockName = '', position = 1 ) { if ( ! ( await this.hasBlockAtPosition( position, blockName ) ) ) { throw Error( `No Block at position ${ position }` ); } @@ -254,7 +282,7 @@ export default class EditorPage { const removeBlockLocator = `${ buttonElementName }[contains(@${ this.accessibilityIdXPathAttrib }, "${ removeButtonIdentifier }")]`; if ( isAndroid() ) { - const block = await this.getBlockAtPosition( position, blockName ); + const block = await this.getBlockAtPosition( blockName, position ); let checkList = await this.driver.elementsByXPath( removeBlockLocator ); @@ -276,28 +304,7 @@ export default class EditorPage { // Paragraph Block functions // ========================= - async addNewParagraphBlock() { - await this.addNewBlock( this.paragraphBlockName ); - } - - async getParagraphBlockAtPosition( - position: number, - options: { autoscroll: boolean } = { autoscroll: false } - ) { - return this.getBlockAtPosition( - position, - this.paragraphBlockName, - options - ); - } - - async hasParagraphBlockAtPosition( position: number ) { - return this.hasBlockAtPosition( position, this.paragraphBlockName ); - } - - async getTextViewForParagraphBlock( - block: wd.PromiseChainWebdriver.Element - ) { + async getTextViewForParagraphBlock( block ) { let textViewElementName = 'XCUIElementTypeTextView'; if ( isAndroid() ) { textViewElementName = 'android.widget.EditText'; @@ -312,34 +319,36 @@ export default class EditorPage { return await this.driver.elementByXPath( blockLocator ); } - async sendTextToParagraphBlock( - block: wd.PromiseChainWebdriver.Element, - text: string - ) { + async typeTextToParagraphBlock( block, text, clear ) { const textViewElement = await this.getTextViewForParagraphBlock( block ); - await typeString( this.driver, textViewElement, text ); - await this.driver.sleep( 3000 ); // Give time for the block to rerender (such as for accessibility) + await typeString( this.driver, textViewElement, text, clear ); + await this.driver.sleep( 1000 ); // Give time for the block to rerender (such as for accessibility) } - async sendTextToParagraphBlockAtPosition( position: number, text: string ) { + async sendTextToParagraphBlock( position, text, clear ) { const paragraphs = text.split( '\n' ); for ( let i = 0; i < paragraphs.length; i++ ) { // Select block first - const block = await this.getParagraphBlockAtPosition( + const block = await this.getBlockAtPosition( + this.paragraphBlockName, position + i ); await block.click(); - await this.sendTextToParagraphBlock( block, paragraphs[ i ] ); + await this.typeTextToParagraphBlock( + block, + paragraphs[ i ], + clear + ); if ( i !== paragraphs.length - 1 ) { - await this.sendTextToParagraphBlock( block, '\n' ); + await this.typeTextToParagraphBlock( block, '\n', false ); } } } - async getTextForParagraphBlock( block: wd.PromiseChainWebdriver.Element ) { + async getTextForParagraphBlock( block ) { const textViewElement = await this.getTextViewForParagraphBlock( block ); @@ -347,16 +356,18 @@ export default class EditorPage { return text.toString(); } - async removeParagraphBlockAtPosition( position: number ) { - await this.removeBlockAtPosition( position, this.paragraphBlockName ); - } - - async getTextForParagraphBlockAtPosition( position: number ) { + async getTextForParagraphBlockAtPosition( position ) { // Select block first - let block = await this.getParagraphBlockAtPosition( position ); + let block = await this.getBlockAtPosition( + this.paragraphBlockName, + position + ); await block.click(); - block = await this.getParagraphBlockAtPosition( position ); + block = await this.getBlockAtPosition( + this.paragraphBlockName, + position + ); const text = await this.getTextForParagraphBlock( block ); return text.toString(); } @@ -365,19 +376,7 @@ export default class EditorPage { // List Block functions // ========================= - async addNewListBlock() { - await this.addNewBlock( this.listBlockName ); - } - - async getListBlockAtPosition( position: number ) { - return this.getBlockAtPosition( position, this.listBlockName ); - } - - async hasListBlockAtPosition( position: number ) { - return await this.hasBlockAtPosition( position, this.listBlockName ); - } - - async getTextViewForListBlock( block: wd.PromiseChainWebdriver.Element ) { + async getTextViewForListBlock( block ) { let textViewElementName = 'XCUIElementTypeTextView'; if ( isAndroid() ) { textViewElementName = 'android.widget.EditText'; @@ -392,43 +391,24 @@ export default class EditorPage { return await this.driver.elementByXPath( blockLocator ); } - async sendTextToListBlock( - block: wd.PromiseChainWebdriver.Element, - text: string - ) { + async sendTextToListBlock( block, text ) { const textViewElement = await this.getTextViewForListBlock( block ); - return await typeString( this.driver, textViewElement, text ); - } - async getTextForListBlock( block: wd.PromiseChainWebdriver.Element ) { - const textViewElement = await this.getTextViewForListBlock( block ); - const text = await textViewElement.text(); - return text.toString(); - } + // Cannot clear list blocks because it messes up the list bullet + const clear = false; - async removeListBlockAtPosition( position: number ) { - return await this.removeBlockAtPosition( position, this.listBlockName ); + return await typeString( this.driver, textViewElement, text, clear ); } - async getTextForListBlockAtPosition( position: number ) { - const block = await this.getListBlockAtPosition( position ); - const text = await this.getTextForListBlock( block ); - return text.toString(); + async clickOrderedListToolBarButton() { + await this.clickToolBarButton( this.orderedListButtonName ); } // ========================= // Image Block functions // ========================= - async addNewImageBlock() { - await this.addNewBlock( this.imageBlockName ); - } - - async getImageBlockAtPosition( position: number ) { - return this.getBlockAtPosition( position, this.imageBlockName ); - } - - async selectEmptyImageBlock( block: wd.PromiseChainWebdriver.Element ) { + async selectEmptyImageBlock( block ) { const accessibilityId = await block.getAttribute( this.accessibilityIdKey ); @@ -446,56 +426,20 @@ export default class EditorPage { await mediaLibraryButton.click(); } - async enterCaptionToSelectedImageBlock( caption: string ) { + async enterCaptionToSelectedImageBlock( caption, clear = true ) { const imageBlockCaptionField = await this.driver.elementByXPath( - '//XCUIElementTypeButton[@name="Image caption. Empty"]' + '//XCUIElementTypeButton[starts-with(@name, "Image caption.")]' ); await imageBlockCaptionField.click(); - await typeString( this.driver, imageBlockCaptionField, caption ); - } - - async removeImageBlockAtPosition( position: number ) { - return await this.removeBlockAtPosition( - position, - this.imageBlockName - ); - } - - // ========================= - // Gallery Block functions - // ========================= - - async addNewGalleryBlock() { - await this.addNewBlock( this.galleryBlockName ); - } - - async getGalleryBlockAtPosition( position: number ) { - return this.getBlockAtPosition( position, this.galleryBlockName ); - } - - async removeGalleryBlockAtPosition( position: number ) { - return await this.removeBlockAtPosition( - position, - this.galleryBlockName - ); + await typeString( this.driver, imageBlockCaptionField, caption, clear ); } // ========================= // Heading Block functions // ========================= - async addNewHeadingBlock() { - await this.addNewBlock( this.headingBlockName ); - } - - async getHeadingBlockAtPosition( position: number ) { - return this.getBlockAtPosition( position, this.headingBlockName ); - } // Inner element changes on iOS if Heading Block is empty - async getTextViewForHeadingBlock( - block: wd.PromiseChainWebdriver.Element, - empty: boolean - ) { + async getTextViewForHeadingBlock( block, empty ) { let textViewElementName = empty ? 'XCUIElementTypeStaticText' : 'XCUIElementTypeTextView'; @@ -510,23 +454,11 @@ export default class EditorPage { return await this.driver.elementByXPath( blockLocator ); } - async sendTextToHeadingBlock( - block: wd.PromiseChainWebdriver.Element, - text: string - ) { + async sendTextToHeadingBlock( block, text, clear = true ) { const textViewElement = await this.getTextViewForHeadingBlock( block, true ); - return await typeString( this.driver, textViewElement, text ); - } - - async getTextForHeadingBlock( block: wd.PromiseChainWebdriver.Element ) { - const textViewElement = await this.getTextViewForHeadingBlock( - block, - false - ); - const text = await textViewElement.text(); - return text.toString(); + return await typeString( this.driver, textViewElement, text, clear ); } } From d4c8b64a7ecc7bcb6dd6cee0f7a5d6c41763647e Mon Sep 17 00:00:00 2001 From: Tugdual de Kerviler Date: Thu, 14 May 2020 19:07:27 +0200 Subject: [PATCH 18/21] bundle js before running ios e2e tests --- packages/react-native-editor/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-native-editor/package.json b/packages/react-native-editor/package.json index fde1cf8b06f7f1..17d8caa905bd4b 100644 --- a/packages/react-native-editor/package.json +++ b/packages/react-native-editor/package.json @@ -115,7 +115,7 @@ "test:e2e:build-app:android": "npm run test:e2e:bundle:android && cd android && ./gradlew clean && ./gradlew assembleDebug", "test:e2e:install-app:android": "cd android && ./gradlew installDebug", "test:e2e:bundle:ios": "mkdir -p ios/build/gutenberg/Build/Products/Release-iphonesimulator/GutenbergDemo.app && react-native bundle --reset-cache --platform=ios --dev=false --minify false --entry-file=index.js --bundle-output=./ios/build/gutenberg/Build/Products/Release-iphonesimulator/GutenbergDemo.app/main.jsbundle --assets-dest=./ios/build/gutenberg/Build/Products/Release-iphonesimulator/GutenbergDemo.app", - "test:e2e:build-app:ios": "npm run ios -- --configuration Release --no-packager --simulator 'iPhone 11 (13.4)'", + "test:e2e:build-app:ios": "npm run test:e2e:bundle:ios && npm run ios -- --configuration Release --no-packager --simulator 'iPhone 11 (13.4)'", "build:gutenberg": "cd gutenberg && npm ci && npm run build", "clean": "npm run clean:build-artifacts; npm run clean:aztec; npm run cache clean; npm run clean:haste; npm run clean:jest; npm run clean:metro; npm run clean:react; npm run clean:watchman; npm run clean:node; npm run clean:pot", "clean:runtime": "npm run clean:haste; npm run clean:react; npm run clean:metro; npm run clean:jest; npm run clean:watchman; npm run clean:babel-cache", From a796690b479d794e7ac8cb4dee885a036d222c19 Mon Sep 17 00:00:00 2001 From: Tugdual de Kerviler Date: Thu, 14 May 2020 19:37:15 +0200 Subject: [PATCH 19/21] Exclude e2e tests generated files from git --- packages/react-native-editor/.gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/react-native-editor/.gitignore b/packages/react-native-editor/.gitignore index b7e17bf8a14fb6..5ec8884e0d751d 100644 --- a/packages/react-native-editor/.gitignore +++ b/packages/react-native-editor/.gitignore @@ -27,6 +27,7 @@ bundle/ *.ap_ .gradle/ android/app/src/main/assets/ +android/app/src/main/res/raw/ # iOS builds *.app.zip @@ -105,6 +106,8 @@ buck-out/ # e2e output log appium-out.log +ios-screen-recordings/ +android-screen-recordings/ bin/wp-cli.phar From 6c417eb03d495c65d6cb995ee800ade949997ce8 Mon Sep 17 00:00:00 2001 From: Tugdual de Kerviler Date: Thu, 14 May 2020 20:52:20 +0200 Subject: [PATCH 20/21] Move js bundle to test:e2e:ios:local instead --- packages/react-native-editor/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-native-editor/package.json b/packages/react-native-editor/package.json index 17d8caa905bd4b..0c44e12766547b 100644 --- a/packages/react-native-editor/package.json +++ b/packages/react-native-editor/package.json @@ -110,12 +110,12 @@ "test:e2e:ios": "TEST_RN_PLATFORM=ios npm run device-tests", "test:e2e:android:local": "npm run test:e2e:build-app:android && npm run test:e2e:install-app:android && TEST_RN_PLATFORM=android npm run device-tests:local", "test:e2e:android:local:debug": "npm run test:e2e:build-app:android && npm run test:e2e:install-app:android && npm run test:e2e:android:debug", - "test:e2e:ios:local": "npm run test:e2e:build-app:ios && TEST_RN_PLATFORM=ios npm run device-tests:local", + "test:e2e:ios:local": "npm run test:e2e:bundle:ios && npm run test:e2e:build-app:ios && TEST_RN_PLATFORM=ios npm run device-tests:local", "test:e2e:bundle:android": "mkdir -p android/app/src/main/assets && react-native bundle --reset-cache --platform android --dev false --minify false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res", "test:e2e:build-app:android": "npm run test:e2e:bundle:android && cd android && ./gradlew clean && ./gradlew assembleDebug", "test:e2e:install-app:android": "cd android && ./gradlew installDebug", "test:e2e:bundle:ios": "mkdir -p ios/build/gutenberg/Build/Products/Release-iphonesimulator/GutenbergDemo.app && react-native bundle --reset-cache --platform=ios --dev=false --minify false --entry-file=index.js --bundle-output=./ios/build/gutenberg/Build/Products/Release-iphonesimulator/GutenbergDemo.app/main.jsbundle --assets-dest=./ios/build/gutenberg/Build/Products/Release-iphonesimulator/GutenbergDemo.app", - "test:e2e:build-app:ios": "npm run test:e2e:bundle:ios && npm run ios -- --configuration Release --no-packager --simulator 'iPhone 11 (13.4)'", + "test:e2e:build-app:ios": "npm run ios -- --configuration Release --no-packager --simulator 'iPhone 11 (13.4)'", "build:gutenberg": "cd gutenberg && npm ci && npm run build", "clean": "npm run clean:build-artifacts; npm run clean:aztec; npm run cache clean; npm run clean:haste; npm run clean:jest; npm run clean:metro; npm run clean:react; npm run clean:watchman; npm run clean:node; npm run clean:pot", "clean:runtime": "npm run clean:haste; npm run clean:react; npm run clean:metro; npm run clean:jest; npm run clean:watchman; npm run clean:babel-cache", From c67d9747a2a96c45ab3b7c560b52a28ac203743e Mon Sep 17 00:00:00 2001 From: Tugdual de Kerviler Date: Thu, 14 May 2020 23:51:05 +0200 Subject: [PATCH 21/21] set implicit wait timeout on driver setup instead of EditorPage constructor --- .../react-native-editor/__device-tests__/helpers/utils.js | 4 ++-- .../react-native-editor/__device-tests__/pages/editor-page.js | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/react-native-editor/__device-tests__/helpers/utils.js b/packages/react-native-editor/__device-tests__/helpers/utils.js index 1ecf4981c0d825..761bfe325d58de 100644 --- a/packages/react-native-editor/__device-tests__/helpers/utils.js +++ b/packages/react-native-editor/__device-tests__/helpers/utils.js @@ -207,8 +207,8 @@ const setupDriver = async () => { // eslint-disable-next-line no-console console.log( status ); - await driver.setImplicitWaitTimeout( 2000 ); - await timer( 3000 ); + await driver.setImplicitWaitTimeout( 5000 ); + await timer( 5000 ); await driver.setOrientation( 'PORTRAIT' ); return driver; diff --git a/packages/react-native-editor/__device-tests__/pages/editor-page.js b/packages/react-native-editor/__device-tests__/pages/editor-page.js index 03a830bab927f2..5ba58f56f9dd29 100644 --- a/packages/react-native-editor/__device-tests__/pages/editor-page.js +++ b/packages/react-native-editor/__device-tests__/pages/editor-page.js @@ -25,8 +25,6 @@ export default class EditorPage { this.accessibilityIdXPathAttrib = 'content-desc'; this.accessibilityIdKey = 'contentDescription'; } - - driver.setImplicitWaitTimeout( 5000 ); } async getBlockList() {