Commit a95a6f2c authored by isstuev's avatar isstuev

fix tests

parent 3def36ef
import { test as base, expect } from '@playwright/experimental-ct-react'; import { test as base, expect, devices } from '@playwright/experimental-ct-react';
import React from 'react'; import React from 'react';
import * as textAdMock from 'mocks/ad/textAd'; import * as textAdMock from 'mocks/ad/textAd';
...@@ -40,7 +40,7 @@ test.beforeEach(async({ page }) => { ...@@ -40,7 +40,7 @@ test.beforeEach(async({ page }) => {
}); });
}); });
test('base view +@mobile +@dark-mode', async({ mount, page }) => { test('base view +@dark-mode', async({ mount, page }) => {
await page.route(BLOCKS_API_URL, (route) => route.fulfill({ await page.route(BLOCKS_API_URL, (route) => route.fulfill({
status: 200, status: 200,
body: JSON.stringify(blockMock.baseListResponse), body: JSON.stringify(blockMock.baseListResponse),
...@@ -61,6 +61,30 @@ test('base view +@mobile +@dark-mode', async({ mount, page }) => { ...@@ -61,6 +61,30 @@ test('base view +@mobile +@dark-mode', async({ mount, page }) => {
await expect(component).toHaveScreenshot(); await expect(component).toHaveScreenshot();
}); });
test.describe('mobile', () => {
test.use({ viewport: devices['iPhone 13 Pro'].viewport });
test(' base view', async({ mount, page }) => {
await page.route(BLOCKS_API_URL, (route) => route.fulfill({
status: 200,
body: JSON.stringify(blockMock.baseListResponse),
}));
await page.route(STATS_API_URL, (route) => route.fulfill({
status: 200,
body: JSON.stringify(statsMock.base),
}));
const component = await mount(
<TestApp>
<Blocks/>
</TestApp>,
{ hooksConfig },
);
await page.waitForResponse(BLOCKS_API_URL);
await expect(component).toHaveScreenshot();
});
});
test('new item from socket', async({ mount, page, createSocket }) => { test('new item from socket', async({ mount, page, createSocket }) => {
await page.route(BLOCKS_API_URL, (route) => route.fulfill({ await page.route(BLOCKS_API_URL, (route) => route.fulfill({
status: 200, status: 200,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment