-
Notifications
You must be signed in to change notification settings - Fork 4k
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(dashboard): user journey smoke tests #7124
base: next
Are you sure you want to change the base?
Changes from 40 commits
e12abe9
9f22ad5
d0a3333
ceabff2
8ad2e31
461275c
241dc38
1f5180e
ead9157
934a828
7bebc12
a7e8329
c253764
fa860f3
8c8cb67
ba8bf3a
ebc6c37
2f7b4cf
d7f56de
1aa027a
addf0fa
8a70a51
76c80c0
a1a5a6b
9c8f28c
674861a
5727282
5d0de32
ad68574
b670d88
5d69645
d2ff14b
c69cd24
97c5bd7
ee801ab
fb8c6dd
c1565e1
5491022
f8ceff9
8570e9d
8ec0afa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,6 +68,30 @@ jobs: | |
with: | ||
submodules: true | ||
|
||
- name: Create .env file for the Dashboard app | ||
working-directory: apps/dashboard | ||
run: | | ||
touch .env | ||
echo VITE_LAUNCH_DARKLY_CLIENT_SIDE_ID=${{ secrets.LAUNCH_DARKLY_CLIENT_SIDE_ID }} >> .env | ||
echo VITE_API_HOSTNAME=http://127.0.0.1:1336 >> .env | ||
echo VITE_WEBSOCKET_HOSTNAME=http://127.0.0.1:1340 >> .env | ||
echo VITE_LEGACY_DASHBOARD_URL=http://127.0.0.1:4200 >> .env | ||
echo VITE_CLERK_PUBLISHABLE_KEY=${{ secrets.CLERK_E2E_PUBLISHABLE_KEY }} >> .env | ||
|
||
- name: Create .env file for the Playwright | ||
working-directory: apps/dashboard | ||
run: | | ||
touch .env.playwright | ||
echo NOVU_ENTERPRISE=true >> .env.playwright | ||
echo NEW_RELIC_ENABLED=false >> .env.playwright | ||
echo NEW_RELIC_APP_NAME=Novu >> .env.playwright | ||
echo MONGO_URL=mongodb://127.0.0.1:27017/novu-test >> .env.playwright | ||
echo API_URL=http://127.0.0.1:1336 >> .env.playwright | ||
echo CLERK_ENABLED=true >> .env.playwright | ||
echo CLERK_PUBLISHABLE_KEY=${{ secrets.CLERK_E2E_PUBLISHABLE_KEY }} >> .env.playwright | ||
echo CLERK_SECRET_KEY=${{ secrets.CLERK_E2E_SECRET_KEY }} >> .env.playwright | ||
echo NODE_ENV=test >> .env.playwright | ||
Comment on lines
+84
to
+93
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. .env file for the playwright, used to initialize the session, create, and sync users/orgs |
||
|
||
- uses: mansagroup/nrwl-nx-action@v3 | ||
with: | ||
targets: build | ||
|
@@ -77,30 +101,35 @@ jobs: | |
- uses: ./.github/actions/start-localstack | ||
- uses: ./.github/actions/setup-redis-cluster | ||
|
||
- uses: ./.github/actions/run-backend | ||
with: | ||
cypress_github_oauth_client_id: ${{ secrets.CYPRESS_GITHUB_OAUTH_CLIENT_ID }} | ||
cypress_github_oauth_client_secret: ${{ secrets.CYPRESS_GITHUB_OAUTH_CLIENT_SECRET }} | ||
launch_darkly_sdk_key: ${{ secrets.LAUNCH_DARKLY_SDK_KEY }} | ||
ci_ee_test: ${{ steps.determine_run_type.outputs.enterprise_run }} | ||
- name: Start API in TEST | ||
env: | ||
LAUNCH_DARKLY_SDK_KEY: ${{ secrets.LAUNCH_DARKLY_SDK_KEY }} | ||
CI_EE_TEST: true | ||
CLERK_ENABLED: true | ||
CLERK_ISSUER_URL: https://neat-mole-83.clerk.accounts.dev | ||
CLERK_SECRET_KEY: ${{ secrets.CLERK_E2E_SECRET_KEY }} | ||
run: | | ||
cd apps/api && pnpm start:test & | ||
|
||
- name: Start Worker | ||
shell: bash | ||
env: | ||
NODE_ENV: 'test' | ||
PORT: '1342' | ||
LAUNCH_DARKLY_SDK_KEY: ${{ secrets.LAUNCH_DARKLY_SDK_KEY }} | ||
CI_EE_TEST: true | ||
run: cd apps/worker && pnpm start:prod & | ||
|
||
- name: Wait on API and Worker | ||
shell: bash | ||
run: wait-on --timeout=180000 http://127.0.0.1:1336/v1/health-check http://127.0.0.1:1342/v1/health-check | ||
|
||
- name: Start WS | ||
run: | | ||
cd apps/ws && pnpm start:test & | ||
|
||
- name: Start Novu Dashboard | ||
working-directory: apps/dashboard | ||
env: | ||
REACT_APP_API_URL: http://127.0.0.1:1336 | ||
REACT_APP_WS_URL: http://127.0.0.1:1340 | ||
REACT_APP_WEBHOOK_URL: http://127.0.0.1:1341 | ||
# Disable LaunchDarkly client-side SDK in the test environment to reduce E2E flakiness | ||
REACT_APP_LAUNCH_DARKLY_CLIENT_SIDE_ID: '' | ||
NOVU_ENTERPRISE: ${{ steps.determine_run_type.outputs.enterprise_run }} | ||
run: pnpm start:static:build & | ||
|
||
- name: Wait on Services | ||
run: wait-on --timeout=180000 http://127.0.0.1:1340/v1/health-check http://127.0.0.1:4201/ | ||
run: wait-on --timeout=180000 http://127.0.0.1:1340/v1/health-check | ||
|
||
- name: Install Playwright | ||
working-directory: apps/dashboard | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
"type": "module", | ||
"scripts": { | ||
"start": "vite", | ||
"start:test": "vite --mode test", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. run dashboard and use |
||
"start:static:build": "http-server dist -p 4201 --proxy http://127.0.0.1:4201?", | ||
"dev": "pnpm start", | ||
"build": "tsc -b && vite build", | ||
|
@@ -105,9 +106,15 @@ | |
"zod": "^3.23.8" | ||
}, | ||
"devDependencies": { | ||
"@clerk/backend": "^1.6.2", | ||
"@clerk/testing": "^1.3.27", | ||
Comment on lines
+109
to
+110
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. used to create Clerk user/orgs and to sign-in into the app |
||
"@clerk/types": "^4.30.0", | ||
"@eslint/js": "^9.9.0", | ||
"@faker-js/faker": "^9.5.0", | ||
"@novu/ee-auth": "workspace:*", | ||
"@hookform/devtools": "^4.3.0", | ||
"@novu/dal": "workspace:*", | ||
"@novu/testing": "workspace:*", | ||
Comment on lines
+116
to
+117
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. used to initialize the api session |
||
"@playwright/test": "^1.46.1", | ||
"@sentry/vite-plugin": "^2.22.6", | ||
"@tiptap/core": "^2.10.3", | ||
|
@@ -121,6 +128,8 @@ | |
"@types/react-window": "^1.8.8", | ||
"@vitejs/plugin-react": "^4.3.1", | ||
"autoprefixer": "^10.4.20", | ||
"cross-fetch": "^4.0.0", | ||
"dotenv": "^16.4.5", | ||
"eslint": "^9.9.0", | ||
"eslint-plugin-react-hooks": "^5.1.0-rc.0", | ||
"eslint-plugin-react-refresh": "^0.4.9", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,9 +4,16 @@ import { defineConfig, devices } from '@playwright/test'; | |
* Read environment variables from file. | ||
* https://github.com/motdotla/dotenv | ||
*/ | ||
// import dotenv from 'dotenv'; | ||
// import path from 'path'; | ||
// dotenv.config({ path: path.resolve(__dirname, '.env') }); | ||
import dotenv from 'dotenv'; | ||
import path from 'path'; | ||
import { fileURLToPath } from 'url'; | ||
import { dirname } from 'path'; | ||
|
||
const fileName = fileURLToPath(import.meta.url); | ||
const dirName = dirname(fileName); | ||
dotenv.config({ path: path.resolve(dirName, '.env.playwright') }); | ||
Comment on lines
+12
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because the Dashboard project is configured with |
||
|
||
const baseURL = `http://localhost:4201`; | ||
|
||
/** | ||
* See https://playwright.dev/docs/test-configuration. | ||
|
@@ -24,9 +31,15 @@ export default defineConfig({ | |
/* Reporter to use. See https://playwright.dev/docs/test-reporters */ | ||
reporter: process.env.CI ? 'blob' : 'html', | ||
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ | ||
webServer: { | ||
command: 'pnpm start:test', | ||
url: baseURL, | ||
timeout: 120 * 1000, | ||
reuseExistingServer: !process.env.CI, | ||
}, | ||
use: { | ||
/* Base URL to use in actions like `await page.goto('/')`. */ | ||
baseURL: 'http://127.0.0.1:8080', | ||
baseURL: baseURL, | ||
|
||
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ | ||
trace: 'on-first-retry', | ||
|
@@ -40,7 +53,15 @@ export default defineConfig({ | |
projects: [ | ||
{ | ||
name: 'chromium', | ||
use: { ...devices['Desktop Chrome'] }, | ||
testMatch: /.*\.e2e\.ts/, | ||
use: { | ||
...devices['Desktop Chrome'], | ||
viewport: { width: 1512, height: 982 }, | ||
video: { | ||
mode: 'on-first-retry', | ||
size: { width: 1512, height: 982 }, | ||
}, | ||
}, | ||
}, | ||
], | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,8 +82,20 @@ const TagInput = forwardRef<HTMLInputElement, TagInputProps>((props, ref) => { | |
</PopoverAnchor> | ||
<div className="flex flex-wrap gap-2"> | ||
{tags.map((tag, index) => ( | ||
<Tag key={index} variant="stroke" onDismiss={() => removeTag(tag)}> | ||
<span style={{ wordBreak: 'break-all' }}>{tag}</span> | ||
<Tag | ||
key={index} | ||
variant="stroke" | ||
onDismiss={(e) => { | ||
e.preventDefault(); | ||
e.stopPropagation(); | ||
Comment on lines
+89
to
+90
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fix the bug - the click on remove button was causing the form submission |
||
|
||
removeTag(tag); | ||
}} | ||
dismissTestId={`tags-badge-remove-${tag}`} | ||
> | ||
<span style={{ wordBreak: 'break-all' }} data-testid="tags-badge-value"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For some components, I had to add |
||
{tag} | ||
</span> | ||
</Tag> | ||
))} | ||
</div> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,7 +80,7 @@ export const NodeBody = ({ | |
|
||
return ( | ||
<HoverCard openDelay={300}> | ||
<HoverCardTrigger> | ||
<HoverCardTrigger asChild> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. react warning |
||
<div className="bg-neutral-alpha-50 hover-trigger pointer-events-auto relative flex items-center rounded-lg px-1 py-2"> | ||
<span className="text-foreground-400 overflow-hidden text-ellipsis text-nowrap text-sm font-medium"> | ||
{children} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.env file for the Dashboard