diff --git a/playwright-tests/tests/proposal/comment.spec.js b/playwright-tests/tests/proposal/comment.spec.js index 9dd9524c6..e5b3affe4 100644 --- a/playwright-tests/tests/proposal/comment.spec.js +++ b/playwright-tests/tests/proposal/comment.spec.js @@ -97,11 +97,15 @@ test.describe("Don't ask again enabled", () => { test("should paste a long comment to a proposal, see that the comment appears after submission, and that the comment field is cleared, even after reloading the page", async ({ page, }) => { - test.setTimeout(70000); + test.setTimeout(2 * 60000); await page.goto("/devhub.near/widget/app?page=proposal&id=17"); const widgetSrc = "devhub.near/widget/devhub.entity.proposal.ComposeComment"; + let commentButton = await page.getByRole("button", { name: "Comment" }); + await expect(commentButton).toBeAttached({ timeout: 10000 }); + await commentButton.scrollIntoViewIfNeeded(); + const commentText = "Hi @petersalomonsen.near – congratulations! This message confirms your funding request approval by @neardevdao.near. We're excited to sponsor your work! This approval follows our review process involving various Work Groups and DevDAO Moderators, as outlined in our [guidelines](/devhub.near/widget/app?page=community&handle=developer-dao&tab=Funding). Please note that the funding distribution is contingent on successfully passing our KYC/B and paperwork process.\n\nHere’s what to expect:\n\n**Funding Steps**\n\n1. **KYC/KYB Verification:** A DevDAO Moderator will move your proposal to the Payment Processing Stage and verify that you have completed verification to ensure compliance. If you are not verified, your DevHub Moderator will contact you on Telegram with instructions on how to proceed. To receive funding, you must get verified through Fractal, a trusted third-party identification verification solution. Your verification badge is valid for 365 days and needs renewal upon expiration OR if your personal information changes, such as your name, address, or ID expiration.\n2. **Information Collection:** Once verified, a DevDAO Moderator will contact you via Telegram and request that you complete the Funding Request Form using Airtable.\n3. **Processing:** Our legal team will verify your application details to ensure compliance. They will then send you an email requesting your signature for the underlying agreement via Ironclad.\n4. **Invoicing & Payment:** Once we receive your signed agreement, our finance team will email you instructions to submit the final invoice using Request Finance. Once we receive your invoice, our finance team will send a test transaction confirmation email. Once you confirm the test transaction, we will distribute the funds and post a payment link on your proposal.\n\n**Funding Conversion Notice**\n\nOnce you receive your funding, we urge you to exercise caution if attempting to convert your funds. Some third-party tools may impose significant swapping fees.\n\n**Visibility**\n\nWe track the funding process on each proposal using the timeline and comments. However, you are welcome to reach out to the DevDAO Moderator with any questions. \n\n**Timeline**\n\nTypically, funds are disbursed within 10 business days, but the timeline can vary depending on the project's complexity and paperwork. Your DevDAO Moderator will keep you updated."; await page.evaluate(async (text) => { @@ -172,11 +176,10 @@ test.describe("Don't ask again enabled", () => { } ); - const commentButton = await page.getByRole("button", { name: "Comment" }); - await expect(commentButton).toBeAttached(); - await commentButton.scrollIntoViewIfNeeded(); - - let submittedTransactionJsonObject; + let submittedTransactionJsonObjectPromiseResolve; + let submittedTransactionJsonObjectPromise = new Promise( + (r) => (submittedTransactionJsonObjectPromiseResolve = r) + ); await page.route("https://api.near.social/index", async (route) => { if (transactionMockStatus.transaction_completed) { const lastTransactionParamBuffer = Buffer.from( @@ -193,8 +196,8 @@ test.describe("Don't ask again enabled", () => { transactionDataJsonEndIndex ); - submittedTransactionJsonObject = JSON.parse( - transactionDataJsonString.toString() + submittedTransactionJsonObjectPromiseResolve( + JSON.parse(transactionDataJsonString.toString()) ); const response = await route.fetch(); @@ -213,6 +216,7 @@ test.describe("Don't ask again enabled", () => { } }); + commentButton = await page.getByRole("button", { name: "Comment" }); await commentButton.click(); const loadingIndicator = await page.locator(".comment-btn-spinner"); @@ -233,12 +237,14 @@ test.describe("Don't ask again enabled", () => { await page.frameLocator("iframe").locator(".CodeMirror") ).toContainText("Add your comment here..."); + const submittedTransactionJsonObject = + await submittedTransactionJsonObjectPromise; const submittedComment = JSON.parse( submittedTransactionJsonObject.data["petersalomonsen.near"].post.comment ); expect(submittedComment.text).toEqual(commentText); let commentElement = await page.locator("#theorinear121684809"); - await expect(commentElement).toBeVisible(); + await expect(commentElement).toBeVisible({ timeout: 10000 }); await commentElement.scrollIntoViewIfNeeded(); await expect(commentElement).toContainText( "Typically, funds are disbursed within 10 business days, but the timeline can vary depending on the project's complexity and paperwork. Your DevDAO Moderator will keep you updated." @@ -253,6 +259,10 @@ test.describe("Don't ask again enabled", () => { "Typically, funds are disbursed within 10 business days, but the timeline can vary depending on the project's complexity and paperwork. Your DevDAO Moderator will keep you updated." ); + commentButton = await page.getByRole("button", { name: "Comment" }); + await expect(commentButton).toBeAttached({ timeout: 10000 }); + await commentButton.scrollIntoViewIfNeeded(); + await page.waitForTimeout(5000); await expect( await page.frameLocator("iframe").locator(".CodeMirror")