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

refactor: add util type for asserting on global test props #3285

Merged
merged 1 commit into from
Oct 19, 2021

Conversation

jcfranco
Copy link
Member

Related Issue: N/A

Summary

Introduces helper to tack on typed global props for testing purposes.

Here's a usage example:

it("does something", async () => {
  // ... page setup

  type TestWindow = GlobalTestProps<{
    someTestPropForLater: boolean;
  }>;

  await page.evaluate(() => {
      //...browser-context code
      (window as TestWindow).someTestPropForLater = true;
  });

  //... some test steps

  const result = await page.evaluate(() => (window as TestWindow).someTestPropForLater);

  expect(result).toBe(true);
});

Pulls util from #2777 to make the PR a bit leaner.

@jcfranco jcfranco added the testing Issues related to automated or manual testing. label Oct 18, 2021
@jcfranco jcfranco added this to the Sprint 10/11 – 10/22 milestone Oct 18, 2021
@jcfranco jcfranco requested a review from a team as a code owner October 18, 2021 16:54
@jcfranco jcfranco self-assigned this Oct 18, 2021
@github-actions github-actions bot added refactor Issues tied to code that needs to be significantly reworked. and removed testing Issues related to automated or manual testing. labels Oct 18, 2021
Copy link
Member

@driskull driskull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@jcfranco jcfranco merged commit 30288ae into master Oct 19, 2021
@jcfranco jcfranco deleted the jcfranco/add-type-helper-for-tests branch October 19, 2021 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Issues tied to code that needs to be significantly reworked.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants