Skip to content

Commit

Permalink
added options to run rv and nv
Browse files Browse the repository at this point in the history
  • Loading branch information
bidodev committed Sep 30, 2024
1 parent 05a6c3c commit c4a8cdf
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
container: node:20
strategy:
matrix:
project: [vite-vite, vite-webpack-rspack]
project: [nuxt-vite, rust-vite, vite-vite, multi-example]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -42,6 +42,12 @@ jobs:
if [ "${{ matrix.project }}" = "vite-vite" ]; then
nohup pnpm run dev-vv &
pnpm exec wait-on http://localhost:5175;
elif [ "${{ matrix.project }}" = "nuxt-vite" ]; then
nohup pnpm run dev-nv &
pnpm exec wait-on http://localhost:3001;
elif [ "${{ matrix.project }}" = "rust-vite" ]; then
nohup pnpm run dev-rv &
pnpm exec wait-on http://localhost:5172;
else
nohup pnpm run multi-example &
pnpm exec wait-on http://localhost:5173;
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ dist
.idea
.__mf__win
lib
**/.__mf__temp
**/.__mf__temp
reports/*
nohup.out
15 changes: 15 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

# Format staged files
npx pretty-quick --staged

# Build project
pnpm build

# Check if the server is already running on http://localhost:5173
if ! pnpm exec wait-on http://localhost:5173 --timeout 5000; then
# If not running, start multi-example in the background
pnpm run multi-example &
# Wait for the server to be ready before proceeding
pnpm exec wait-on http://localhost:5173
fi

# Run Playwright tests after ensuring the server is up
pnpm playwright test --project=vite-webpack-rspack
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"source.organizeImports": "always",
"source.fixAll": "always"
},
"editor.formatOnSave": true
"editor.formatOnSave": true,
"cSpell.words": ["microfrontend"]
}
14 changes: 6 additions & 8 deletions e2e/nuxt-vite/tests/example.spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import { expect, test } from '@playwright/test';

test('example.com basic test', async ({ page }) => {
// Go to example.com
await page.goto('https://example.com');
test('example.com basic test', async ({ page, baseURL }) => {
await page.goto(baseURL!);

// Check the title of the page
await expect(page).toHaveTitle('Example Domain');
// Get the heading by role with exact name 'Rust Host'
const heading = page.getByRole('heading', { name: 'Nuxt Host', exact: true });

// Check if the heading exists on the page
const heading = page.locator('h1');
await expect(heading).toHaveText('Example Domain');
// Expect the heading to be visible
await expect(heading).toBeVisible();
});
1 change: 0 additions & 1 deletion examples/rust-vite/rust-host/rsbuild.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { pluginReact } from '@rsbuild/plugin-react';
export default defineConfig({
server: {
port: 5172,
open: true,
},
dev: {
// It is necessary to configure assetPrefix, and in the production environment, you need to configure output.assetPrefix
Expand Down
1 change: 0 additions & 1 deletion examples/rust-vite/vite-remote/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import topLevelAwait from 'vite-plugin-top-level-await';
// https://vitejs.dev/config/
export default defineConfig({
server: {
open: true,
port: 5173,
},
base: 'http://localhost:5173',
Expand Down
6 changes: 3 additions & 3 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default defineConfig({
},
},
{
name: 'vite-webpack-rspack',
name: 'multi-example',
testDir: 'e2e/vite-webpack-rspack',
use: {
baseURL: 'http://localhost:5173',
Expand All @@ -48,7 +48,7 @@ export default defineConfig({
outputDir: 'reports/e2e/output',
reporter: [
['list'],
['html', { outputFolder: 'playwright-report', open: 'never' }],
['json', { outputFile: 'test-results.json' }],
['html', { outputFolder: 'reports/e2e/playwright-report', open: 'never' }],
['json', { outputFile: 'reports/e2e/test-results.json' }],
],
});

0 comments on commit c4a8cdf

Please sign in to comment.