Skip to content

Commit

Permalink
Fix/ppdsc 2854 flaky tests (#680)
Browse files Browse the repository at this point in the history
* fix(PPDSC-2854): don't set initial time until duration is set

* fix(PPDSC-2854): update baseline warning

* fix(PPDSC-2854): revert yarn lock changes
  • Loading branch information
mstuartf authored Mar 2, 2023
1 parent fa3d006 commit 1528b9a
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 114 deletions.
6 changes: 4 additions & 2 deletions scripts/percy_local.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ if [[ $BRANCH_NAME == "main" ]]; then
exit 1
fi
echo "Running on main, so baseline images will be updated"
read -p "Are you sure you want to update the baselines? (y/n)" updateBaselinesRes
if [[ "$updateBaselinesRes" != "y" ]]; then
exit 1
fi
else
export PERCY_BRANCH="local run by ${USERNAME}"
fi

echo "PERCY_BRANCH=$PERCY_BRANCH"

# ask the user to input their API key
read -p "Enter the API key for the 'newskit-$1' project (you can find this in the Percy UI): " apiKey

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1255,10 +1255,15 @@ describe('Audio Player Composable', () => {
'audio-player-time-display',
) as HTMLParagraphElement;

fireEvent.durationChange(audioElement, {
target: {
duration: 60,
},
});
const seekBar = getByTestId('audio-slider-track') as HTMLDivElement;
fireEvent.timeUpdate(audioElement);
expect(audioElement.currentTime).toEqual(50);
expect(audioTimeLabel.innerHTML).toEqual('00:50/00:00 ');
expect(audioTimeLabel.innerHTML).toEqual('00:50/01:00 ');
expect(seekBar.getAttribute('values')).toEqual('50');
});
});
Expand Down
4 changes: 2 additions & 2 deletions src/audio-player-composable/audio-player-composable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ export const AudioPlayerComposable = ({
// On render onTimeUpdate will be fired and initialTime will be set as a value for currentTime state.
// I can't set this one to the setCurrentTime state directly as the audioElement time
// will still be 0, currentTime will be overridden to 0 and the audio will start from 0
if (audioRef && audioRef.current) {
if (audioRef && audioRef.current && duration) {
audioRef.current.currentTime = initialTime;
}
setCurrentTime(0);
setDisplayDuration(0);
}, [src, initialTime]);
}, [src, initialTime, duration]);

const {
audioEvents,
Expand Down
157 changes: 48 additions & 109 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2646,31 +2646,22 @@
mkdirp "^1.0.4"
rimraf "^3.0.2"

"@percy/[email protected]":
version "1.20.0"
resolved "https://registry.yarnpkg.com/@percy/cli-app/-/cli-app-1.20.0.tgz#6822396655d013abac27f45b6b8d09b04926e93f"
integrity sha512-7DMaNBWpW3MiibVcTH6FzZdE0QKFO5sHz4dyUmNNJ/Uxs3hVHVAEP2BQxU0lOYLW6wM7uumCfsc8ccgWxIsK3Q==
dependencies:
"@percy/cli-command" "1.20.0"
"@percy/cli-exec" "1.20.0"

"@percy/[email protected]":
version "1.20.0"
resolved "https://registry.yarnpkg.com/@percy/cli-build/-/cli-build-1.20.0.tgz#68aa0dad96414dd0e03d2bd09bff16e98198e946"
integrity sha512-TJ1Khk4cUq3yaHm3e7o1kyXlChfKIaGzxSykO5iIfJ4LYmo+DI6qBe8zGBEgxZ7NoABalGCsT3FswwwrF3TRSw==
"@percy/[email protected]":
version "1.11.0"
resolved "https://registry.yarnpkg.com/@percy/cli-app/-/cli-app-1.11.0.tgz#aedf03af91bf66efaf9daacb9ed405c1fdb4376d"
integrity sha512-uZG/38nZYQQvD5mMUckgdHIVvuz/quV6JqEGDMKhDdgehX+Q1csHEeb/PXBGxLny7Ud1+s+8g9ZYm4oca87OTA==
dependencies:
"@percy/cli-command" "1.20.0"
"@percy/cli-command" "1.11.0"
"@percy/cli-exec" "1.11.0"

"@percy/cli-command@1.20.0":
version "1.20.0"
resolved "https://registry.yarnpkg.com/@percy/cli-command/-/cli-command-1.20.0.tgz#48f367162179ff28f514114429cbf4218b6cef32"
integrity sha512-6EWwevC26L4D8IxhGAwPssJyNVw9tTleur9fkX8t0v9gjVctxS4vvuIjThe2Ti8HMk31UkYfPoaIpO6Dss2o1g==
"@percy/cli-build@1.11.0":
version "1.11.0"
resolved "https://registry.yarnpkg.com/@percy/cli-build/-/cli-build-1.11.0.tgz#1a93b96499b3b30adb086ef1f59dacd973d10c04"
integrity sha512-KvWnlP/2crZFCkzkWFIdsBPMeg69Kye23WFe4sLtoAIrid6o7qIwk6285Iijsc4uJm4Y19jgXRR/EsVz5FYUNw==
dependencies:
"@percy/config" "1.20.0"
"@percy/core" "1.20.0"
"@percy/logger" "1.20.0"
"@percy/cli-command" "1.11.0"

"@percy/cli-command@^1.10.4":
"@percy/cli-command@1.11.0", "@percy/cli-command@^1.10.4":
version "1.11.0"
resolved "https://registry.yarnpkg.com/@percy/cli-command/-/cli-command-1.11.0.tgz#db281e2b6d24d9172e0c49aa17d08f6524a7b8a1"
integrity sha512-5f4/FydmLzn82INMzfPhzq43uYBCIQv2ZCHK9hxyfc0qA6VUBc7gY+zwNp7hHgW7nAbWcDMxUqJrF9sts/BfqA==
Expand All @@ -2679,53 +2670,53 @@
"@percy/core" "1.11.0"
"@percy/logger" "1.11.0"

"@percy/cli-config@1.20.0":
version "1.20.0"
resolved "https://registry.yarnpkg.com/@percy/cli-config/-/cli-config-1.20.0.tgz#9e319c5bb1546bf65ec519039fdca27b580f8656"
integrity sha512-JJhhvQXNFIHr2yFgx0KTVoyG+7PLWXAR+Dfh7m8hpmF9I7O2A5IJUuXbVpRmHGNqSoLvQyOto4Dc6UQzNE5TEg==
"@percy/cli-config@1.11.0":
version "1.11.0"
resolved "https://registry.yarnpkg.com/@percy/cli-config/-/cli-config-1.11.0.tgz#9ea8112d8c38f5ae641393707d2d3aa4cc7dca45"
integrity sha512-hKxusrHMkUVn+Hvv/Vjo6SadqFlwXlkLFDGCNE8DvuEsP9YEALUZQq7/i+iQJAC7JuV4UsEnOOKuCTD+rS2xUQ==
dependencies:
"@percy/cli-command" "1.20.0"
"@percy/cli-command" "1.11.0"

"@percy/cli-exec@1.20.0":
version "1.20.0"
resolved "https://registry.yarnpkg.com/@percy/cli-exec/-/cli-exec-1.20.0.tgz#4d1821311f6fefac39a4320700ba093182590026"
integrity sha512-aZqmmAV7YLixpJ/jD2Nh/02n/lsJWI6EA4f27cmtz5E7tAMz/8BwJC2GxzH0J2PZV7Yf73COT5zgCaQFJec5gA==
"@percy/cli-exec@1.11.0":
version "1.11.0"
resolved "https://registry.yarnpkg.com/@percy/cli-exec/-/cli-exec-1.11.0.tgz#4013a632441acb410148501fc5488e39b326c45a"
integrity sha512-y8C6s9q0QOmIuPucFjdn1oeJGiLaOlP55hQHeiXka/J84zBHw6N2vSwEqvdzHH2QY/VHLyIRC9NTBNNISv8ayQ==
dependencies:
"@percy/cli-command" "1.20.0"
"@percy/cli-command" "1.11.0"
cross-spawn "^7.0.3"
which "^2.0.2"

"@percy/cli-snapshot@1.20.0":
version "1.20.0"
resolved "https://registry.yarnpkg.com/@percy/cli-snapshot/-/cli-snapshot-1.20.0.tgz#abf2696b91528dac2ee30739339cfbc3675694d5"
integrity sha512-s5ycpdgJbuxZ/RPjNc3EpJ2DpANza41dqLg7Q6O3kWhtAGhrBQENy7DBzNOYCTpEaDtP0IP53lI6+x7w3VQS5w==
"@percy/cli-snapshot@1.11.0":
version "1.11.0"
resolved "https://registry.yarnpkg.com/@percy/cli-snapshot/-/cli-snapshot-1.11.0.tgz#ef7ba8aca26e03b1da6157e162ab00e87c8d7355"
integrity sha512-PUh6RXg91p0MHKMTv/btIdMjqn5R0KXz32SkKeQ4gVI2bPEWnsK5aeJaPGtpDzrt35cG7wpKtzF0uGmovIKpRg==
dependencies:
"@percy/cli-command" "1.20.0"
"@percy/cli-command" "1.11.0"
yaml "^2.0.0"

"@percy/cli-upload@1.20.0":
version "1.20.0"
resolved "https://registry.yarnpkg.com/@percy/cli-upload/-/cli-upload-1.20.0.tgz#f9fc5000588f7f578607e1097ec8b078505a9c58"
integrity sha512-a1v0CIEo8pfIhs3zM5vIaWexl73Ln0ApAW0vbzv6G33mrX2HAFf3nrnf7vJxBalZ7spPkeTl+61iRrgz0s9/Zg==
"@percy/cli-upload@1.11.0":
version "1.11.0"
resolved "https://registry.yarnpkg.com/@percy/cli-upload/-/cli-upload-1.11.0.tgz#60a85665f8ed6897c88793c70cd66a9476a94a4e"
integrity sha512-oI7zXU6EVukCWPFT3UXxd2XkRGDIGoPkv+beS157WrR+y3i8/zzp9V3r0UIMaL5gbOwY05TBHEogfqZht5hUXQ==
dependencies:
"@percy/cli-command" "1.20.0"
"@percy/cli-command" "1.11.0"
fast-glob "^3.2.11"
image-size "^1.0.0"

"@percy/cli@^1.10.2":
version "1.20.0"
resolved "https://registry.yarnpkg.com/@percy/cli/-/cli-1.20.0.tgz#400bffb290fa91e02e3fe7c263613a8e8f322d62"
integrity sha512-23dfreXNT1PNBzn1f97hpMzD9l86koKPqdUAaXjFqL+iVrxSnq9Dfvw8W7QbChQOEsIjjhdeRkGOFrb1WZLsPg==
dependencies:
"@percy/cli-app" "1.20.0"
"@percy/cli-build" "1.20.0"
"@percy/cli-command" "1.20.0"
"@percy/cli-config" "1.20.0"
"@percy/cli-exec" "1.20.0"
"@percy/cli-snapshot" "1.20.0"
"@percy/cli-upload" "1.20.0"
"@percy/client" "1.20.0"
"@percy/logger" "1.20.0"
version "1.11.0"
resolved "https://registry.yarnpkg.com/@percy/cli/-/cli-1.11.0.tgz#68709ebc4ea1ccddce607374c61d1ad9c9a2a44c"
integrity sha512-V6tIghu70uO1jQY6AJSbll6GMFZ26jkubgAnK4+KWa4g3hYRra7JvsSYkLlOE93x9L7Z7ZUbSTfhlpXGmh2UFA==
dependencies:
"@percy/cli-app" "1.11.0"
"@percy/cli-build" "1.11.0"
"@percy/cli-command" "1.11.0"
"@percy/cli-config" "1.11.0"
"@percy/cli-exec" "1.11.0"
"@percy/cli-snapshot" "1.11.0"
"@percy/cli-upload" "1.11.0"
"@percy/client" "1.11.0"
"@percy/logger" "1.11.0"

"@percy/[email protected]":
version "1.11.0"
Expand All @@ -2735,14 +2726,6 @@
"@percy/env" "1.11.0"
"@percy/logger" "1.11.0"

"@percy/[email protected]":
version "1.20.0"
resolved "https://registry.yarnpkg.com/@percy/client/-/client-1.20.0.tgz#d899d7272fdbaf19640d431021831fb8c4fa4f47"
integrity sha512-x1iDqx3oCOHSdCP8TX4EZehNbjXFQFq6RhPmLIt8L8ZkNi+ugXPVc4J32evLw7dM+zwgVxXJvF4cwPYkHkOrFw==
dependencies:
"@percy/env" "1.20.0"
"@percy/logger" "1.20.0"

"@percy/[email protected]":
version "1.11.0"
resolved "https://registry.yarnpkg.com/@percy/config/-/config-1.11.0.tgz#35b335fd2698c39652a0688b7b4fc016336121cf"
Expand All @@ -2753,16 +2736,6 @@
cosmiconfig "^7.0.0"
yaml "^2.0.0"

"@percy/[email protected]":
version "1.20.0"
resolved "https://registry.yarnpkg.com/@percy/config/-/config-1.20.0.tgz#56c5b58b42d2d6374dc8c3087388e49fe89b5e62"
integrity sha512-2PlcF7OIEaX4sXtw4Wa+dxy3U6QcWWcrPFSa6W2hxJ8WplnO0UwYMq+PbJ/lP47LWURDvPgLNxyYrywQLe1NHg==
dependencies:
"@percy/logger" "1.20.0"
ajv "^8.6.2"
cosmiconfig "^7.0.0"
yaml "^2.0.0"

"@percy/[email protected]":
version "1.11.0"
resolved "https://registry.yarnpkg.com/@percy/core/-/core-1.11.0.tgz#20d7068e37be4a7fda2cd7f10971eeab878d8e7a"
Expand All @@ -2782,25 +2755,6 @@
rimraf "^3.0.2"
ws "^8.0.0"

"@percy/[email protected]":
version "1.20.0"
resolved "https://registry.yarnpkg.com/@percy/core/-/core-1.20.0.tgz#f589b57d29c37557fa38d1282ac794435cba6095"
integrity sha512-zb9W5udAnyr3BOMN3vDiWs/BEhgfY5zH4bUapw99zUxu19+/ipt31EWooI911CqxbHwoFtqr+o7JtIYmnICT6g==
dependencies:
"@percy/client" "1.20.0"
"@percy/config" "1.20.0"
"@percy/dom" "1.20.0"
"@percy/logger" "1.20.0"
content-disposition "^0.5.4"
cross-spawn "^7.0.3"
extract-zip "^2.0.1"
fast-glob "^3.2.11"
micromatch "^4.0.4"
mime-types "^2.1.34"
path-to-regexp "^6.2.0"
rimraf "^3.0.2"
ws "^8.0.0"

"@percy/cypress@^3.1.2":
version "3.1.2"
resolved "https://registry.yarnpkg.com/@percy/cypress/-/cypress-3.1.2.tgz#a087d3c59a6b155eab5fdb4c237526b9cfacbc22"
Expand All @@ -2813,40 +2767,25 @@
resolved "https://registry.yarnpkg.com/@percy/dom/-/dom-1.11.0.tgz#998080c3c3b5160eb1c58e8543ebb89ed0ca63a1"
integrity sha512-WNbMcMTy+HaSWGmW20NArG+nUnTMYcjCsLK1m3RqXvLSQMEH16olUV5YSIRV8YCPD/L6/2gZ8/YgV7bnKbFzxQ==

"@percy/[email protected]":
version "1.20.0"
resolved "https://registry.yarnpkg.com/@percy/dom/-/dom-1.20.0.tgz#3b1f5c35b41d3d5134687d7c32283ed34f54c8d5"
integrity sha512-DA1kWILeoYxTF2H8J36ILH2GGcFpfFDaOrFMjQUvXMMkkEivxNR+dcemIlqphma+HDI2UuGnSXs4MQQ33MGXOQ==

"@percy/[email protected]":
version "1.11.0"
resolved "https://registry.yarnpkg.com/@percy/env/-/env-1.11.0.tgz#002cc369d93a4cf9a8ceb2e71aa7cbc2d5faa288"
integrity sha512-aiAjyQUJlDinwCyxr9bujZY/BjyaIY0s5jfW2j3C+1HJ4uDi7CN1qb/+TqBhMO/2AEjR4eLIGRpBE3xSyO+Liw==

"@percy/[email protected]":
version "1.20.0"
resolved "https://registry.yarnpkg.com/@percy/env/-/env-1.20.0.tgz#7b603bf007172b1b18277f06eca61db9602b9d59"
integrity sha512-hk/tPi+e7O0uF3FOOaMXYzA/7Gp0kBcYkYOOHL18/XrpETfBm8uXcP/26FrENdwSAH1nM/bu873NVgeS4pMECw==

"@percy/[email protected]":
version "1.11.0"
resolved "https://registry.yarnpkg.com/@percy/logger/-/logger-1.11.0.tgz#0decfb64bd399925b8a4edbe1dc17186bb631e00"
integrity sha512-CQZRvOmp67VFIx9hYN6Z9cMCU8oAqwG/3CpWnvpyUmWWIbzuVmwA4dk2F8AOnAXADtr09jVhN60sPzqhliQFRQ==

"@percy/[email protected]":
version "1.20.0"
resolved "https://registry.yarnpkg.com/@percy/logger/-/logger-1.20.0.tgz#c2a58ad29d52996d9fea579e248856e666de35ee"
integrity sha512-x76tOiB/m6GnND9KQ4Fjm+hl7l1NlITuveNWYuSS8Z2euqiggBAXdRuNSqV/oLR4UfgfiY6vYb7ENVpo9G33Iw==

"@percy/sdk-utils@^1.3.1":
version "1.11.0"
resolved "https://registry.yarnpkg.com/@percy/sdk-utils/-/sdk-utils-1.11.0.tgz#a1cdb26c3bf579bda18a94045aa731e82732494f"
integrity sha512-X0c1wgtmZ8/+73rNNdTVVdSeKZgDuq8HBP0TMNvbjyc2wuFjLxNuhV7BAqMjmP9d0mncvSfroYI3jbGaGfIJNA==

"@percy/storybook@^4.3.3":
version "4.3.5"
resolved "https://registry.yarnpkg.com/@percy/storybook/-/storybook-4.3.5.tgz#e1cf22afb6bed99f0ebf8f8f3a4a95c1cbbcca0b"
integrity sha512-b8zZ933R0e+5rTTeAtDDGKpl39vVj57RiMg9QWxJtO07TdXx8AhnEqzIj7lmkKb+5cYD8onQ/UFAAOG8gQ87AA==
version "4.3.4"
resolved "https://registry.yarnpkg.com/@percy/storybook/-/storybook-4.3.4.tgz#37bd1802a3dde607afdfc17a85930c447149f938"
integrity sha512-PIGf6X+rnKJRZaUqMzATKC1zLN2wT8min8YEDU4fKFDhQlx0yTQhgOeiwbw2wmhbc5Ge0U5TqMBrlOuYxuPmvg==
dependencies:
"@percy/cli-command" "^1.10.4"
cross-spawn "^7.0.3"
Expand Down

0 comments on commit 1528b9a

Please sign in to comment.