Skip to content
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

chore: fuels UI integration test script to TS script #3478

Closed
wants to merge 6 commits into from
Closed
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
5 changes: 5 additions & 0 deletions .changeset/brave-mayflies-shake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"fuels": patch
---

chore: `fuels` UI integration test script to TS script
342 changes: 189 additions & 153 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion templates/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"start": "next start",
"lint": "next lint",
"test": "vitest",
"test:ui": "./test/ui/test-ui.sh"
"test:ui": "tsx ./test/ui/test-ui.ts"
},
"dependencies": {
"@fuels/connectors": "^0.27.1",
Expand All @@ -37,6 +37,7 @@
"eslint-config-next": "14.2.15",
"postcss": "^8.4.49",
"tailwindcss": "^3.4.14",
"tsx": "^4.19.1",
"typescript": "~5.6.3",
"vitest": "~2.0.5"
}
Expand Down
9 changes: 0 additions & 9 deletions templates/nextjs/test/ui/test-ui.sh

This file was deleted.

29 changes: 29 additions & 0 deletions templates/nextjs/test/ui/test-ui.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { execSync } from 'child_process';

/**
* Runs UI tests using Playwright
* @returns Exit code from the test execution
*/
function runTests(): number {
try {
// Install Playwright dependencies silently
execSync('pnpm exec playwright install --with-deps', {
stdio: 'ignore',
});

// Run the tests
execSync('pnpm exec playwright test', {
stdio: 'inherit', // This will show the test output in the console
});

return 0; // Success
} catch (error) {
if (error instanceof Error && 'status' in error && typeof error.status === 'number') {
return error.status; // Return the actual error code from Playwright
}
return 1; // Generic error if we can't get the specific status
}
}

// Run the tests and exit with the appropriate code
process.exit(runTests());
3 changes: 2 additions & 1 deletion templates/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"lint": "eslint .",
"fuels:dev": "fuels dev",
"test": "vitest",
"test:ui": "./test/ui/test-ui.sh"
"test:ui": "tsx ./test/ui/test-ui.ts"
},
"dependencies": {
"@fuels/connectors": "^0.27.1",
Expand Down Expand Up @@ -41,6 +41,7 @@
"tailwindcss": "^3.4.14",
"typescript": "~5.6.3",
"typescript-eslint": "^8.8.0",
"tsx": "^4.19.1",
"vite": "^5.4.9",
"vitest": "~2.0.5"
}
Expand Down
9 changes: 0 additions & 9 deletions templates/vite/test/ui/test-ui.sh

This file was deleted.

29 changes: 29 additions & 0 deletions templates/vite/test/ui/test-ui.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { execSync } from 'child_process';

/**
* Runs UI tests using Playwright
* @returns Exit code from the test execution
*/
function runTests(): number {
try {
// Install Playwright dependencies silently
execSync('pnpm exec playwright install --with-deps', {
stdio: 'ignore',
});

// Run the tests
execSync('pnpm exec playwright test', {
stdio: 'inherit', // This will show the test output in the console
});

return 0; // Success
} catch (error) {
if (error instanceof Error && 'status' in error && typeof error.status === 'number') {
return error.status; // Return the actual error code from Playwright
}
return 1; // Generic error if we can't get the specific status
}
}

// Run the tests and exit with the appropriate code
process.exit(runTests());
Loading