Usage
To run tests with the gameface-e2e framework, you need the following:
Player.exelocated at${GamefacePackage}/Player/Player.exe..specfiles to be executed. The framework usesmocha, so your.specfiles should follow thedescribe-itpattern.- (Optional) A config file for running the tests.
Running tests without a config file
Section titled “Running tests without a config file”To run your tests without a config file, use the following command:
npx gameface-e2e --gamefacePath=${PATH_TO_PLAYER_EXE} --tests=${PATH_TO_SPEC_FILES}If you have installed the framework globally, you can use:
gameface-e2e --gamefacePath=${PATH_TO_PLAYER_EXE} --tests=${PATH_TO_SPEC_FILES}PATH_TO_PLAYER_EXE: The path to yourPlayer.exe, either relative to the command execution location or as an absolute path.PATH_TO_SPEC_FILES: The path to your spec files, either relative to the command execution location or as an absolute path. You can use patterns liketests/**/*.spec.jsto match all.specfiles in thetestsfolder.
Running tests with a config file
Section titled “Running tests with a config file”To avoid specifying the gamefacePath and tests paths each time you run your tests, you can create a config file that the framework will use to retrieve both flags.
There are two ways to do this:
- Create a
gameface-e2e-config.jsfile in the directory where you plan to run thegameface-e2ecommand, such as your project root. - Create a config JavaScript file with any name and place it anywhere.
Inside this file, you can specify various config properties for the testing library. Here is an example where we specify the path to the Player.exe and tests:
module.exports = { tests: "examples/**/*.spec.js", gamefacePath: "C:/Gameface/Player/Player.exe"}When you configure both properties inside your config file, there are two ways to execute the gameface-e2e command without specifying the required flags:
- Without specifying the config file path. Create a file named
gameface-e2e-config.jsin the directory where you will execute the command:Terminal window npx gameface-e2e - By specifying the config file path. Pass the path to your config file, which must be relative to the location where the command will be executed:
Terminal window npx gameface-e2e --config=./tests/my-config.js