diff --git a/package.json b/package.json index a6f56ec8a975..cb7e638c7979 100644 --- a/package.json +++ b/package.json @@ -133,7 +133,7 @@ "jasmine-core": "^3.5.0", "kagekiri": "^1.0.18", "karma": "^4.4.1", - "karma-browserstack-launcher": "^1.3.0", + "karma-browserstack-launcher": "^1.6.0", "karma-chrome-launcher": "^3.1.0", "karma-firefox-launcher": "^2.0.0", "karma-jasmine": "^4.0.1", diff --git a/scripts/browserstack/start-tunnel.sh b/scripts/browserstack/start-tunnel.sh deleted file mode 100755 index e31e832c077e..000000000000 --- a/scripts/browserstack/start-tunnel.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/bash - -set -e -o pipefail - -tunnelFileName="BrowserStackLocal-linux-x64.zip" -tunnelUrl="https://www.browserstack.com/browserstack-local/${tunnelFileName}" - -tunnelTmpDir="/tmp/material-browserstack" -tunnelLogFile="${tunnelTmpDir}/browserstack-local.log" -tunnelReadyFile="${tunnelTmpDir}/readyfile" -tunnelErrorFile="${tunnelTmpDir}/errorfile" - -# Cleanup and create the folder structure for the tunnel connector. -rm -rf ${tunnelTmpDir} -mkdir -p ${tunnelTmpDir} -touch ${tunnelLogFile} - -# Go into temporary tunnel directory. -cd ${tunnelTmpDir} - -# Download the browserstack local binaries. -curl ${tunnelUrl} -o ${tunnelFileName} 2> /dev/null 1> /dev/null - -# Extract the browserstack local binaries from the tarball. -mkdir -p browserstack-tunnel -unzip -q ${tunnelFileName} -d browserstack-tunnel - -# Cleanup the downloaded zip archive. -rm ${tunnelFileName} - -ARGS="" - -if [ ! -z "${CIRCLE_BUILD_NUM}" ]; then - ARGS="${ARGS} --local-identifier angular-material-${CIRCLE_BUILD_NUM}-${CIRCLE_NODE_INDEX}" -fi - -echo "Starting Browserstack Local in the background, logging into: ${tunnelLogFile}" - -# Extension to the BrowserStackLocal binaries, because those can't create a readyfile. -function create_ready_file { - # Process ID for the BrowserStack local asynchronous instance. - tunnelProcessPid=${1} - - # To be able to exit the tail properly we need to have a sub shell spawned, which is - # used to track the state of tail. - { sleep 120; touch ${tunnelErrorFile}; } & - - TIMER_PID=${!} - - # Disown the background process, because we don't want to show any messages when killing - # the timer. - disown - - # When the tail recognizes the `Ctrl-C` log message the BrowserStack Tunnel is up. - { - tail -n0 -f ${tunnelLogFile} --pid ${TIMER_PID} | { sed '/Ctrl/q' && kill -9 ${TIMER_PID}; }; - } &> /dev/null - - echo - echo "BrowserStack Tunnel ready" - - # Create the readyfile and write the PID for BrowserStack Local into it. - echo ${tunnelProcessPid} > ${tunnelReadyFile} -} - -browserstack-tunnel/BrowserStackLocal -k ${BROWSER_STACK_ACCESS_KEY} ${ARGS} 2>&1 >> \ - ${tunnelLogFile} & - -# Wait for the tunnel to be ready and create the readyfile with the Browserstack PID -create_ready_file ${!} & - -# Wait for all sub processes to finish. This ensures that no zombie -# processes are left over. -wait diff --git a/scripts/browserstack/stop-tunnel.sh b/scripts/browserstack/stop-tunnel.sh deleted file mode 100755 index 9fbc0ba435f6..000000000000 --- a/scripts/browserstack/stop-tunnel.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -set -e -o pipefail - -tunnelTmpDir="/tmp/material-browserstack" -tunnelReadyFile="${tunnelTmpDir}/readyfile" - -if [[ ! -f ${tunnelReadyFile} ]]; then - echo "BrowserStack tunnel has not been started. Cannot stop tunnel.." - exit 1 -fi - -echo "Shutting down Browserstack tunnel.." - -# The process id for the BrowserStack local instance is stored inside of the readyfile. -tunnelProcessId=$(cat ${tunnelReadyFile}) - -# Kill the process by using the PID that has been read from the readyfile. Note that -# we cannot use killall because CircleCI base container images don't have it installed. -kill ${tunnelProcessId} - -echo "" -echo "Browserstack tunnel interrupt signal has been sent." diff --git a/scripts/browserstack/wait-tunnel.sh b/scripts/browserstack/wait-tunnel.sh deleted file mode 100755 index 6a7e845b31a1..000000000000 --- a/scripts/browserstack/wait-tunnel.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash - -tunnelTmpDir="/tmp/material-browserstack" -tunnelLogFile="${tunnelTmpDir}/browserstack-local.log" -tunnelReadyFile="${tunnelTmpDir}/readyfile" -tunnelErrorFile="${tunnelTmpDir}/errorfile" - -WAIT_DELAY=30 - -# Method that prints the logfile output of the browserstack tunnel. -printLog() { - echo "Logfile output of Browserstack tunnel (${tunnelLogFile}):" - echo "" - cat ${tunnelLogFile} -} - -# Wait for Connect to be ready before exiting -# Time out if we wait for more than 2 minutes, so the process won't run forever. -let "counter=0" - -# Exit the process if there are errors reported. Print the tunnel log to the console. -if [ -f ${tunnelErrorFile} ]; then - echo - echo "An error occurred while starting the tunnel. See error:" - printLog - exit 5 -fi - -while [ ! -f ${tunnelReadyFile} ]; do - let "counter++" - - # Counter needs to be multiplied by two because the while loop only sleeps a half second. - # This has been made in favor of better progress logging (printing dots every half second) - if [ $counter -gt $[${WAIT_DELAY} * 2] ]; then - echo - echo "Timed out after 2 minutes waiting for tunnel ready file" - printLog - exit 5 - fi - - printf "." - sleep 0.5 -done - -echo "" -echo "Connected to Browserstack" diff --git a/scripts/circleci/run-browserstack-tests.sh b/scripts/circleci/run-browserstack-tests.sh index 7d1173208460..098969ecd46a 100755 --- a/scripts/circleci/run-browserstack-tests.sh +++ b/scripts/circleci/run-browserstack-tests.sh @@ -13,10 +13,6 @@ cd ${projectDir} # Decode access token and make it accessible for child processes. export BROWSER_STACK_ACCESS_KEY=`echo ${BROWSER_STACK_ACCESS_KEY} | rev` -# Start tunnel and wait for it being ready. -./scripts/browserstack/start-tunnel.sh & -./scripts/browserstack/wait-tunnel.sh - # Setup the test platform environment variable that will be read # by the Karma configuration script. export TEST_PLATFORM="browserstack" @@ -24,9 +20,5 @@ export TEST_PLATFORM="browserstack" # Run the unit tests on Browserstack with Karma. yarn gulp ci:test -# Kill the Browserstack tunnel. This is necessary in order to avoid rate-limit -# errors that cause the unit tests to be flaky. -./scripts/browserstack/stop-tunnel.sh - # Wait for all sub processes to terminate properly. wait diff --git a/test/karma.conf.js b/test/karma.conf.js index 0c0840a91c18..f04d48489fd9 100644 --- a/test/karma.conf.js +++ b/test/karma.conf.js @@ -97,7 +97,7 @@ module.exports = config => { browserStack: { project: 'Angular Material Unit Tests', - startTunnel: false, + startTunnel: true, retryLimit: 3, timeout: 1800, video: false, diff --git a/yarn.lock b/yarn.lock index 4f2dabd668a8..b7b788753933 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2861,9 +2861,9 @@ blocking-proxy@^1.0.0: minimist "^1.2.0" bluebird@^3.3.0: - version "3.5.3" - resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.3.tgz#7d01c6f9616c9a51ab0f8c549a79dfe6ec33efa7" - integrity sha512-/qKPUQlaW1OyR51WeCPBvRnAlnZFUJkCSG5HzGnuIqhgyJtF+T94lFnn33eiazjRm2LAHVy2guNnaq48X9SJuw== + version "3.7.2" + resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" + integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== bluebird@~3.4.1: version "3.4.7" @@ -3702,16 +3702,16 @@ colors@1.0.3, colors@1.0.x: resolved "https://registry.yarnpkg.com/colors/-/colors-1.0.3.tgz#0433f44d809680fdeb60ed260f1b0c262e82a40b" integrity sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs= -colors@^1.1.0, colors@^1.1.2: - version "1.3.2" - resolved "https://registry.yarnpkg.com/colors/-/colors-1.3.2.tgz#2df8ff573dfbf255af562f8ce7181d6b971a359b" - integrity sha512-rhP0JSBGYvpcNQj4s5AdShMeE5ahMop96cTeDl/v9qQQm2fYClE2QXZRi8wLzc+GmXSxdIqqbOIAhyObEXDbfQ== - -colors@^1.2.1: +colors@^1.1.0, colors@^1.2.1: version "1.4.0" resolved "https://registry.yarnpkg.com/colors/-/colors-1.4.0.tgz#c50491479d4c1bdaed2c9ced32cf7c7dc2360f78" integrity sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA== +colors@^1.1.2: + version "1.3.2" + resolved "https://registry.yarnpkg.com/colors/-/colors-1.3.2.tgz#2df8ff573dfbf255af562f8ce7181d6b971a359b" + integrity sha512-rhP0JSBGYvpcNQj4s5AdShMeE5ahMop96cTeDl/v9qQQm2fYClE2QXZRi8wLzc+GmXSxdIqqbOIAhyObEXDbfQ== + colors@~1.2.1: version "1.2.5" resolved "https://registry.yarnpkg.com/colors/-/colors-1.2.5.tgz#89c7ad9a374bc030df8013241f68136ed8835afc" @@ -3859,7 +3859,7 @@ connect-history-api-fallback@^1: resolved "https://registry.yarnpkg.com/connect-history-api-fallback/-/connect-history-api-fallback-1.6.0.tgz#8b32089359308d111115d81cad3fceab888f97bc" integrity sha512-e54B99q/OUoH64zYYRf3HBP5z24G38h5D3qXu23JGRoigpX5Ss4r9ZnDk3g0Z8uQC2x2lPaJ+UlWBc1ZWBWdLg== -connect@3.6.6, connect@^3.6.0, connect@^3.6.2: +connect@3.6.6, connect@^3.6.2: version "3.6.6" resolved "https://registry.yarnpkg.com/connect/-/connect-3.6.6.tgz#09eff6c55af7236e137135a72574858b6786f524" integrity sha1-Ce/2xVr3I24TcTWnJXSFi2eG9SQ= @@ -3869,6 +3869,16 @@ connect@3.6.6, connect@^3.6.0, connect@^3.6.2: parseurl "~1.3.2" utils-merge "1.0.1" +connect@^3.6.0: + version "3.7.0" + resolved "https://registry.yarnpkg.com/connect/-/connect-3.7.0.tgz#5d49348910caa5e07a01800b030d0c35f20484f8" + integrity sha512-ZqRXc+tZukToSNmh5C2iWMSoV3X1YUcPbqEM4DkEG5tNQXrQUZCNVGGv3IuicnkMtPfGf3Xtp8WCXs295iQ1pQ== + dependencies: + debug "2.6.9" + finalhandler "1.1.2" + parseurl "~1.3.3" + utils-merge "1.0.1" + console-control-strings@^1.0.0, console-control-strings@~1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" @@ -4291,13 +4301,20 @@ debug@=3.1.0, debug@~3.1.0: dependencies: ms "2.0.0" -debug@^3.0.0, debug@^3.1.0, debug@^3.1.1, debug@^3.2.6: +debug@^3.0.0, debug@^3.1.0, debug@^3.1.1: version "3.2.6" resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ== dependencies: ms "^2.1.1" +debug@^3.2.6: + version "3.2.7" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.7.tgz#72580b7e9145fb39b6676f9c5e5fb100b934179a" + integrity sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ== + dependencies: + ms "^2.1.1" + decamelize-keys@^1.0.0, decamelize-keys@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/decamelize-keys/-/decamelize-keys-1.1.0.tgz#d171a87933252807eb3cb61dc1c1445d078df2d9" @@ -5476,7 +5493,7 @@ finalhandler@1.1.0: statuses "~1.3.1" unpipe "~1.0.0" -finalhandler@~1.1.2: +finalhandler@1.1.2, finalhandler@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.1.2.tgz#b7e7d000ffd11938d0fdb053506f6ebabe9f587d" integrity sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA== @@ -5658,9 +5675,9 @@ flat-cache@^3.0.4: rimraf "^3.0.2" flatted@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.0.tgz#55122b6536ea496b4b44893ee2608141d10d9916" - integrity sha512-R+H8IZclI8AAkSBRQJLVOsxwAoHd6WC40b4QTNWIjzAa6BXOBfQcM587MXDTVPeYaopFNWHUFLx7eNmHDSxMWg== + version "2.0.2" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.2.tgz#4575b21e2bcee7434aa9be662f4b7b5f9c2b5138" + integrity sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA== flatted@^3.1.0: version "3.1.0" @@ -7785,7 +7802,7 @@ kagekiri@^1.0.18: resolved "https://registry.yarnpkg.com/kagekiri/-/kagekiri-1.4.0.tgz#d02825c906f80c59a3c890ec8032d565d6d66cfc" integrity sha512-pYPexgf7jIML67DZGvTasv+smbKHPKh8fC2LyBflAwAwLRyhl9Ti5k3UBlWLOmBHOdvGdVNTnvh9AZNvoxQaAw== -karma-browserstack-launcher@^1.3.0: +karma-browserstack-launcher@^1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/karma-browserstack-launcher/-/karma-browserstack-launcher-1.6.0.tgz#2f6000647073e77ae296653b8830b279669766ef" integrity sha512-Y/UWPdHZkHIVH2To4GWHCTzmrsB6H7PBWy6pw+TWz5sr4HW2mcE+Uj6qWgoVNxvQU1Pfn5LQQzI6EQ65p8QbiQ== @@ -8924,9 +8941,9 @@ mime@^2.2.0: integrity sha512-RZKhC3EmpBchfTGBVb8fb+RL2cWyw/32lshnsETttkBAyAUXSGHxbEJWWRXc751DrIxG1q04b8QwMbAwkRPpUA== mime@^2.3.1: - version "2.4.0" - resolved "https://registry.yarnpkg.com/mime/-/mime-2.4.0.tgz#e051fd881358585f3279df333fe694da0bcffdd6" - integrity sha512-ikBcWwyqXQSHKtciCcctu9YfPbFYZ4+gbHEmE0Q8jzcTYQg5dHCr3g2wwAZjPoJfQVXZq6KXAjpXOTf5/cjT7w== + version "2.4.7" + resolved "https://registry.yarnpkg.com/mime/-/mime-2.4.7.tgz#962aed9be0ed19c91fd7dc2ece5d7f4e89a90d74" + integrity sha512-dhNd1uA2u397uQk3Nv5LM4lm93WYDUXFn3Fu291FJerns4jyTudqhIWe4W04YLy7Uk1tm1Ore04NpjRvQp/NPA== mimic-fn@^1.0.0: version "1.2.0" @@ -10519,16 +10536,16 @@ quick-lru@^4.0.1: resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-4.0.1.tgz#5b8878f113a58217848c6482026c73e1ba57727f" integrity sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g== -range-parser@^1.2.0, range-parser@~1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.0.tgz#f49be6b487894ddc40dcc94a322f611092e00d5e" - integrity sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4= - -range-parser@~1.2.1: +range-parser@^1.2.0, range-parser@~1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031" integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== +range-parser@~1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.0.tgz#f49be6b487894ddc40dcc94a322f611092e00d5e" + integrity sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4= + raw-body@2.4.0: version "2.4.0" resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.4.0.tgz#a1ce6fb9c9bc356ca52e89256ab59059e13d0332"