Skip to content

Commit

Permalink
added outline of tests
Browse files Browse the repository at this point in the history
  • Loading branch information
danreale committed Sep 20, 2024
1 parent 5b936ee commit 48ecb07
Show file tree
Hide file tree
Showing 4 changed files with 208 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Install Playwright Browsers
run: npx playwright install --with-deps chromium
- name: Run Playwright tests
run: npx playwright test
run: npx playwright test Transplant.spec.ts
- uses: actions/upload-artifact@v4
if: always()
with:
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/playwright_smoke.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Smoke Tests
on:
push:
branches: [ main ]
workflow_dispatch:
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps chromium
- name: Run Playwright tests
run: npx playwright test E2E.spec.ts
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
- name: Run k6 tests
uses: grafana/[email protected]
with:
filename: load_tests/hearttransplant.js
- name: Store k6 report
uses: actions/upload-artifact@v4
if: always()
with:
name: k6-summary-report.html
path: HeartTransplant.html
119 changes: 119 additions & 0 deletions load_tests/hearttransplant.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
import { group, check } from "k6";
import http from "k6/http";
import { htmlReport } from "https://raw.githubusercontent.com/benc-uk/k6-reporter/main/dist/bundle.js";
import { textSummary } from "https://jslib.k6.io/k6-summary/0.0.4/index.js";
import { randomItem } from "https://jslib.k6.io/k6-utils/1.2.0/index.js";

export const options = {
// insecureSkipTLSVerify: true,
ext: {},
thresholds: {
http_req_failed: ["rate<0.01"],
http_req_duration: ["p(90) < 2000", "p(95) < 3000", "p(99.9) < 5000"],
checks: ["rate>0.9"],
},
stages: [
{ target: 1, duration: "10s" },
// { target: 2, duration: "10s" },
// { target: 5, duration: "30s" },
// { target: 0, duration: "10s" },
],
};

const raceData = [
{ captureDate: "2024-02-25", raceDate: "2024-02-24", track: "OP", race: "1" },
{ captureDate: "2024-02-26", raceDate: "2024-02-25", track: "OP", race: "4" },
{
captureDate: "2024-02-25",
raceDate: "2024-02-24",
track: "AQU",
race: "6",
},
{
captureDate: "2024-02-26",
raceDate: "2024-02-25",
track: "TAM",
race: "7",
},
{
captureDate: "2024-02-27",
raceDate: "2024-02-26",
track: "MVD",
race: "4",
},
];

export function handleSummary(data) {
return {
"HeartTransplant.html": htmlReport(data),
"HeartTransplant.json": JSON.stringify(data),
stdout: textSummary(data, { indent: " ", enableColors: true }),
};
}

export default function () {
const randomRace = randomItem(raceData);

let response;

group("Home Page", function () {
response = http.get(
"https://myhorsestable.netlify.app/kentuckyderby?_data=routes%2Fkentuckyderby._index"
);
check(response, {
"Get Derby Data": (r) => r.status === 200,
});
});

group("Today Page", function () {
response = http.get(
"https://myhorsestable.netlify.app/kentuckyderby?_data=routes%2Fkentuckyderby._index"
);
check(response, {
"Get Derby Data": (r) => r.status === 200,
});

// Wait list types
// 1a
// 1b
// 2
// 7
});

group("Yesterdays Page", function () {
response = http.get(
"https://myhorsestable.netlify.app/kentuckyderby?_data=routes%2Fkentuckyderby._index"
);
check(response, {
"Get Derby Data": (r) => r.status === 200,
});
});

group("Any Days Page", function () {
response = http.get(
"https://myhorsestable.netlify.app/kentuckyderby?_data=routes%2Fkentuckyderby._index"
);
check(response, {
"Get Derby Data": (r) => r.status === 200,
});
});

group("Region Charts Page", function () {
response = http.get(
"https://myhorsestable.netlify.app/kentuckyderby?_data=routes%2Fkentuckyderby._index"
);
check(response, {
"Get Derby Data": (r) => r.status === 200,
});
// do this for each region
});

group("USA Charts Page", function () {
response = http.get(
"https://myhorsestable.netlify.app/kentuckyderby?_data=routes%2Fkentuckyderby._index"
);
check(response, {
"Get Derby Data": (r) => r.status === 200,
});
});
}
52 changes: 52 additions & 0 deletions tests/E2E.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { test, expect } from "@playwright/test";

test.describe("End To End Tests", () => {
test("Today Page", async () => {
// go to todays page
// verify date format for todays date
// change each wait list status and make sure the data is loaded and lable is updated
// make sure the data refresh dates text is showing
// make sure the region text is showing
});
test("Yesterday Page", async () => {
// go to yesterday page
// check the date.
});
test("USA Charts", async () => {
// go to usa charts page and make sure all charts load and are visible
});
test("Region Charts", async () => {
// go to specific region chart from today page and make sure each chart is visible
});
test("Verify Region Info Popovers", async () => {
// go to todays page
// click icon and make sure list is visible
// click icon and make sure list is not visible
// verify all states for each region when the list is open
});
test("Favorite/Unfavorite Region", async () => {
// go to todays page
// favorite a region
// unfavorite a region
// check start icon
// check text color
});
test("Verify Center Count", async () => {
// get count from the database
// for a specific day verify the center count
// make sure count for today is not zero
});
test("Verify Center Count Todays Page", async () => {
// get count from the database
// go to todays page
// make sure count for today matches the db
});
test("Verify Region Counts and Trends", async () => {
// for a specific day, check all region counts and trends
// do this for each wait list type, 1a, 1b, 2, 7 and check all numbers
});
test("Verify Footer Elements", async () => {
// buy me a coffe
// email link
});
});

0 comments on commit 48ecb07

Please sign in to comment.