add tests (#536)

This commit is contained in:
zuomeng wang
2022-11-28 13:17:34 +00:00
committed by GitHub
parent 7392a9bfc5
commit 5eb7830c13
11 changed files with 122 additions and 9 deletions

35
tests/contact-us.spec.ts Normal file
View File

@@ -0,0 +1,35 @@
import { test, expect, type Page } from '@playwright/test';
import { loadPage } from './libs/load-page';
loadPage();
test.describe('Open contact us', () => {
test('Click left-top corner Logo', async ({ page }) => {
const leftTopCorner = page.locator('[data-testid=left-top-corner-logo]');
await leftTopCorner.click();
const contactUsModal = page.locator(
'[data-testid=contact-us-modal-content]'
);
await expect(contactUsModal).toContainText('Join our community.');
});
test('Click right-bottom corner contact icon', async ({ page }) => {
const faqIcon = page.locator('[data-testid=faq-icon]');
const box = await faqIcon.boundingBox();
await expect(box?.x).not.toBeUndefined();
await page.mouse.move((box?.x ?? 0) + 5, (box?.y ?? 0) + 5);
const rightBottomContactUs = page.locator(
'[data-testid=right-bottom-contact-us-icon]'
);
await expect(await rightBottomContactUs.isVisible()).toEqual(true);
await rightBottomContactUs.click();
const contactUsModal = page.locator(
'[data-testid=contact-us-modal-content]'
);
await expect(contactUsModal).toContainText('Join our community.');
});
});