fix: 修复餐饮页面底部遮挡及分类提交控件
This commit is contained in:
1 parent
e5a1a60eee
commit
f324b663a6
5 files changed
+65
-1
No files matched your search
@@ -114,3 +114,43 @@ for (const width of [375, 430, 768, 1280]) {
|
||||
expect(bar!.width).toBeCloseTo(expectedWidth, 0);
|
||||
});
|
||||
}
|
||||
|
||||
for (const width of [375, 1280]) {
|
||||
test(`餐饮控件与底部避让 ${width}`, async ({ page }) => {
|
||||
await page.setViewportSize({ width, height: 812 });
|
||||
const scrollToBottom = async () => {
|
||||
await page.evaluate(() => {
|
||||
document.querySelectorAll("*").forEach((element) => {
|
||||
if (/auto|scroll/.test(getComputedStyle(element).overflowY))
|
||||
element.scrollTop = element.scrollHeight;
|
||||
});
|
||||
window.scrollTo(0, document.body.scrollHeight);
|
||||
});
|
||||
};
|
||||
const aboveNavigation = async (selector: string) => {
|
||||
const bottom = await page.locator(selector).last().boundingBox();
|
||||
const nav = await page.locator(".taro-tabbar__tabbar").boundingBox();
|
||||
expect(bottom!.y + bottom!.height).toBeLessThan(nav!.y - 8);
|
||||
};
|
||||
await page.goto("/");
|
||||
await expect(page.locator(".food-home .promise").last()).toBeAttached();
|
||||
await scrollToBottom();
|
||||
await aboveNavigation(".food-home .promise");
|
||||
await page.goto("/#/pages/offerings/index");
|
||||
await expect(page.locator(".filter").first()).toBeVisible();
|
||||
const filters = await page
|
||||
.locator(".filter")
|
||||
.evaluateAll((elements) => elements.map((element) => element.getBoundingClientRect().width));
|
||||
expect(filters[0]).toBeLessThan(200);
|
||||
await page.locator(".filter").nth(1).click();
|
||||
await expect(page.locator(".filter").nth(1)).toHaveClass(/active/);
|
||||
await page.goto("/#/pages/inquiry/index");
|
||||
await expect(page.locator(".submit-button")).toBeVisible();
|
||||
await scrollToBottom();
|
||||
await aboveNavigation(".history-link");
|
||||
const button = await page.locator(".submit-button").boundingBox();
|
||||
expect(button!.height).toBeGreaterThanOrEqual(44);
|
||||
await page.locator(".submit-button").click();
|
||||
await expect(page.locator(".form-error")).toContainText("请填写");
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user