Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problems with screens query parameter #171

Closed
loganbraywork opened this issue Jul 17, 2020 · 19 comments
Closed

problems with screens query parameter #171

loganbraywork opened this issue Jul 17, 2020 · 19 comments
Assignees
Labels

Comments

@loganbraywork
Copy link

Test device

Windows 10 laptop

Operating System

Windows 10 v.1903

Browser

Chrome v. 84.0.4147.89

Problem description

For phetsims/qa#515

When using the multiple screens query parameter, it is possible to create a home screen where none previously existed when using the command screens=2,1. A box does come up saying screen 2 is invalid, but a home screen appears with Macro appearing twice.

Steps to reproduce

  1. Enter Query parameter ?screens=2,1

Visuals

2020-07-17PHScleBasicPhetIOScreensQpar

Troubleshooting information:
!!!!! DO NOT EDIT !!!!!
Name: ‪pH Scale: Basics‬
URL: https://phet-dev.colorado.edu/html/ph-scale-basics/1.4.0-rc.1/phet/ph-scale-basics_all_phet.html
Version: 1.4.0-rc.1 2020-07-09 22:22:32 UTC
Features missing: touch
Flags: pixelRatioScaling
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36
Language: en-US
Window: 1433x706
Pixel Ratio: 1.3406250476837158/1
WebGL: WebGL 1.0 (OpenGL ES 2.0 Chromium)
GLSL: WebGL GLSL ES 1.0 (OpenGL ES GLSL ES 1.0 Chromium)
Vendor: WebKit (WebKit WebGL)
Vertex: attribs: 16 varying: 30 uniform: 4095
Texture: size: 16384 imageUnits: 16 (vertex: 16, combined: 32)
Max viewport: 32767x32767
OES_texture_float: true
Dependencies JSON: {}

@pixelzoom
Copy link
Contributor

pixelzoom commented Jul 20, 2020

Reproduced in 1.4.0-rc.1 and master.

I see the same behavior in master with Concentration, but not with RIAW. They are both 1-screen sims, so I'm not sure what's causing different behavior. Perhaps its somehow related to the fact the pH Scale: Basics and Concentration are both subsets of some other sim, but I can imagine why that would be relevant.

Assigning to @chrisklus, since I believe he worked on this feature. High priority because this sim is in RC testing.

The fix will need to be patched into the 1.4 branches for ph-scale and ph-scale-basics.

@samreid
Copy link
Member

samreid commented Jul 21, 2020

In the commit, we fall back to nominal screens if there is an error, without appending to it on subsequent loops. It's working well in my testing.

@loganbraywork can you please test on phettest? Please run without assertions so it will not crash during startup.

@pixelzoom or @zepumph are you available to review this? It is just a few lines of code.

@pixelzoom
Copy link
Contributor

pixelzoom commented Jul 21, 2020

forEach is an inappropriate iterator to be using in selectScreen.js, and this clearly has not been tested well. For example, running ph-scale-basicis with ?screens=3,4,5, I see the same error message 3x with totally bogus values:

screenshot_433

Please use a for loop that is exited when allScreensValid becomes false. I.e.:

let allScreensValid = true;
for ( let i = 0; i < screensQueryParameter.length && allScreensValid; i++ ) {
   ...
}

@pixelzoom
Copy link
Contributor

Self assigning. I'll fix this.

@pixelzoom pixelzoom self-assigned this Jul 21, 2020
pixelzoom added a commit to phetsims/joist that referenced this issue Jul 21, 2020
pixelzoom added a commit to phetsims/joist that referenced this issue Jul 21, 2020
@pixelzoom
Copy link
Contributor

pixelzoom commented Jul 21, 2020

@samreid please review the above commits.

Test cases:

// These will start without error
ph-scale-basics_en.html?screens=1
ph-scale_en.html?screens=1,2,3
ph-scale_en.html?screens=2
ph-scale_en.html?screens=2,3

// These contain errors, display warning dialog, and revert to default.
ph-scale-basics_en.html?screens=2,1
ph-scale_en.html?screens=1,4

@pixelzoom
Copy link
Contributor

pixelzoom commented Jul 21, 2020

This issue also points to insufficient unit tests in selectScreensTests.js. I don't have time to address that, but it should be addressed. Tracking in phetsims/joist#643.

pixelzoom pushed a commit to phetsims/joist that referenced this issue Jul 29, 2020
pixelzoom added a commit to phetsims/joist that referenced this issue Jul 29, 2020
pixelzoom added a commit to phetsims/joist that referenced this issue Jul 29, 2020
pixelzoom added a commit to phetsims/ph-scale-basics that referenced this issue Jul 29, 2020
@pixelzoom
Copy link
Contributor

phetsims/joist#644 is closed and changes have been cherry-picked.

phetsims/query-string-machine#42 is still blocking.

pixelzoom added a commit to phetsims/ph-scale-basics that referenced this issue Jul 30, 2020
@pixelzoom
Copy link
Contributor

phetsims/query-string-machine#42 is resolved and has been cherry-picked.

Ready for testing in next RC.

@pixelzoom
Copy link
Contributor

pixelzoom commented Aug 4, 2020

This is irrelevant for ph-scale-basics, because it has 1 screen.

To verify in ph-scale, run the sim with these query parameters and verify that you get an "Invalid Query Parameters" dialog that correctly identifies the bad query parameter and its value:

  • ?screens=4,1
  • ?screens=-1
  • ?screens=Macro,Micro

Also check a few valid values, like:

  • ?screens=2
  • ?screens=3,2

@KatieWoe
Copy link
Contributor

KatieWoe commented May 12, 2021

No basics to test, but it looks ok on Win 10 Chrome in 1.5.0-dev.1. @pixelzoom if that is enough, feel free to close
Edit: disregard my comment

@brooklynlash
Copy link

brooklynlash commented May 12, 2021

On Chromebook on master, I only get an invalid query parameter screen with the Macro, Micro, and the valid ones work. The other two (-1, 4,1) are stuck on the phet loading screen and never load.

@pixelzoom
Copy link
Contributor

pixelzoom commented May 12, 2021

I'm seeing all results as expected in master, on macOS.

@brooklynlash I'm not sure that I understand your report. Are you referring to the tests in #171 (comment), and saying that you're getting these results?

  • ?screens=4,1 - "Invalid Query Parameters" dialog is NOT displayed, sim stuck on Loading screen
  • ?screens=-1 - "Invalid Query Parameters" dialog is NOT displayed, sim stuck on Loading screen
  • ?screens=Macro,Micro - "Invalid Query Parameters" dialog is displayed
  • ?screens=2 - sim starts as expected
  • ?screens=3,2 - sim starts as expected

Are you running with any other query parameters, or just screens?

@brooklynlash
Copy link

Yes, this is what I meant, and that was the only query parameter running. I can test also on Win10 and see if there is a discrepancy.

@brooklynlash
Copy link

Oh, I figured out the issue. Had the same issue on master on Win10, but then took out the brand=phet parameter and worked as expected.

@brooklynlash brooklynlash removed their assignment May 12, 2021
@pixelzoom
Copy link
Contributor

Great, thanks @brooklynlash. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants