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

How should the initialScreen parameter be handled #717

Closed
KatieWoe opened this issue May 14, 2021 · 5 comments
Closed

How should the initialScreen parameter be handled #717

KatieWoe opened this issue May 14, 2021 · 5 comments
Labels

Comments

@KatieWoe
Copy link

For phetsims/qa#649. Related to #714. Seen on Win 10 Chrome.
The initialScreen=X query parameter seems to be handled differently for different simulations. For older sims, such as Acid-Base solutions, it highlights the X option on the home screen, and if X is invalid the sim starts with nothing highlighted but the sim is usable. In other sims, such as Area Model Introduction, it opens the sim to X page and if X is invalid the sim won't load and has a large number of console errors.

whatshouldinitialscreendo
whatshouldbadinitialscreendo

@KatieWoe
Copy link
Author

Same difference can be seen with invalid screens inputs.

@jonathanolson
Copy link
Contributor

Auto-scanning sim differences with the following:

const Maintenance = require( './js/common/Maintenance' );
const ReleaseBranch = require( './js/common/ReleaseBranch' );
const puppeteerEvaluate = require( './js/common/puppeteerEvaluate' );
const checkoutTarget = require( './js/common/checkoutTarget' );
const winston = require( 'winston' );

winston.default.transports.console.level = 'error';

( async () => {
  const releaseBranches = await ReleaseBranch.getMaintenanceBranches();

  for ( let releaseBranch of releaseBranches ) {
    console.log( `${releaseBranch.repo} ${releaseBranch.branch}` );
    try {
      await checkoutTarget( releaseBranch.repo, releaseBranch.branch, false );

      const numScreens = await puppeteerEvaluate( `http://localhost/${releaseBranch.repo}/${releaseBranch.repo}_en.html?brand=phet&ea`, () => {
        return phet.joist.sim.screens.filter( screen => screen !== phet.joist.sim.homeScreen ).length;
      }, {
        waitAfterLoad: 20000
      } );

      console.log( `  screens: ${numScreens}` );

      if ( numScreens >= 2 ) {
        const selectedScreenIndex = await puppeteerEvaluate( `http://localhost/${releaseBranch.repo}/${releaseBranch.repo}_en.html?brand=phet&ea&initialScreen=2`, () => {
          const currentScreen = phet.joist.sim.currentScreenProperty ? phet.joist.sim.currentScreenProperty.value : phet.joist.sim.screenProperty.value;

          const allScreens = [ phet.joist.sim.homeScreen, ...phet.joist.sim.screens.filter( screen => screen !== phet.joist.sim.homeScreen ) ];

          return Math.max( allScreens.indexOf( currentScreen ), 0 );
        }, {
          waitAfterLoad: 20000
        } );

        console.log( `  selected: ${selectedScreenIndex}` );
      }

      // await checkoutTarget( releaseBranch.repo, 'master', false );
    }
    catch ( e ) {
      console.log( e );
    }
  }
} )();

jonathanolson added a commit to phetsims/balancing-act that referenced this issue May 27, 2021
jonathanolson added a commit to phetsims/acid-base-solutions that referenced this issue May 27, 2021
jonathanolson added a commit to phetsims/area-builder that referenced this issue May 27, 2021
jonathanolson added a commit to phetsims/arithmetic that referenced this issue May 27, 2021
jonathanolson added a commit to phetsims/balancing-act that referenced this issue May 27, 2021
jonathanolson added a commit to phetsims/beers-law-lab that referenced this issue May 27, 2021
jonathanolson added a commit to phetsims/beers-law-lab that referenced this issue May 27, 2021
jonathanolson added a commit to phetsims/bending-light that referenced this issue May 27, 2021
jonathanolson added a commit to phetsims/build-an-atom that referenced this issue May 27, 2021
jonathanolson added a commit to phetsims/build-an-atom that referenced this issue May 27, 2021
jonathanolson added a commit to phetsims/circuit-construction-kit-black-box-study that referenced this issue May 27, 2021
jonathanolson added a commit to phetsims/color-vision that referenced this issue May 27, 2021
jonathanolson added a commit to phetsims/color-vision that referenced this issue May 27, 2021
jonathanolson added a commit to phetsims/circuit-construction-kit-black-box-study that referenced this issue Jun 17, 2021
jonathanolson added a commit to phetsims/energy-skate-park-basics that referenced this issue Jun 17, 2021
@jonathanolson
Copy link
Contributor

Closing, handled in maintenance release deployment.

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

2 participants