-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
144 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
config: | ||
# This is a test server run by team Artillery | ||
# It's designed to be highly scalable | ||
target: https://mainnet-ccv.cardanoapi.io | ||
phases: | ||
- duration: 20 | ||
arrivalRate: 1 | ||
rampTo: 5 | ||
name: Warm up phase | ||
- duration: 20 | ||
arrivalRate: 5 | ||
rampTo: 10 | ||
name: Ramp up load | ||
- duration: 30 | ||
arrivalRate: 4 | ||
rampTo: 30 | ||
name: Spike phase | ||
# Load & configure a couple of useful plugins | ||
# https://docs.art/reference/extensions | ||
plugins: | ||
ensure: {} | ||
apdex: {} | ||
metrics-by-endpoint: {} | ||
apdex: | ||
threshold: 100 | ||
ensure: | ||
thresholds: | ||
- http.response_time.p99: 500 | ||
- http.response_time.p95: 400 | ||
engines: | ||
playwright: {} | ||
# Path to JavaScript file that defines Playwright test functions | ||
processor: './flows.js' | ||
scenarios: | ||
- engine: playwright | ||
testFunction: visitPollFlow | ||
- engine: playwright | ||
testFunction: 'representativeFlow' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
|
||
async function representativeFlow(page) { | ||
// Navigate to the home page | ||
await page.goto('/'); | ||
await page.waitForLoadState('networkidle') | ||
const randomX = Math.floor(Math.random() * 63)+1; | ||
|
||
// Navigate to the generated URL | ||
await page.goto(`/representatives/${randomX}`); | ||
await page.waitForLoadState('networkidle') | ||
|
||
} | ||
|
||
async function visitPollFlow(page) { | ||
// Navigate to the home page | ||
await page.goto('/'); | ||
|
||
await page.waitForLoadState('networkidle'); | ||
|
||
// List all cards with the data-testid attribute 'poll-card-xxx' | ||
const pollCards = await page.$$('[data-testid^="poll-card-"]'); // Select all elements starting with 'poll-card-' | ||
|
||
if (pollCards.length === 0) { | ||
console.log("No poll cards found!"); | ||
return; | ||
} | ||
|
||
// Select a random poll card | ||
const randomIndex = Math.floor(Math.random() * pollCards.length); | ||
const randomPollCard = pollCards[randomIndex]; | ||
|
||
// Click on the random card | ||
await randomPollCard.click(); | ||
await page.waitForLoadState('networkidle') | ||
|
||
// You can uncomment the next line if you need to navigate to a specific page after clicking | ||
// await page.goto(`/representatives/${randomX}`); | ||
} | ||
|
||
module.exports = { representativeFlow,visitPollFlow }; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"scripts": { | ||
"start": "artillery run --output result.json ccv-flow.yml ; artillery report result.json ", | ||
"serve": "python3 -m http.server ", | ||
"report": "artillery report result.json" | ||
}, | ||
"dependencies": { | ||
"playwright": "^1.49.0" | ||
} | ||
} |