Skip to content

Commit

Permalink
add recordings for artillery
Browse files Browse the repository at this point in the history
  • Loading branch information
nachocodoner committed Jul 22, 2024
1 parent f7003ba commit b89bea4
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 28 deletions.
2 changes: 1 addition & 1 deletion packages/tasks-common/tasks-common.client.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const App = () => {
<div style={{ display: 'flex' }}>
<button className="add-task" onClick={onAddClick} style={{ margin: 4 }}>Add task</button>
<button className="remove-task" onClick={onRemoveClick} style={{ margin: 4 }}>Remove task</button>
<button className="remove-all-tasks" onClick={onRemoveAllClick} style={{ margin: 4 }}>Remove all task</button>
<button className="remove-all-tasks" onClick={onRemoveAllClick} style={{ margin: 4 }}>Remove all tasks</button>
</div>
{reactive ? <AppReactive tasks={tasks} setTasks={setTasks} /> : <AppNonReactive tasks={tasks} setTasks={setTasks} fetchTasks={fetchTasks} />}
</div>
Expand Down
19 changes: 10 additions & 9 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { defineConfig, devices } from '@playwright/test';
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
timeout: 260_000,
testDir: './tests',
/* Run tests in files in parallel */
fullyParallel: true,
Expand Down Expand Up @@ -38,15 +39,15 @@ export default defineConfig({
use: { ...devices['Desktop Chrome'] },
},

{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
},

{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
},
// {
// name: 'firefox',
// use: { ...devices['Desktop Firefox'] },
// },
//
// {
// name: 'webkit',
// use: { ...devices['Desktop Safari'] },
// },

/* Test against mobile viewports. */
// {
Expand Down
18 changes: 0 additions & 18 deletions tests/example.spec.ts

This file was deleted.

8 changes: 8 additions & 0 deletions tests/non-reactive.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { test, expect } from '@playwright/test';
import { addAndRemoveTasks } from './test-helpers';

const taskCount = parseFloat(process.env.TASK_COUNT || 500);

test('non-reactive', async ({ page }) => {
await addAndRemoveTasks({ page, reactive: false, taskCount});
});
8 changes: 8 additions & 0 deletions tests/reactive.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { test, expect } from '@playwright/test';
import { addAndRemoveTasks } from './test-helpers';

const taskCount = parseFloat(process.env.TASK_COUNT || 500);

test('reactive', async ({ page }) => {
await addAndRemoveTasks({ page, reactive: true, taskCount });
});
22 changes: 22 additions & 0 deletions tests/test-helpers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
export const addAndRemoveTasks = async ({ page, reactive, taskCount }) => {
await page.goto('http://localhost:3000/');
await page.getByLabel(reactive ? 'Reactive' : 'No Reactive', { exact: true }).check();

await page.getByRole('button', { name: 'Remove all tasks' }).click();

const tasks = Array.from({ length: taskCount });
let addedNum = 1;
for await (const _addTask of tasks) {
await page.getByRole('button', { name: 'Add task' }).click();
await page.waitForSelector(`text="New Task ${addedNum}"`, { state: 'visible' });
addedNum += 1;
}
let removedNum = 1;
for await (const _removeTask of tasks) {
await page.getByRole('button', { name: 'Remove task' }).click();
await page.waitForSelector(`text="New Task ${removedNum}"`, { state: 'detached' });
removedNum += 1;
}

await page.getByRole('button', { name: 'Remove all tasks' }).click();
};

0 comments on commit b89bea4

Please sign in to comment.