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

PokeCenter's "NO" test doesn't finish the dialog before asserting no healing has happened #704

Open
Machinocheese opened this issue Apr 18, 2018 · 1 comment

Comments

@Machinocheese
Copy link
Contributor

Bug Summary

PokeCenter.test.ts seems to have some issues with not going through the cutscene properly.

Steps to Reproduce

Try running some console logs on the test. Example shown below on a combined version of a PokeCenter test:

it("PokeCenter test...", (): void => {
        const { fsp, player, ...extras } = stubBlankGame({
            automaticallyAdvanceMenus: true,
        });
        const firstPokemonInParty: IPokemon = fsp.equations.createPokemon({
            level: 77,
            title: "METAPOD".split(""),
        });
        const nurse = fsp.objectMaker.make<ICharacter>("Nurse", {
            id: "Nurse",
        });
        const machine = fsp.objectMaker.make<IThing>("HealingMachine", {
            id: "HealingMachine",
        });

        fsp.things.add(machine, nurse.right, nurse.top);
        fsp.things.add(nurse, player.right, player.top);

        fsp.itemsHolder.setItem(fsp.storage.names.pokemonInParty, [firstPokemonInParty]);

        fsp.cutscenes.pokeCenter.Welcome();
        console.log("-1: " + fsp.menuGrapher.getActiveMenuName());
        fsp.inputs.keyDownA(player);
        console.log("0: " + fsp.menuGrapher.getActiveMenuName());
        fsp.inputs.keyDownA(player);

        firstPokemonInParty.status = "frozen";

        // Act
        console.log("1: " + fsp.menuGrapher.getActiveMenuName());
        fsp.inputs.keyDownDown(player);
        console.log("2: " + fsp.menuGrapher.getActiveMenuName());
        fsp.inputs.keyDownA(player);
        console.log("3: " + fsp.menuGrapher.getActiveMenuName());

        // Assert
        expect(firstPokemonInParty.status).to.be.equal("frozen");
    });

should produce a console log of something like:
-1: GeneralText 0: Heal/Cancel 1: GeneralText 2: GeneralText 3: GeneralText

The issue with the above is that fsp.inputs.keyDownDown and fsp.inputs.keyDownA are supposed to be called on the Heal/Cancel menu as a means to select the Cancel option, but they instead seem to be acting on a GeneralText menu, which should not respond to fsp.inputs.keyDownDown.

@JoshuaKGoldberg
Copy link
Member

Looks like it's not getting all the way through the cutscene.

Part of the problem is that keyDownDown is an asynchronous call.

@JoshuaKGoldberg JoshuaKGoldberg changed the title PokeCenter Test Issue PokeCenter's "NO" test doesn't finish the dialog before asserting no healing has happened Apr 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants