Choice Script Changes To Run Tests With Firefox ver 68 ( See Post 12 & 31)

Yes it requires firefox for both running he game and testing and it also is not very comfortable ina tablet or even less in a phone

1 Like

CSIDE will continue to work as it’s essentially built atop its own personal browser (Chromium in this case). This has pros, and cons. One pro in this case being that it has direct access to the file system, hence doesn’t need this workaround.

I’m not sure about Firefox but you can disable this security feature in Chrome (that might not help with mobile though). Not that I necessarily advise doing so. If you do, you’ll definitely want to turn it back on before doing any real browsing.

2 Likes

I’ve just built out a new, more convenient way to test ChoiceScript, saving you from having to click the “Upload” button every time you test.

First, you’ll need to install Node.js and you’ll need the latest version of ChoiceScript from Github.

Next, you’ll need to open your “Command Prompt” (on Windows) or “Terminal” (on macOS), and cd to the directory containing ChoiceScript.

There, you can run these commands:

  • node serve: Creates a basic localhost web server on a random port number and launches your ChoiceScript game there. You can refresh your browser to test your updated code, just like you used to in the good old days. (Note that if the command prompt/terminal window closes, the server will stop, and your browser tab will stop working.)

    • While you’re running node serve, you can replace web/mygame/index.html with quicktest.html to run QuickTest. Refresh the browser to re-run quicktest.html.
    • You can instead replace web/mygame/index.html with randomtest.html to run RandomTest. Refresh the browser to re-run randomtest.html.
  • node quicktest: Run QuickTest in your command prompt or terminal. You may find that node quicktest runs more quickly than quicktest.html.

  • node randomtest num=10: Run RandomTest in your command prompt or terminal. Change the num to any number you like.

    There are other randomtest options available, like this:

    node randomtest num=10 seed=4
    node randomtest avoidUsedOptions=false showChoices=false
    node randomtest showText=false showCoverage=false
    

    These options work exactly like the checkboxes in randomtest.html.

You don’t have to install Node to test ChoiceScript or do any of the stuff described here; using Node just saves you from having to click on the Upload button each time you test.

7 Likes

There are two different Node versions, which should we use?

Either one is fine.

2 Likes

In the latest version of ChoiceScript up on Github, it’s now somewhat easier to get this stuff to work.

You do still have to install Node.js (one time only). Then, when you download and extract ChoiceScript, you’ll see I’ve added some new scripts to launch the ChoiceScript server.

  • Windows: Double-click on run-server.bat . Windows hides the part of the file name after the dot, so run-server.bat looks like run-server .
    • The first time you run it, Windows will pop up the Windows Defender SmartScreen (“Windows protected your PC”). Click “More Info” and then “Run anyway.”
  • Mac: Double-click on serve.command .
    • The first time you run serve.command on a Mac, double-clicking won’t work. (“‘serve.command’ can’t be opened because it is from an unidentified developer.”) Hold the Control key on your keyboard, click on the serve.command file, and click Open. From now on, double-clicking will work.

Launching the ChoiceScript server will open a window for the server, and it will also open your browser, showing you the example game. You can just refresh your browser to test modifications to your game.

You can stop the server by closing its window. If the server stops, you won’t be able to refresh ChoiceScript in your browser; you’ll need to launch the server again to continue using ChoiceScript.

You can also run Quicktest and Randomtest in a similar way:

  • run-quicktest.bat on Windows, quicktest.command on Mac
  • run-randomtest.bat on Windows, randomtest.command on Mac

Once you’ve jumped through all of the hoops, running the game and the tests is as easy as double-clicking, just like it used to be.

I’ve updated the Introduction to ChoiceScript and the Testing ChoiceScript pages on our website to match these instructions.

3 Likes

This is simply terrible. I can’t even upload the folder. Does anybody know how to upload the choicescript folder?

Here’s what I did:
I placed the .txt files in the scenes folder of the updated CS I downloaded from Github
clicked the browse button in my firefox browser
selected the scenes folder but it just keeps on opening and showing my .txt files instead.
tried dragging the folder to the empty space before the browse button but it only shows the directory.
when i click index.html still it redirects to the upload folder page.

Please help.

Did you try the instructions from my post right before yours? Install Node, double click on run-server.bat or serve.command? That eliminates the need to do the upload thing.

1 Like

No. Is there another option where I don’t have to install Node? In case I use a public computer to run CS stuff.

Unfortunately the options are extremely limited.

You can use CSIDE. That’s a great and easy option for most people, though it doesn’t help your issue with using a public computer.

1 Like

I guess the thing to do is to help you figure out the upload. Are you on Windows?

Using the github, non-Node version, I’ve been able to get good results using the Upload method.

However, I can’t seem to get line coverage statistics to work. All the other options are successful, but not that one. I’m using Firefox. Does anyone else have similar results?

Thanks for patching this!

@dfabulich Yes. I’m on Windows using firefox ver. 6.0.2

For those looking to downgrade Firefox, this is a good guide. Downgrade to version 67.0.

Now, you’ll need to follow THESE STEPS to disable updates, or Firefox will upgrade you again. This should leave you with a stable build that can run the Choicescript tests.

It’s not an optimal solution, but once it’s done you won’t have to screw around with anything else for the foreseeable future.

2 Likes

Would ChoiceScript work without hassle if you run the game on localhost server (and as such, access it via http)?

Yes. That’s what the run-server.bat and serve.command tools do.

2 Likes

That’s what I’ve done for the time being. Just bear in mind, the longer it stays downgraded for, the more security risks that could potentially pop up so may need to consider using a different web browser for general internet stuff.

Speaking personally, I don’t recommend downgrading Firefox. I think if you try the new run-server.bat and/or serve.command stuff, it will work, and you’ll even prefer it to the old way, because you can use any browser you like.

2 Likes

Absolutely. For me, personally, I only use Firefox for testing, so I could keep it downgraded for years and it won’t matter to me at all. Of course other folks’ mileage may vary.

I’ll try out Dan’s new way too at some point.

4 Likes

My issue with trying to use run-server .bat is that it kept saying “can’t locate system 32” or something like that. :flushed:

1 Like