8000 Add e2e test + improve logging by nimrossum · Pull Request #633 · git-truck/git-truck · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add e2e test + improve logging #633

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
May 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LOG_LEVEL=debug
29 changes: 29 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Playwright Tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Fetch main branch
run: git fetch origin main:main
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
run: npm run test:e2e
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
2 changes: 1 addition & 1 deletion .github/workflows/test-and-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
cache: 'npm'

- run: npm ci
- run: npm test
- run: npm run test:unit
- run: npm run build
- run: npm run tsc

Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,9 @@ data.json
coverage
.eslintcache
cli.js
/test-results/
/playwright-report/
/playwright/.cache/
/test-results/
/playwright-report/
/playwright/.cache/
7 changes: 6 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
{
"recommendations": ["esbenp.prettier-vscode", "bradlc.vscode-tailwindcss", "Orta.vscode-jest"]
"recommendations": [
"esbenp.prettier-vscode",
"bradlc.vscode-tailwindcss",
"Orta.vscode-jest",
"ms-playwright.playwright"
]
}
22 changes: 22 additions & 0 deletions e2e/features/navigate-to-a-repository.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { test, expect } from "@playwright/test"

test("navigate to a repository", async ({ page }) => {
await page.goto("/")

// Expect a title "to contain" a substring.
await expect(page).toHaveTitle(/Git Truck/)

const gitTruckCard = page.locator(".card", { has: page.locator("text=git-truck") })

// Select an option from a <select> dropdown.
await gitTruckCard.locator("select").selectOption("main")
// Click the analyze button.
await gitTruckCard
.getByRole("link", {
name: "Analyze",
})
.click()

await page.waitForURL("/git-truck/main")
await page.waitForSelector("text=See more repositories")
})
13 changes: 13 additions & 0 deletions e2e/features/see-more-repositories.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { test, expect } from "@playwright/test"

test("see more repositories", async ({ page }) => {
await page.goto("/git-truck/main")
// Expect a title "to contain" a substring.
await expect(page).toHaveTitle(/Git Truck/)
// Click the get started link.
await page.getByRole("link", { name: "See more repositories" }).click()
await page.waitForLoadState("domcontentloaded")
await page.waitForSelector("text=🚛 Git Truck")
// Expect to have navigated to the home page.
await expect(page).toHaveURL("/")
})
Loading
0