first commit
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
import { expect, test } from '@playwright/test';
|
||||
|
||||
export default () => {
|
||||
test.describe('create-channel suite', () => {
|
||||
test('creating a channel succeeds', async ({ page }) => {
|
||||
await page.goto('http://localhost:3000', {
|
||||
waitUntil: 'domcontentloaded',
|
||||
});
|
||||
await page.waitForLoadState('domcontentloaded');
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await page.getByRole('radio', { name: 'Settings' }).click();
|
||||
await page.waitForTimeout(1000);
|
||||
await page.getByText('Create Channel').click();
|
||||
await page.waitForTimeout(1000);
|
||||
await page.locator('input[name="name"]').click();
|
||||
await page.locator('input[name="name"]').fill('TestChannel');
|
||||
await page.getByRole('button', { name: 'Next' }).click();
|
||||
|
||||
await page.getByText('Add Field').first().click();
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await page.waitForSelector('input[name="key"]', { state: 'visible' });
|
||||
await page.locator('input[name="key"]').click();
|
||||
await page.locator('input[name="key"]').fill('message');
|
||||
await page.getByRole('button', { name: 'Confirm' }).click();
|
||||
|
||||
await page.getByText('Add Field').first().click();
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await page.waitForSelector('input[name="key"]', { state: 'visible' });
|
||||
await page.locator('input[name="key"]').click();
|
||||
await page.locator('input[name="key"]').fill('image');
|
||||
|
||||
await page
|
||||
.locator('select[aria-hidden="true"]')
|
||||
.first()
|
||||
.selectOption('images');
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await page.getByRole('button', { name: 'Confirm' }).click();
|
||||
|
||||
await page.getByRole('button', { name: 'Complete' }).click();
|
||||
await page.waitForTimeout(1000);
|
||||
await page.getByRole('button', { name: 'Start' }).click();
|
||||
await page.waitForTimeout(1000);
|
||||
await expect(
|
||||
page.getByRole('tab', { name: 'TestChannel' }).first(),
|
||||
).toContainText('TestChannel');
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,59 @@
|
||||
import { expect, test } from '@playwright/test';
|
||||
import axios from 'axios';
|
||||
|
||||
export default () => {
|
||||
test.describe('create-feedback-with-image suite', () => {
|
||||
test.afterEach(async ({ page }) => {
|
||||
await page.getByText('test text').first().click();
|
||||
await page.waitForTimeout(1000);
|
||||
await page.getByRole('button', { name: 'Delete' }).click();
|
||||
|
||||
await expect(page.getByText('Delete').nth(3)).toBeVisible();
|
||||
await page.getByText('Delete').nth(3).click();
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await expect(page.locator('tbody')).not.toContainText('test text');
|
||||
});
|
||||
|
||||
test('creating a feedback with image succeeds', async ({ page }) => {
|
||||
await page.goto('http://localhost:3000', {
|
||||
waitUntil: 'domcontentloaded',
|
||||
});
|
||||
|
||||
await page.getByRole('radio', { name: 'Feedback' }).click();
|
||||
await page.waitForURL(/.*channelId.*/, { timeout: 10000 });
|
||||
|
||||
await expect(page.getByText('There is no data yet')).toBeVisible();
|
||||
|
||||
const url = new URL(page.url());
|
||||
const pathname = url.pathname;
|
||||
const segments = pathname.split('/');
|
||||
const projectId = segments[3];
|
||||
const params = new URLSearchParams(url.search);
|
||||
const channelId = params.get('channelId');
|
||||
|
||||
await axios.post(
|
||||
`http://localhost:4000/api/projects/${projectId}/channels/${channelId}/feedbacks`,
|
||||
{
|
||||
message: 'test text',
|
||||
image: [
|
||||
'https://lps-editor-2050.landpress.line.me/logo/logo_line_color.svg',
|
||||
],
|
||||
},
|
||||
{ headers: { 'x-api-key': 'MASTER_API_KEY' } },
|
||||
);
|
||||
|
||||
await page.goto(
|
||||
`http://localhost:3000/main/project/${projectId}/feedback?channelId=${channelId}`,
|
||||
{ waitUntil: 'domcontentloaded' },
|
||||
);
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await page.getByText('Image').nth(1).click();
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await page.getByText('Cancel').nth(1).click();
|
||||
await page.waitForTimeout(1000);
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,73 @@
|
||||
import { expect, test } from '@playwright/test';
|
||||
import axios from 'axios';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
export default () => {
|
||||
test.describe('create-feedback suite', () => {
|
||||
test.afterEach(async ({ page }) => {
|
||||
await page.getByText('test text').first().click();
|
||||
await page.getByRole('button', { name: 'Delete' }).click();
|
||||
|
||||
await expect(page.getByText('Delete').nth(3)).toBeVisible();
|
||||
await page.getByText('Delete').nth(3).click();
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await expect(page.locator('tbody')).not.toContainText('test text');
|
||||
});
|
||||
|
||||
test('creating a feedback succeeds', async ({ page }) => {
|
||||
await page.goto('http://localhost:3000', {
|
||||
waitUntil: 'domcontentloaded',
|
||||
});
|
||||
|
||||
await page.getByRole('radio', { name: 'Feedback' }).click();
|
||||
await page.waitForURL(/.*channelId.*/, { timeout: 10000 });
|
||||
|
||||
await expect(page.getByText('There is no data yet')).toBeVisible();
|
||||
|
||||
const url = new URL(page.url());
|
||||
const pathname = url.pathname;
|
||||
const segments = pathname.split('/');
|
||||
const projectId = segments[3];
|
||||
const params = new URLSearchParams(url.search);
|
||||
const channelId = params.get('channelId');
|
||||
|
||||
await axios.post(
|
||||
`http://localhost:4000/api/projects/${projectId}/channels/${channelId}/feedbacks`,
|
||||
{
|
||||
message: 'test text',
|
||||
},
|
||||
{ headers: { 'x-api-key': 'MASTER_API_KEY' } },
|
||||
);
|
||||
|
||||
await page.goto(
|
||||
`http://localhost:3000/main/project/${projectId}/feedback?channelId=${channelId}`,
|
||||
{ waitUntil: 'domcontentloaded' },
|
||||
);
|
||||
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await expect(page.locator('tbody')).toContainText('test text');
|
||||
|
||||
let dateSelector = page.getByText(
|
||||
`${dayjs().subtract(364, 'day').format('YYYY-MM-DD')} ~ ${dayjs().format('YYYY-MM-DD')}`,
|
||||
);
|
||||
|
||||
await expect(dateSelector).toBeVisible();
|
||||
await dateSelector.click();
|
||||
await page.getByText('Yesterday').click();
|
||||
await page.getByText('Save').click();
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await expect(page.getByText('There is no data yet')).toBeVisible();
|
||||
|
||||
dateSelector = page.getByText(
|
||||
`${dayjs().subtract(1, 'day').format('YYYY-MM-DD')} ~ ${dayjs().subtract(1, 'day').format('YYYY-MM-DD')}`,
|
||||
);
|
||||
await dateSelector.click();
|
||||
await page.getByText('Today').click();
|
||||
await page.getByText('Save').click();
|
||||
await page.waitForTimeout(1000);
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,83 @@
|
||||
import { expect, test } from '@playwright/test';
|
||||
import axios from 'axios';
|
||||
|
||||
export default () => {
|
||||
test.describe('create-issue suite', () => {
|
||||
test.afterEach(async ({ page }) => {
|
||||
await page
|
||||
.getByRole('button', { name: 'Delete' })
|
||||
.click({ timeout: 1000 });
|
||||
|
||||
await expect(page.getByText('Delete').nth(3)).toBeVisible();
|
||||
await page.getByText('Delete').nth(3).click();
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await expect(page.locator('tbody')).not.toContainText('test text');
|
||||
});
|
||||
|
||||
test('creating an issue and attaching it to a feedback succeeds', async ({
|
||||
page,
|
||||
}) => {
|
||||
await page.goto('http://localhost:3000', {
|
||||
waitUntil: 'domcontentloaded',
|
||||
});
|
||||
|
||||
await page.getByRole('radio', { name: 'Issue' }).click();
|
||||
await page.getByRole('button', { name: 'Create Issue' }).click();
|
||||
await page.waitForTimeout(1000);
|
||||
await page.getByPlaceholder('Please enter.').first().fill('test_issue');
|
||||
await page.getByRole('button', { name: 'Save' }).click();
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await page.getByRole('radio', { name: 'Feedback' }).click();
|
||||
await page.waitForURL(/.*channelId.*/, { timeout: 1000 });
|
||||
|
||||
await expect(page.getByText('There is no data yet')).toBeVisible();
|
||||
|
||||
const url = new URL(page.url());
|
||||
const pathname = url.pathname;
|
||||
const segments = pathname.split('/');
|
||||
const projectId = segments[3];
|
||||
const params = new URLSearchParams(url.search);
|
||||
const channelId = params.get('channelId');
|
||||
|
||||
await axios.post(
|
||||
`http://localhost:4000/api/projects/${projectId}/channels/${channelId}/feedbacks`,
|
||||
{
|
||||
message: 'test text',
|
||||
},
|
||||
{ headers: { 'x-api-key': 'MASTER_API_KEY' } },
|
||||
);
|
||||
|
||||
await page.goto(
|
||||
`http://localhost:3000/main/project/${projectId}/feedback?channelId=${channelId}`,
|
||||
{ waitUntil: 'domcontentloaded' },
|
||||
);
|
||||
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
await expect(page.locator('tbody')).toContainText('test text');
|
||||
|
||||
await page.getByRole('button', { name: '+' }).first().click();
|
||||
const testIssue = page.getByText('test_issue').first();
|
||||
await expect(testIssue).toBeVisible();
|
||||
await testIssue.click();
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await page.getByRole('button', { name: '+' }).first().click();
|
||||
|
||||
await page.getByText('test text').first().click();
|
||||
|
||||
await page.getByRole('button', { name: '+' }).first().click();
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await page.keyboard.insertText('test_issue2');
|
||||
|
||||
await page.getByText('Create', { exact: true }).click();
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await page.keyboard.press('Enter');
|
||||
await page.waitForTimeout(1000);
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,71 @@
|
||||
import { expect, test } from '@playwright/test';
|
||||
import axios from 'axios';
|
||||
|
||||
const NUMBER_OF_FEEDBACKS = 25;
|
||||
|
||||
export default () => {
|
||||
test.describe('create-multiple-feedbacks suite', () => {
|
||||
test.afterEach(async ({ page }) => {
|
||||
await page.getByRole('checkbox').nth(1).click();
|
||||
|
||||
await page.getByText('Delete Feedback').click();
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await page.getByRole('button', { name: 'Delete' }).click();
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await page.getByRole('checkbox').first().click();
|
||||
|
||||
await page.getByText('Delete Feedback').click();
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await page.getByRole('button', { name: 'Delete' }).click();
|
||||
await page.waitForTimeout(1000);
|
||||
});
|
||||
|
||||
test('creating multiple feedbacks succeeds', async ({ page }) => {
|
||||
await page.goto('http://localhost:3000', {
|
||||
waitUntil: 'domcontentloaded',
|
||||
});
|
||||
|
||||
await page.getByRole('radio', { name: 'Feedback' }).click();
|
||||
await page.waitForURL(/.*channelId.*/, { timeout: 10000 });
|
||||
|
||||
await expect(page.getByText('There is no data yet')).toBeVisible();
|
||||
|
||||
const url = new URL(page.url());
|
||||
const pathname = url.pathname;
|
||||
const segments = pathname.split('/');
|
||||
const projectId = segments[3];
|
||||
const params = new URLSearchParams(url.search);
|
||||
const channelId = params.get('channelId');
|
||||
|
||||
for (let i = 0; i < NUMBER_OF_FEEDBACKS; i++) {
|
||||
await axios.post(
|
||||
`http://localhost:4000/api/projects/${projectId}/channels/${channelId}/feedbacks`,
|
||||
{
|
||||
message: `test text ${i}`,
|
||||
},
|
||||
{ headers: { 'x-api-key': 'MASTER_API_KEY' } },
|
||||
);
|
||||
}
|
||||
|
||||
await page.goto(
|
||||
`http://localhost:3000/main/project/${projectId}/feedback?channelId=${channelId}`,
|
||||
{ waitUntil: 'domcontentloaded' },
|
||||
);
|
||||
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await expect(page.locator('tbody')).toContainText('test text');
|
||||
|
||||
await expect(page.getByText('Page 1 of 2')).toBeVisible();
|
||||
|
||||
await page.getByRole('button', { name: '20', exact: true }).click();
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await page.getByRole('menuitem', { name: '30', exact: true }).click();
|
||||
await page.waitForTimeout(1000);
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,39 @@
|
||||
import { expect, test } from '@playwright/test';
|
||||
|
||||
export default () => {
|
||||
test('creating a project succeeds', async ({ page }) => {
|
||||
await page.goto('http://localhost:3000/main/project/create', {
|
||||
waitUntil: 'domcontentloaded',
|
||||
});
|
||||
|
||||
await expect(page.getByRole('button', { name: 'Next' })).toBeVisible({
|
||||
timeout: 1000,
|
||||
});
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await page.getByRole('button', { name: 'Next' }).click();
|
||||
await page.getByRole('button', { name: 'Next' }).click();
|
||||
await page.getByRole('button', { name: 'Confirm' }).click();
|
||||
|
||||
await page.locator("input[name='name']").click();
|
||||
await page.locator("input[name='name']").fill('TestProject');
|
||||
|
||||
await page.getByRole('button', { name: 'Next' }).click();
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await page.getByRole('button', { name: 'Next' }).click();
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await page.getByRole('button', { name: 'Complete' }).click();
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await expect(
|
||||
page.getByRole('heading', {
|
||||
level: 2,
|
||||
name: /project creation complete/i,
|
||||
}),
|
||||
).toBeVisible();
|
||||
await expect(page.locator("input[name='name']")).toHaveValue('TestProject');
|
||||
await page.getByRole('button', { name: 'Later' }).click();
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,102 @@
|
||||
import { expect, test } from '@playwright/test';
|
||||
import axios from 'axios';
|
||||
|
||||
export default () => {
|
||||
test.describe('search-feedback suite', () => {
|
||||
test('creating and searching a feedback succeed', async ({ page }) => {
|
||||
await page.goto('http://localhost:3000', {
|
||||
waitUntil: 'domcontentloaded',
|
||||
});
|
||||
|
||||
await page.getByRole('radio', { name: 'Feedback' }).click();
|
||||
await page.waitForURL(/.*channelId.*/, { timeout: 10000 });
|
||||
|
||||
await expect(page.getByText('There is no data yet')).toBeVisible();
|
||||
|
||||
const url = new URL(page.url());
|
||||
const pathname = url.pathname;
|
||||
const segments = pathname.split('/');
|
||||
const projectId = segments[3];
|
||||
const params = new URLSearchParams(url.search);
|
||||
const channelId = params.get('channelId');
|
||||
|
||||
await axios.post(
|
||||
`http://localhost:4000/api/projects/${projectId}/channels/${channelId}/feedbacks`,
|
||||
{
|
||||
message: 'test text1',
|
||||
},
|
||||
{ headers: { 'x-api-key': 'MASTER_API_KEY' } },
|
||||
);
|
||||
|
||||
await axios.post(
|
||||
`http://localhost:4000/api/projects/${projectId}/channels/${channelId}/feedbacks`,
|
||||
{
|
||||
message: 'test text2',
|
||||
},
|
||||
{ headers: { 'x-api-key': 'MASTER_API_KEY' } },
|
||||
);
|
||||
|
||||
await page.goto(
|
||||
`http://localhost:3000/main/project/${projectId}/feedback?channelId=${channelId}`,
|
||||
{ waitUntil: 'domcontentloaded' },
|
||||
);
|
||||
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await expect(page.locator('tbody')).toContainText('test text1');
|
||||
await expect(page.locator('tbody')).toContainText('test text2');
|
||||
|
||||
await page.getByText('Filter').click();
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await page.getByRole('button', { name: 'ID' }).click();
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await page.getByRole('option', { name: 'message' }).click();
|
||||
|
||||
await page.getByPlaceholder('Please enter').fill('test text1');
|
||||
|
||||
await page.getByRole('button', { name: 'Confirm' }).click();
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await expect(page.locator('tbody')).toContainText('test text1');
|
||||
await expect(page.locator('tbody')).not.toContainText('test text2');
|
||||
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await page.getByText('Filter').click();
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await page.getByText('Add Filter').click();
|
||||
|
||||
await page.getByRole('button', { name: 'ID' }).click();
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await page.getByRole('option', { name: 'message' }).click();
|
||||
|
||||
await page.getByPlaceholder('Please enter').nth(1).fill('test text2');
|
||||
|
||||
await page.getByText('And', { exact: true }).click();
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await page.getByRole('option', { name: 'Or', exact: true }).click();
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await page.getByRole('button', { name: 'Confirm' }).click();
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await expect(page.locator('tbody')).toContainText('test text1');
|
||||
await expect(page.locator('tbody')).toContainText('test text2');
|
||||
|
||||
await page.getByText('View').click();
|
||||
await page.getByText('ID').nth(1).click();
|
||||
await page.getByText('Created').nth(1).click();
|
||||
await page.getByText('Updated').nth(1).click();
|
||||
|
||||
await page.getByText('Expand').first().click();
|
||||
await page.waitForTimeout(1000);
|
||||
await page.getByText('Expand').first().click();
|
||||
await page.waitForTimeout(1000);
|
||||
});
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user