-
Notifications
You must be signed in to change notification settings - Fork 7
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
Test
Pages, Contact & Donation
#1662
base: dev
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
2 Skipped Deployments
|
🤖 Meticulous replayed 50 user sessions and took 161 visual snapshots. Meticulous has not yet run on 1b472ec of the main branch and so there was nothing to compare against. Last updated for commit 94790b5. This comment will update as new commits are pushed. |
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.
Thanks
Could you split your test into separate test cases:
test.describe("...", () => {
test("TC-01: ...", () => {})
test("TC-02: ...", () => {})
})
expect(successDiv).toBe('Thank you. Your message has been delivered.') // 07. Can the user send the message successfully ? | ||
|
||
const emaillink = page.locator('a[href^="mailto:"]') | ||
await expect(emaillink).toHaveCount(1) // 08. When clicking on the email address icon, the user should be directed to the Outlook application. |
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.
toHaveCount
is intended to be used for list I think. toBeVisible
would be better.
|
||
const inputLocator = page.locator('.chakra-numberinput input') | ||
const valuee = await inputLocator.inputValue() | ||
expect(valuee).toContain('10') |
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.
Up to here, it could be separate test case:
test('TC-02: should display correct amount in input', ({ page }) => {})
await page.getByPlaceholder('E-mail').click() | ||
await page.getByPlaceholder('Name').click() | ||
|
||
const requiredTextName = await page.locator('text=name is a required field') |
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.
It has error-text-name
testid
expect(isValidEmail).toBe(true) // 07. Assert that the email is valid | ||
await Promise.all([page.getByRole('button', { name: 'Donate €' }).click()]) | ||
const newUrl = page.url() | ||
expect(isValidEmail).toBe(newUrl.length > 0) // 08. When the donate button is clicked, the user should be directed to the payment page. |
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.
What about this?
expect(newUrl).toContain('checkout.stripe.com')
const emailValue = await emailInput.inputValue() | ||
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/ | ||
|
||
const isValidEmail = emailRegex.test(emailValue) | ||
expect(isValidEmail).toBe(true) // 07. Assert that the email is valid |
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.
You don't need to validate emails like developers. You should just check if UI shows error message for invalid emails. I would remove this regex validation
|
||
const isValidEmail = emailRegex.test(emailValue) | ||
expect(isValidEmail).toBe(true) // 07. Assert that the email is valid | ||
await Promise.all([page.getByRole('button', { name: 'Donate €' }).click()]) |
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.
Promise.all shouldn't be needed here.
await Promise.all([page.getByRole('button', { name: 'Donate €' }).click()]) | |
await page.getByRole('button', { name: 'Donate €' }).click() | |
await page.waitForLoadState('documentloaded') |
Test
Pages, Contact & Donation
Arts, Collections, Activities and About Us were tested on the Pages.spec.ts page.
Contact and Donate pages were tested on their own pages.
Note: When I did 'yarn format', it edited other pages. For this reason, there are many changes in Githup. The changes that belong to me are only on 3 pages.