This commit is contained in:
Untone 2024-07-30 22:44:53 +03:00
parent 6db49c2296
commit ae4ec7b6b7
4 changed files with 15 additions and 50 deletions

View File

@ -17,7 +17,7 @@ export default defineConfig({
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
retries: 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */

View File

@ -60,18 +60,6 @@ test.afterAll(async () => {
})
/* TESTS section */
/* Random Generator */
function generateRandomString(length = 10) {
let result = ''
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
const charactersLength = characters.length
for (let i = 0; i < length; i++) {
result += characters.charAt(Math.floor(Math.random() * charactersLength))
}
return result
}
test.beforeEach(async ({ page }) => {
await page.goto('/')
/* test.setTimeout(80000); */
@ -104,26 +92,4 @@ test.describe('Topic Actions', () => {
await page.getByRole('button', { name: 'Отписаться от темы' }).click()
await expect(page.getByRole('button', { name: 'Подписаться на тему' })).toBeVisible()
})
test('Add comment to topic', async ({ page }) => {
const randomString = generateRandomString()
const currentDate = new Date()
await page.getByRole('button', { name: 'Т.Р' }).click()
await page.getByRole('link', { name: 'Профиль' }).click()
await page.getByRole('link', { name: 'Тестируем функционал' }).first().click()
await page.locator('.tiptap').click()
await page.locator('.tiptap').fill(`Проверка Комментариев: ${randomString} ${currentDate}`)
await page.getByRole('button', { name: 'Отправить' }).click()
await expect(page.getByText(`Проверка Комментариев: ${randomString} ${currentDate}`)).toBeVisible()
})
test('Edit comment to topic', async ({ page }) => {
await page.getByRole('button', { name: 'Т.Р' }).click()
await page.getByRole('link', { name: 'Комментарии' }).click()
await page.locator('[id^="comment_"]').filter({ hasText: 'Проверка Комментариев' }).first().hover()
await page.getByRole('button', { name: 'Редактировать', exact: true }).first().click()
const randomString = generateRandomString()
const currentDate = new Date()
await page.locator('.tiptap').fill(`Редактируемый Комментарий: ${randomString} ${currentDate}`)
await page.getByRole('button', { name: 'Сохранить' }).click()
await expect(page.getByText(`Редактируемый Комментарий: ${randomString} ${currentDate}`)).toBeVisible()
})
})

View File

@ -78,24 +78,23 @@ test.describe('*****Undone***** Drafts - article', () => {
})
})
/* test('Create article', async ({ page }) => {
await page.goto(`/create`);
test('Create article', async ({ page }) => {
await page.goto('/edit/new');
await page.locator('li').filter({ hasText: 'статья' }).locator('img').click();
});
test('Check Draft', async ({ page }) => {
/*
}); */
test('Check Draft', async ({ page }) => {});
/* test('Drafts - create literature', async ({ page }) => {
test('Drafts - create literature', async ({ page }) => {
await page.getByRole('button', { name: 'Т.Р' }).click();
await page.getByRole('link', { name: 'Черновики' }).click();
await page.getByRole('link', { name: 'Создать публикацию' }).click();
await page.locator('li').filter({ hasText: /^литература$/ }).locator('img').click();
Fill the form
Save
Check is it created
}); */
});
*/
/* test('Drafts - create images', async ({ page }) => {
await page.getByRole('button', { name: 'Т.Р' }).click();
@ -107,15 +106,15 @@ test('Check Draft', async ({ page }) => {
Check is it created
}); */
/* test('Drafts - create music', async ({ page }) => {
await page.getByRole('button', { name: 'Т.Р' }).click();
test('Drafts - create music', async ({ page }) => {
await page.getByRole('button', { name: 'Т.Р.' }).click();
await page.getByRole('link', { name: 'Черновики' }).click();
await page.getByRole('link', { name: 'Создать публикацию' }).click();
await page.locator('li').filter({ hasText: 'музыка' }).locator('img').click();
Fill the form
Save
Check is it created
}); */
// TODO: Fill the form
// TODO: Save
// TODO: Check is it created
});
/* test('Drafts - create video', async ({ page }) => {
await page.getByRole('button', { name: 'Т.Р' }).click();