-
Notifications
You must be signed in to change notification settings - Fork 902
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
fix: e2e tests breaking in main #2219
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 2 Ignored Deployments
|
Thank you for following the naming conventions for pull request titles! 🙏 |
apps/web/playwright/utils/helper.tsIt's a good practice to use constants for repeated strings. This makes the code easier to maintain and less prone to typos. const ADD_QUESTION = "Add QuestionAdd a new question to your survey";
const WELCOME_CARD = "Welcome CardEnabled";
const THANK_YOU_CARD = "Thank You CardShown";
apps/web/playwright/js.spec.tsUsing descriptive variable names makes the code easier to understand. Instead of using generic names like 'htmlFile', use more descriptive names like 'surveyHtmlFile'. let surveyHtmlFile = replaceEnvironmentIdInHtml(htmlFilePath, environmentId);
await page.goto(surveyHtmlFile);
apps/web/playwright/survey.spec.tsThere are several repeated code blocks in the test cases. It would be beneficial to refactor these into helper functions to improve readability and maintainability. This will also make the test cases more concise and easier to understand. async function checkVisibilityAndClick(page: Page, locator: string) {
await expect(page.locator(locator)).toBeVisible();
await page.locator(locator).click();
}
// Use the helper function in the test cases
await checkVisibilityAndClick(page, "#howToSendCardTrigger");
await checkVisibilityAndClick(page, "#howToSendCardOption-web");
await checkVisibilityAndClick(page, "#codeAction");
// ...
Currently, all the test cases are in a single describe block. It would be better to organize them into separate describe blocks based on the functionality they are testing. This will make the test cases more organized and easier to navigate. test.describe("Survey Creation", () => {
// ...
});
test.describe("Survey Submission", () => {
// ...
});
test.describe("Survey Custom Actions", () => {
// ...
});
|
…ormbricks/formbricks into shubham/for-2005-fix-e2e-tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ShubhamPalriwala thanks a lot for fixing the tests :-) Let's get this in production we can safely merge everything else :-)
What does this PR do?
Fixes Breaking E2E Tests in CI Pipeline
Uses branch code to test rather than main
Checklist
Required
pnpm build
console.logs
git pull origin main
Appreciated