-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2965 from clari182/feature/playwright-confirmemail
Feature/playwright confirmemail
- Loading branch information
Showing
2 changed files
with
43 additions
and
49 deletions.
There are no files selected for viewing
49 changes: 0 additions & 49 deletions
49
site/gatsby-site/cypress/e2e/integration/confirmemail.cy.js
This file was deleted.
Oops, something went wrong.
43 changes: 43 additions & 0 deletions
43
site/gatsby-site/playwright/e2e/integration/confirmemail.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { expect } from '@playwright/test'; | ||
import { test } from '../../utils'; | ||
|
||
const url = '/confirmemail'; | ||
|
||
test.describe('Confirm email', () => { | ||
|
||
test('Should successfully load confirm email page', async ({ page }) => { | ||
await page.goto(url); | ||
}); | ||
|
||
test('Should display Invalid params message when token or tokenId are missing', async ({ page }) => { | ||
await page.goto(`${url}?token=dummyToken`); | ||
await expect(page.locator(':has-text("Invalid parameters")').first()).toBeVisible(); | ||
await expect(page.locator('[data-cy="confirm-login-btn"]')).toBeVisible(); | ||
await expect(page.locator('#content:has-text("An unknown error has occurred")')).toBeVisible(); | ||
|
||
await page.goto(`${url}?tokenId=dummyTokenId`); | ||
await expect(page.locator(':has-text("Invalid parameters")').first()).toBeVisible(); | ||
await expect(page.locator('[data-cy="confirm-login-btn"]')).toBeVisible(); | ||
await expect(page.locator('#content:has-text("An unknown error has occurred")')).toBeVisible(); | ||
}); | ||
|
||
test('Should display an error message if the confirmation failed on Atlas', async ({ page }) => { | ||
await page.goto(`${url}?token=invalidToken&tokenId=invalidTokenId`); | ||
await expect(page.locator('[data-cy="toast"]:has-text("An unknown error has occurred")')).toBeVisible(); | ||
await expect(page.locator('[data-cy="confirm-login-btn"]')).toBeVisible(); | ||
await expect(page.locator('#content:has-text("An unknown error has occurred")')).toBeVisible(); | ||
}); | ||
|
||
test('Should display success message if the email is confirmed on Atlas', async ({ page }) => { | ||
await page.route('**/confirm', route => route.fulfill({ status: 201 })); | ||
await page.goto(`${url}?token=dummyToken&tokenId=dummyTokenId`); | ||
|
||
await expect(page.locator('[data-cy="toast"]:has-text("Thank you for verifying your account.")')).toBeVisible(); | ||
await expect(page.locator('[data-cy="confirm-login-btn"]')).toBeVisible(); | ||
await expect(page.locator('#content:has-text("Thank you for verifying your account.")')).toBeVisible(); | ||
|
||
await page.locator('[data-cy="confirm-login-btn"]').click(); | ||
await expect(page).toHaveURL('/login/?redirectTo=/account/'); | ||
}); | ||
|
||
}); |