Merge remote-tracking branch 'origin/develop' into release/2022-06-08

This commit is contained in:
picklesrus 2022-06-08 17:35:48 +00:00
commit cc229a28f1
11 changed files with 201 additions and 143 deletions

120
package-lock.json generated
View file

@ -28,7 +28,7 @@
"@formatjs/intl-locale": "2.4.34",
"@formatjs/intl-pluralrules": "4.1.0",
"@formatjs/intl-relativetimeformat": "8.1.8",
"async": "3.1.0",
"async": "3.2.2",
"autoprefixer": "10.4.2",
"babel-cli": "6.26.0",
"babel-core": "6.26.3",
@ -99,8 +99,8 @@
"regenerator-runtime": "0.13.9",
"sass": "1.49.7",
"sass-loader": "10.2.1",
"scratch-gui": "0.1.0-prerelease.20220601144935",
"scratch-l10n": "3.14.20220601031612",
"scratch-gui": "0.1.0-prerelease.20220605140952",
"scratch-l10n": "3.14.20220605031627",
"selenium-webdriver": "4.1.0",
"slick-carousel": "1.6.0",
"style-loader": "0.12.3",
@ -2638,9 +2638,9 @@
}
},
"node_modules/async": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/async/-/async-3.1.0.tgz",
"integrity": "sha512-4vx/aaY6j/j3Lw3fbCHNWP0pPaTCew3F6F3hYyl/tHs/ndmV1q7NW9T5yuJ2XAGwdQrP+6Wu20x06U4APo/iQQ==",
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/async/-/async-3.2.2.tgz",
"integrity": "sha512-H0E+qZaDEfx/FY4t7iLRv1W2fFI6+pyCeTw1uN20AQPiwqwM6ojPxHxdLv4z8hi2DtnW9BOckSspLucW7pIE5g==",
"dev": true
},
"node_modules/async-each": {
@ -22878,9 +22878,9 @@
}
},
"node_modules/scratch-gui": {
"version": "0.1.0-prerelease.20220601144935",
"resolved": "https://registry.npmjs.org/scratch-gui/-/scratch-gui-0.1.0-prerelease.20220601144935.tgz",
"integrity": "sha512-3O4E3DR9NhyvOHRkks1zKsTpP8rxxwzJX7ZGxNu9QFf+/nUiWrWa7CTOf2Ex5foiLBrTa0fUNWtYjR432+aQJA==",
"version": "0.1.0-prerelease.20220605140952",
"resolved": "https://registry.npmjs.org/scratch-gui/-/scratch-gui-0.1.0-prerelease.20220605140952.tgz",
"integrity": "sha512-BSYEB10tQx9Y58ERV33CSOAbsLxz+7THzMUN3+QPlKu6lFoK6yB4n9o47A8WFHUiCEoT/J8HWh8juWl88Ic2Sw==",
"dev": true,
"dependencies": {
"arraybuffer-loader": "^1.0.6",
@ -22932,13 +22932,13 @@
"redux-throttle": "0.1.1",
"scratch-audio": "0.1.0-prerelease.20200528195344",
"scratch-blocks": "0.1.0-prerelease.20220524062105",
"scratch-l10n": "3.14.20220601031612",
"scratch-paint": "0.2.0-prerelease.20220530095633",
"scratch-l10n": "3.14.20220605031627",
"scratch-paint": "0.2.0-prerelease.20220605112441",
"scratch-render": "0.1.0-prerelease.20211028200436",
"scratch-render-fonts": "1.0.0-prerelease.20210401210003",
"scratch-storage": "2.0.2",
"scratch-svg-renderer": "0.2.0-prerelease.20210727023023",
"scratch-vm": "0.2.0-prerelease.20220601111129",
"scratch-vm": "0.2.0-prerelease.20220602121716",
"startaudiocontext": "1.2.1",
"style-loader": "^0.23.0",
"text-encoding": "0.7.0",
@ -23228,9 +23228,9 @@
}
},
"node_modules/scratch-gui/node_modules/scratch-paint": {
"version": "0.2.0-prerelease.20220530095633",
"resolved": "https://registry.npmjs.org/scratch-paint/-/scratch-paint-0.2.0-prerelease.20220530095633.tgz",
"integrity": "sha512-jEGvWClwkRyyzq+tH6utI2rdbwZn1a2CjDtIdZM9rCeJ1f88RiZucpdS68xexK5asLurfveaJMif69K3T7wX/g==",
"version": "0.2.0-prerelease.20220605112441",
"resolved": "https://registry.npmjs.org/scratch-paint/-/scratch-paint-0.2.0-prerelease.20220605112441.tgz",
"integrity": "sha512-GgwKhp+yDJNQLbpykw3J5JUgCptgfDW66JObuTLpVDlRUVtbV9eamSuIdUWLgVrbTXVUtfHQT2z1KMi31t4thg==",
"dev": true,
"dependencies": {
"@scratch/paper": "0.11.20200728195508",
@ -23330,9 +23330,9 @@
}
},
"node_modules/scratch-l10n": {
"version": "3.14.20220601031612",
"resolved": "https://registry.npmjs.org/scratch-l10n/-/scratch-l10n-3.14.20220601031612.tgz",
"integrity": "sha512-x5IhyAjNKKC2CIg973jDhrSdHnD6VV8/94HVLwnyqjxsSQVCY+jU1omenXk/hFzOsyZn10FhaNpqYQbmD5oAFQ==",
"version": "3.14.20220605031627",
"resolved": "https://registry.npmjs.org/scratch-l10n/-/scratch-l10n-3.14.20220605031627.tgz",
"integrity": "sha512-uVnAOlyiZrNL52ltFRJvDQTVuSnXl+TxWrxQP99I1kpZsokHuh7/NXczw+tDdbM0oiaY1D8FMi49KXPIFolMpQ==",
"dev": true,
"dependencies": {
"@babel/cli": "^7.1.2",
@ -23528,9 +23528,9 @@
"dev": true
},
"node_modules/scratch-vm": {
"version": "0.2.0-prerelease.20220601111129",
"resolved": "https://registry.npmjs.org/scratch-vm/-/scratch-vm-0.2.0-prerelease.20220601111129.tgz",
"integrity": "sha512-NMfIbpvxNwODCU2oWpn+P0FUTbP0Fd1vIsPDOov6sPAFUtdnU6f/I/OPtKO+kKL0Jn+p7i+8GXsDIW3ffsJmbw==",
"version": "0.2.0-prerelease.20220602121716",
"resolved": "https://registry.npmjs.org/scratch-vm/-/scratch-vm-0.2.0-prerelease.20220602121716.tgz",
"integrity": "sha512-N7hY2OeMJMybH1GdYwxaj+zu8BUBsiDUCmA0o3UsrVVsKCxcPgHQxJYksWalH1zV3GsWlkXwX6qBarviRmVfbg==",
"dev": true,
"dependencies": {
"@vernier/godirect": "1.5.0",
@ -33686,9 +33686,9 @@
"dev": true
},
"async": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/async/-/async-3.1.0.tgz",
"integrity": "sha512-4vx/aaY6j/j3Lw3fbCHNWP0pPaTCew3F6F3hYyl/tHs/ndmV1q7NW9T5yuJ2XAGwdQrP+6Wu20x06U4APo/iQQ==",
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/async/-/async-3.2.2.tgz",
"integrity": "sha512-H0E+qZaDEfx/FY4t7iLRv1W2fFI6+pyCeTw1uN20AQPiwqwM6ojPxHxdLv4z8hi2DtnW9BOckSspLucW7pIE5g==",
"dev": true
},
"async-each": {
@ -38367,9 +38367,9 @@
},
"dependencies": {
"ansi-regex": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",
"integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=",
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.1.tgz",
"integrity": "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==",
"dev": true
},
"ansi-styles": {
@ -42924,9 +42924,9 @@
},
"dependencies": {
"ansi-regex": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",
"integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=",
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.1.tgz",
"integrity": "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==",
"dev": true
},
"cliui": {
@ -42962,9 +42962,9 @@
},
"dependencies": {
"ansi-regex": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",
"integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=",
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.1.tgz",
"integrity": "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==",
"dev": true
},
"ansi-styles": {
@ -43844,9 +43844,9 @@
},
"dependencies": {
"ansi-regex": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",
"integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=",
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.1.tgz",
"integrity": "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==",
"dev": true
},
"ansi-styles": {
@ -47837,9 +47837,9 @@
},
"dependencies": {
"ansi-regex": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",
"integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=",
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.1.tgz",
"integrity": "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==",
"dev": true
},
"ansi-styles": {
@ -50769,9 +50769,9 @@
}
},
"scratch-gui": {
"version": "0.1.0-prerelease.20220601144935",
"resolved": "https://registry.npmjs.org/scratch-gui/-/scratch-gui-0.1.0-prerelease.20220601144935.tgz",
"integrity": "sha512-3O4E3DR9NhyvOHRkks1zKsTpP8rxxwzJX7ZGxNu9QFf+/nUiWrWa7CTOf2Ex5foiLBrTa0fUNWtYjR432+aQJA==",
"version": "0.1.0-prerelease.20220605140952",
"resolved": "https://registry.npmjs.org/scratch-gui/-/scratch-gui-0.1.0-prerelease.20220605140952.tgz",
"integrity": "sha512-BSYEB10tQx9Y58ERV33CSOAbsLxz+7THzMUN3+QPlKu6lFoK6yB4n9o47A8WFHUiCEoT/J8HWh8juWl88Ic2Sw==",
"dev": true,
"requires": {
"arraybuffer-loader": "^1.0.6",
@ -50823,13 +50823,13 @@
"redux-throttle": "0.1.1",
"scratch-audio": "0.1.0-prerelease.20200528195344",
"scratch-blocks": "0.1.0-prerelease.20220524062105",
"scratch-l10n": "3.14.20220601031612",
"scratch-paint": "0.2.0-prerelease.20220530095633",
"scratch-l10n": "3.14.20220605031627",
"scratch-paint": "0.2.0-prerelease.20220605112441",
"scratch-render": "0.1.0-prerelease.20211028200436",
"scratch-render-fonts": "1.0.0-prerelease.20210401210003",
"scratch-storage": "2.0.2",
"scratch-svg-renderer": "0.2.0-prerelease.20210727023023",
"scratch-vm": "0.2.0-prerelease.20220601111129",
"scratch-vm": "0.2.0-prerelease.20220602121716",
"startaudiocontext": "1.2.1",
"style-loader": "^0.23.0",
"text-encoding": "0.7.0",
@ -51065,9 +51065,9 @@
}
},
"scratch-paint": {
"version": "0.2.0-prerelease.20220530095633",
"resolved": "https://registry.npmjs.org/scratch-paint/-/scratch-paint-0.2.0-prerelease.20220530095633.tgz",
"integrity": "sha512-jEGvWClwkRyyzq+tH6utI2rdbwZn1a2CjDtIdZM9rCeJ1f88RiZucpdS68xexK5asLurfveaJMif69K3T7wX/g==",
"version": "0.2.0-prerelease.20220605112441",
"resolved": "https://registry.npmjs.org/scratch-paint/-/scratch-paint-0.2.0-prerelease.20220605112441.tgz",
"integrity": "sha512-GgwKhp+yDJNQLbpykw3J5JUgCptgfDW66JObuTLpVDlRUVtbV9eamSuIdUWLgVrbTXVUtfHQT2z1KMi31t4thg==",
"dev": true,
"requires": {
"@scratch/paper": "0.11.20200728195508",
@ -51148,9 +51148,9 @@
}
},
"scratch-l10n": {
"version": "3.14.20220601031612",
"resolved": "https://registry.npmjs.org/scratch-l10n/-/scratch-l10n-3.14.20220601031612.tgz",
"integrity": "sha512-x5IhyAjNKKC2CIg973jDhrSdHnD6VV8/94HVLwnyqjxsSQVCY+jU1omenXk/hFzOsyZn10FhaNpqYQbmD5oAFQ==",
"version": "3.14.20220605031627",
"resolved": "https://registry.npmjs.org/scratch-l10n/-/scratch-l10n-3.14.20220605031627.tgz",
"integrity": "sha512-uVnAOlyiZrNL52ltFRJvDQTVuSnXl+TxWrxQP99I1kpZsokHuh7/NXczw+tDdbM0oiaY1D8FMi49KXPIFolMpQ==",
"dev": true,
"requires": {
"@babel/cli": "^7.1.2",
@ -51340,9 +51340,9 @@
"dev": true
},
"scratch-vm": {
"version": "0.2.0-prerelease.20220601111129",
"resolved": "https://registry.npmjs.org/scratch-vm/-/scratch-vm-0.2.0-prerelease.20220601111129.tgz",
"integrity": "sha512-NMfIbpvxNwODCU2oWpn+P0FUTbP0Fd1vIsPDOov6sPAFUtdnU6f/I/OPtKO+kKL0Jn+p7i+8GXsDIW3ffsJmbw==",
"version": "0.2.0-prerelease.20220602121716",
"resolved": "https://registry.npmjs.org/scratch-vm/-/scratch-vm-0.2.0-prerelease.20220602121716.tgz",
"integrity": "sha512-N7hY2OeMJMybH1GdYwxaj+zu8BUBsiDUCmA0o3UsrVVsKCxcPgHQxJYksWalH1zV3GsWlkXwX6qBarviRmVfbg==",
"dev": true,
"requires": {
"@vernier/godirect": "1.5.0",
@ -52529,9 +52529,9 @@
},
"dependencies": {
"ansi-regex": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",
"integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=",
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.1.tgz",
"integrity": "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==",
"dev": true
},
"strip-ansi": {
@ -52583,9 +52583,9 @@
},
"dependencies": {
"ansi-regex": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",
"integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=",
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.1.tgz",
"integrity": "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==",
"dev": true
},
"strip-ansi": {

View file

@ -63,7 +63,7 @@
"@formatjs/intl-locale": "2.4.34",
"@formatjs/intl-pluralrules": "4.1.0",
"@formatjs/intl-relativetimeformat": "8.1.8",
"async": "3.1.0",
"async": "3.2.2",
"autoprefixer": "10.4.2",
"babel-cli": "6.26.0",
"babel-core": "6.26.3",
@ -134,8 +134,8 @@
"regenerator-runtime": "0.13.9",
"sass": "1.49.7",
"sass-loader": "10.2.1",
"scratch-gui": "0.1.0-prerelease.20220601144935",
"scratch-l10n": "3.14.20220601031612",
"scratch-gui": "0.1.0-prerelease.20220605140952",
"scratch-l10n": "3.14.20220605031627",
"selenium-webdriver": "4.1.0",
"slick-carousel": "1.6.0",
"style-loader": "0.12.3",

View file

@ -43,6 +43,10 @@
border-radius: 4px;
width: 32px;
height: 32px;
display: block;
overflow: hidden;
text-indent: 100%;
white-space: nowrap;
}
}

View file

@ -11,9 +11,19 @@ class Storage extends ScratchStorage {
super();
this.addWebSource(
[this.AssetType.Project],
projectAsset => `${PROJECT_HOST}/${projectAsset.assetId}`
this.getProjectGetConfig.bind(this)
);
}
setProjectToken (projectToken) {
this.projectToken = projectToken;
}
getProjectGetConfig (projectAsset) {
const path = `${PROJECT_HOST}/${projectAsset.assetId}`;
const qs = this.projectToken ? `?token=${this.projectToken}` : '';
return path + qs;
}
}
const storage = new Storage();

View file

@ -73,6 +73,7 @@
.comment {
position: relative;
width: 100%;
flex-direction: row;
flex-wrap: nowrap;
justify-content: space-between;
align-items: flex-start;
@ -98,6 +99,7 @@
.comment-top-row {
margin-bottom: 8px;
width: 100%;
flex-direction: row;
.username {
margin-right: auto;
@ -237,6 +239,7 @@
.comment-bottom-row {
padding-top: 1rem;
font-size: .75rem;
flex-direction: row;
justify-content: space-between;
.comment-time {
@ -265,6 +268,11 @@
.replies {
width: calc(100% - 4rem);
.comment-reply-row {
margin-left: -3.5rem;
width: calc(100% + 3.5rem);
}
}
.replies.collapsed > .comment:last-of-type {
@ -303,7 +311,7 @@
margin-top: 2rem;
margin-bottom: .5rem;
margin-left: .5rem;
width: 100%;
width: calc(100% - 0.5rem);
}
.expand-thread {

View file

@ -40,19 +40,23 @@ class EmbedView extends React.Component {
);
}
return (
<React.Fragment>
<Meta projectInfo={this.props.projectInfo} />
<IntlGUI
assetHost={this.props.assetHost}
basePath="/"
className="gui"
projectHost={this.props.projectHost}
projectId={this.state.projectId}
projectTitle={this.props.projectInfo.title}
/>
</React.Fragment>
);
if (this.props.projectInfo && this.props.projectInfo.project_token){
return (
<React.Fragment>
<Meta projectInfo={this.props.projectInfo} />
<IntlGUI
assetHost={this.props.assetHost}
basePath="/"
className="gui"
projectHost={this.props.projectHost}
projectId={this.state.projectId}
projectTitle={this.props.projectInfo.title}
projectToken={this.props.projectInfo.project_token}
/>
</React.Fragment>
);
}
return null;
}
}

View file

@ -359,6 +359,7 @@ const PreviewPresentation = ({
isFullScreen={isFullScreen}
previewInfoVisible="false"
projectHost={projectHost}
projectToken={projectInfo.project_token}
projectId={projectId}
onGreenFlag={onGreenFlag}
onProjectLoaded={onProjectLoaded}

View file

@ -235,10 +235,6 @@ $stage-width: 480px;
width: 100%;
}
.comment, .comment-top-row, .comment-bottom-row {
flex-direction: row;
}
.comment-bubble {
text-align: left;
}

View file

@ -142,7 +142,6 @@ class Preview extends React.Component {
this.props.sessionStatus === sessionActions.Status.FETCHED) ||
(this.state.projectId !== prevState.projectId))) {
this.fetchCommunityData();
this.getProjectData(this.state.projectId, true /* Show cloud/username alerts */);
if (this.state.justShared) {
this.setState({ // eslint-disable-line react/no-did-update-set-state
justShared: false
@ -158,6 +157,10 @@ class Preview extends React.Component {
});
}
}
if (this.props.projectInfo.id !== prevProps.projectInfo.id) {
storage.setProjectToken(this.props.projectInfo.project_token);
this.loadProjectData(this.state.projectId, true /* Show cloud/username alerts */);
}
if (this.props.projectInfo.id !== prevProps.projectInfo.id) {
if (typeof this.props.projectInfo.id === 'undefined') {
this.initCounts(0, 0);
@ -196,7 +199,8 @@ class Preview extends React.Component {
// Switching out of editor mode, refresh data that comes from project json
if (this.props.playerMode && !prevProps.playerMode) {
this.getProjectData(
storage.setProjectToken(this.props.projectInfo.project_token);
this.loadProjectData(
this.state.projectId,
false // Do not show cloud/username alerts again
);
@ -323,7 +327,7 @@ class Preview extends React.Component {
}
}
}
getProjectData (projectId, showAlerts) {
loadProjectData (projectId, showAlerts) {
if (projectId <= 0) return 0;
storage
.load(storage.AssetType.Project, projectId, storage.DataFormat.JSON)
@ -713,6 +717,11 @@ class Preview extends React.Component {
);
}
render () {
// Only show GUI if the project has no id, is a loaded local project, or has the project token loaded
const showGUI = (!this.state.projectId || this.state.projectId === '0' || this.state.isProjectLoaded ||
(this.props.projectInfo && this.props.projectInfo.project_token));
if (this.props.projectNotAvailable || this.state.invalidProject) {
return (
<Page>
@ -829,43 +838,46 @@ class Preview extends React.Component {
/>
</Page> :
<React.Fragment>
<IntlGUI
assetHost={this.props.assetHost}
authorId={this.props.authorId}
authorThumbnailUrl={this.props.authorThumbnailUrl}
authorUsername={this.props.authorUsername}
backpackHost={this.props.backpackHost}
backpackVisible={this.props.canUseBackpack}
basePath="/"
canCreateCopy={this.props.canCreateCopy}
canCreateNew={this.props.canCreateNew}
canEditTitle={this.props.canEditTitleInEditor}
canRemix={this.props.canRemix}
canSave={this.props.canSave}
canShare={this.props.canShare}
className="gui"
cloudHost={this.props.cloudHost}
enableCommunity={this.props.enableCommunity}
hasCloudPermission={this.props.isScratcher}
isShared={this.props.isShared}
projectHost={this.props.projectHost}
projectId={this.state.projectId}
projectTitle={this.props.projectInfo.title}
renderLogin={this.renderLogin}
onClickLogo={this.handleClickLogo}
onGreenFlag={this.handleGreenFlag}
onLogOut={this.props.handleLogOut}
onOpenRegistration={this.props.handleOpenRegistration}
onProjectLoaded={this.handleProjectLoaded}
onRemixing={this.handleIsRemixing}
onSetLanguage={this.handleSetLanguage}
onShare={this.handleShare}
onToggleLoginOpen={this.props.handleToggleLoginOpen}
onUpdateProjectData={this.handleUpdateProjectData}
onUpdateProjectId={this.handleUpdateProjectId}
onUpdateProjectThumbnail={this.props.handleUpdateProjectThumbnail}
onUpdateProjectTitle={this.handleUpdateProjectTitle}
/>
{showGUI && (
<IntlGUI
assetHost={this.props.assetHost}
authorId={this.props.authorId}
authorThumbnailUrl={this.props.authorThumbnailUrl}
authorUsername={this.props.authorUsername}
backpackHost={this.props.backpackHost}
backpackVisible={this.props.canUseBackpack}
basePath="/"
canCreateCopy={this.props.canCreateCopy}
canCreateNew={this.props.canCreateNew}
canEditTitle={this.props.canEditTitleInEditor}
canRemix={this.props.canRemix}
canSave={this.props.canSave}
canShare={this.props.canShare}
className="gui"
cloudHost={this.props.cloudHost}
enableCommunity={this.props.enableCommunity}
hasCloudPermission={this.props.isScratcher}
isShared={this.props.isShared}
projectHost={this.props.projectHost}
projectToken={this.props.projectInfo.project_token}
projectId={this.state.projectId}
projectTitle={this.props.projectInfo.title}
renderLogin={this.renderLogin}
onClickLogo={this.handleClickLogo}
onGreenFlag={this.handleGreenFlag}
onLogOut={this.props.handleLogOut}
onOpenRegistration={this.props.handleOpenRegistration}
onProjectLoaded={this.handleProjectLoaded}
onRemixing={this.handleIsRemixing}
onSetLanguage={this.handleSetLanguage}
onShare={this.handleShare}
onToggleLoginOpen={this.props.handleToggleLoginOpen}
onUpdateProjectData={this.handleUpdateProjectData}
onUpdateProjectId={this.handleUpdateProjectId}
onUpdateProjectThumbnail={this.props.handleUpdateProjectThumbnail}
onUpdateProjectTitle={this.handleUpdateProjectTitle}
/>
)}
{this.props.registrationOpen && (
this.props.useScratch3Registration ? (
<Scratch3Registration

View file

@ -31,5 +31,6 @@ export const projectShape = shape({
remix: shape({
parent: number,
root: number
})
}),
project_token: string
});

View file

@ -39,6 +39,8 @@ let ownedUnsharedScratch2Url = rootUrl + '/projects/' + ownedUnsharedScratch2ID;
let username = process.env.SMOKE_USERNAME + '6';
let password = process.env.SMOKE_PASSWORD;
const remote = process.env.SMOKE_REMOTE || false;
jest.setTimeout(60000);
let driver;
@ -189,6 +191,14 @@ describe('www-integration project-creation signed in', () => {
await driver.sleep(1000);
await signIn(username, password);
await findByXpath('//span[contains(@class, "profile-name")]');
// SauceLabs doesn't have access to the sb3 used in 'load project from file' test
// https://support.saucelabs.com/hc/en-us/articles/115003685593-Uploading-Files-to-a-Sauce-Labs-Virtual-Machine-during-a-Test
if (remote) {
await driver.get('https://github.com/LLK/scratch-www/blob/develop/test/fixtures/project1.sb3');
await clickText('Download');
await driver.sleep(3000);
}
});
beforeEach(async () => {
@ -197,26 +207,6 @@ describe('www-integration project-creation signed in', () => {
afterAll(async () => await driver.quit());
test.skip('load project from file', async () => {
await clickXpath('//li[@class="link create"]');
let gf = await findByXpath('//img[@class="green-flag_green-flag_1kiAo"]');
await gf.isDisplayed();
await clickText('File');
await clickText('Load from your computer');
const input = await findByXpath('//input[@accept=".sb,.sb2,.sb3"]');
await input.sendKeys(path.resolve(__dirname, '../fixtures/project1.sb3'));
await driver.sleep(200);
let alert = await driver.switchTo().alert();
await alert.accept();
let spriteTile = await findText('project1-sprite');
let spriteTileVisible = await spriteTile.isDisplayed();
await expect(spriteTileVisible).toBe(true);
await driver.sleep(1000);
let infoArea = await findByXpath('//div[@class="sprite-info_sprite-info_3EyZh box_box_2jjDp"]');
let areaVisible = await infoArea.isDisplayed();
await expect(areaVisible).toBe(true);
});
test('make a copy of a project', async () => {
await driver.get(ownedUnsharedUrl + '/editor');
let gf = await findByXpath('//img[@class="green-flag_green-flag_1kiAo"]');
@ -245,4 +235,36 @@ describe('www-integration project-creation signed in', () => {
let areaVisible = await infoArea.isDisplayed();
await expect(areaVisible).toBe(true);
});
test('load project from file', async () => {
// if remote, projectPath is Saucelabs path to downloaded file
const projectPath = remote ?
'/Users/chef/Downloads/project1.sb3' :
path.resolve(__dirname, '../fixtures/project1.sb3');
// upload file
await clickXpath('//li[@class="link create"]');
let gf = await findByXpath('//img[@class="green-flag_green-flag_1kiAo"]');
await gf.isDisplayed();
await clickText('File');
await clickText('Load from your computer');
await driver.sleep(1000);
const input = await findByXpath('//input[@accept=".sb,.sb2,.sb3"]');
await input.sendKeys(projectPath);
// accept alert
let alert = await driver.switchTo().alert();
await alert.accept();
// check that project is loaded
let spriteTile = await findText('project1-sprite');
let spriteTileVisible = await spriteTile.isDisplayed();
await expect(spriteTileVisible).toBe(true);
// check that gui is still there after some time has passed
await driver.sleep(1000);
let infoArea = await findByXpath('//div[@class="sprite-info_sprite-info_3EyZh box_box_2jjDp"]');
let areaVisible = await infoArea.isDisplayed();
await expect(areaVisible).toBe(true);
});
});