e2e-wip
This commit is contained in:
parent
6db49c2296
commit
ae4ec7b6b7
|
@ -17,7 +17,7 @@ export default defineConfig({
|
||||||
/* Fail the build on CI if you accidentally left test.only in the source code. */
|
/* Fail the build on CI if you accidentally left test.only in the source code. */
|
||||||
forbidOnly: !!process.env.CI,
|
forbidOnly: !!process.env.CI,
|
||||||
/* Retry on CI only */
|
/* Retry on CI only */
|
||||||
retries: process.env.CI ? 2 : 0,
|
retries: 0,
|
||||||
/* Opt out of parallel tests on CI. */
|
/* Opt out of parallel tests on CI. */
|
||||||
workers: process.env.CI ? 1 : undefined,
|
workers: process.env.CI ? 1 : undefined,
|
||||||
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
|
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
|
||||||
|
|
|
@ -60,18 +60,6 @@ test.afterAll(async () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
/* TESTS section */
|
/* 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 }) => {
|
test.beforeEach(async ({ page }) => {
|
||||||
await page.goto('/')
|
await page.goto('/')
|
||||||
/* test.setTimeout(80000); */
|
/* test.setTimeout(80000); */
|
||||||
|
@ -104,26 +92,4 @@ test.describe('Topic Actions', () => {
|
||||||
await page.getByRole('button', { name: 'Отписаться от темы' }).click()
|
await page.getByRole('button', { name: 'Отписаться от темы' }).click()
|
||||||
await expect(page.getByRole('button', { name: 'Подписаться на тему' })).toBeVisible()
|
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()
|
|
||||||
})
|
|
||||||
})
|
})
|
|
@ -78,24 +78,23 @@ test.describe('*****Undone***** Drafts - article', () => {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
/* test('Create article', async ({ page }) => {
|
test('Create article', async ({ page }) => {
|
||||||
await page.goto(`/create`);
|
await page.goto('/edit/new');
|
||||||
await page.locator('li').filter({ hasText: 'статья' }).locator('img').click();
|
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('button', { name: 'Т.Р' }).click();
|
||||||
await page.getByRole('link', { name: 'Черновики' }).click();
|
await page.getByRole('link', { name: 'Черновики' }).click();
|
||||||
await page.getByRole('link', { name: 'Создать публикацию' }).click();
|
await page.getByRole('link', { name: 'Создать публикацию' }).click();
|
||||||
await page.locator('li').filter({ hasText: /^литература$/ }).locator('img').click();
|
await page.locator('li').filter({ hasText: /^литература$/ }).locator('img').click();
|
||||||
Fill the form
|
});
|
||||||
Save
|
|
||||||
Check is it created
|
*/
|
||||||
}); */
|
|
||||||
|
|
||||||
/* test('Drafts - create images', async ({ page }) => {
|
/* test('Drafts - create images', async ({ page }) => {
|
||||||
await page.getByRole('button', { name: 'Т.Р' }).click();
|
await page.getByRole('button', { name: 'Т.Р' }).click();
|
||||||
|
@ -107,15 +106,15 @@ test('Check Draft', async ({ page }) => {
|
||||||
Check is it created
|
Check is it created
|
||||||
}); */
|
}); */
|
||||||
|
|
||||||
/* test('Drafts - create music', async ({ page }) => {
|
test('Drafts - create music', async ({ page }) => {
|
||||||
await page.getByRole('button', { name: 'Т.Р' }).click();
|
await page.getByRole('button', { name: 'Т.Р.' }).click();
|
||||||
await page.getByRole('link', { name: 'Черновики' }).click();
|
await page.getByRole('link', { name: 'Черновики' }).click();
|
||||||
await page.getByRole('link', { name: 'Создать публикацию' }).click();
|
await page.getByRole('link', { name: 'Создать публикацию' }).click();
|
||||||
await page.locator('li').filter({ hasText: 'музыка' }).locator('img').click();
|
await page.locator('li').filter({ hasText: 'музыка' }).locator('img').click();
|
||||||
Fill the form
|
// TODO: Fill the form
|
||||||
Save
|
// TODO: Save
|
||||||
Check is it created
|
// TODO: Check is it created
|
||||||
}); */
|
});
|
||||||
|
|
||||||
/* test('Drafts - create video', async ({ page }) => {
|
/* test('Drafts - create video', async ({ page }) => {
|
||||||
await page.getByRole('button', { name: 'Т.Р' }).click();
|
await page.getByRole('button', { name: 'Т.Р' }).click();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user