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

page.waitForLoadState ( Testing clerk sign up ) #141

Closed
tanushmahalka opened this issue Dec 25, 2024 · 9 comments
Closed

page.waitForLoadState ( Testing clerk sign up ) #141

tanushmahalka opened this issue Dec 25, 2024 · 9 comments

Comments

@tanushmahalka
Copy link

tanushmahalka commented Dec 25, 2024

Reproduction

import { shortest } from '@antiwork/shortest'

shortest('Sign up using email and password', { 
  email: "[email protected]", 
  password: "test" 
})

Its kinda stuck here:
Screenshot 2024-12-25 at 10 17 16 AM

and then I get an execution error
Test Execution Error: page.waitForLoadState: Timeout 30000ms exceeded.

@m2rads
Copy link
Contributor

m2rads commented Dec 25, 2024

Which version are you using?

@tanushmahalka
Copy link
Author

Which version are you using?

@antiwork/shortest": "^0.1.1"

@m2rads
Copy link
Contributor

m2rads commented Dec 25, 2024

Could you try running your tests with npx shortest --debug-ai and let me know if you see any issues?
Also are you running this against your localhost?

@tanushmahalka
Copy link
Author

Also are you running this against your localhost?

Yes

Could you try running your tests with npx shortest --debug-ai

Screenshot 2024-12-25 at 10 34 41 AM

@m2rads
Copy link
Contributor

m2rads commented Dec 25, 2024

Thanks for the sc. Seems like the initial page load is timing out. Here are couple things you can try to trouble shoot this issue:

  1. Try version 0.1.0 see if the same issue happens
  2. Try running your tests in headless mode: pnpm shortest --headless
  3. For testing clerk you can also do something like below. Make sure to setup your clerk dev env to accept email code.
import { shortest } from "@antiwork/shortest";
import { clerk, clerkSetup } from "@clerk/testing/playwright";

let frontendUrl = process.env.PLAYWRIGHT_TEST_BASE_URL ?? "http://localhost:3000";

shortest.beforeAll(async ({ page }) => {
  await clerkSetup({
    frontendApiUrl: frontendUrl,
  });
  await clerk.signIn({
    page,
    signInParams: {
      strategy: "email_code",
      identifier: "[email protected]",
    },
  });

  await page.goto(frontendUrl + "/dashboard");
});

shortest("your test case")
  1. Double check your shortest.config.ts file and make sure it's similar to the one below:
import type { ShortestConfig } from "@antiwork/shortest";

export default {
  headless: false,
  baseUrl: "http://localhost:3000",
  testDir: "app/tests",
  anthropicKey: process.env.SHORTEST_ANTHROPIC_API_KEY,
} satisfies ShortestConfig;

If none of the above works please let me know. Thank you!

@tanushmahalka
Copy link
Author

so sorry, it seems like all of them are resulting in a timeout,
including the beforeAll callback is not signing things in..

Must be a problem with my setup

import type { ShortestConfig } from '@antiwork/shortest';

export default {
  headless: false,
  baseUrl: 'http://localhost:3000',
  testDir: 'app/__tests__',
  anthropicKey: process.env.ANTHROPIC_API_KEY
} satisfies ShortestConfig; 

@m2rads
Copy link
Contributor

m2rads commented Dec 25, 2024

Hhhm that's interesting. I will see if I can reproduce this issue on my end.

In the meantime, do you have any other projects to try this one? Let's see if the issue is specific to your project or not. Thank you!

@m2rads
Copy link
Contributor

m2rads commented Dec 25, 2024

Hi @tanushmahalka just following up on this. Were you able to run this on a different project? Please let me know if this issue persist across different project and we can open a bug.

Unfortunately I have not been able to replicate this issue on my end yet but I will improve the waitForLoad mechanism. Please let me know if have any other questions.

@m2rads
Copy link
Contributor

m2rads commented Dec 27, 2024

This issue got reported again in issue: #188. I will close this one and track the fix there.

@m2rads m2rads closed this as completed Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants