Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ plugins
.vscode/launch.json

package-lock.json

.env
11 changes: 11 additions & 0 deletions e2e-tests/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
### SENTRY TEST AUTH TOKEN ###
SENTRY_TEST_AUTH_TOKEN="TEST_AUTH_TOKEN"

### SENTRY TEST DSN ###
SENTRY_TEST_DSN="TEST_DSN"

### SENTRY TEST ORG ###
SENTRY_TEST_ORG="TEST_ORG"

### SENTRY TEST PROJECT ###
SENTRY_TEST_PROJECT="TEST_PROJECT"
Comment on lines +1 to +11
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Lms24, @lforst -- Could we create a test project and set these env variables on the CI?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anecdotally we should avoid depending on any production systems for our tests. We recently stopped doing so in the main js repo because it was blocking us from cutting releases and merging a tad to often. Do you think it would be a hard requirement?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems required for testing if the test project builds and runs in the production mode. When there's no valid AUTH_TOKEN, the build fails as the webpack plugin is already set on the next.config file. So, given there's no option to skip configuring next.config in the wizard at the moment, we can instead do either:

  • Try reverting the local changes on next.config file before building the test project.
  • Don't test the build and start. Only test if the project runs on dev mode which is working without the need for these.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I think we would want to test build and start so I am on board with pointing to a prod project. We should just make sure that it is not blocking 1) Releases of the wizard 2) PRs 3) Local test runs.

We can point the tests to the sentry-javascript-sdks org and the sentry-wizard-e2e-tests project. I think this can simply be via the github action yaml. Do we need any secrets? If so I can ask for them to be added.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, so adding the AUTH_TOKEN would be enough for now, I'll set the rest on the GA yaml.

9 changes: 8 additions & 1 deletion e2e-tests/jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
import { config } from 'dotenv';

config({
path: './e2e-tests/.env',
});

export default {
testTimeout: 360000,
testEnvironment: 'node',
Expand All @@ -11,4 +17,5 @@ export default {
tsconfig: 'tsconfig.json',
},
},
}
verbose: true,
};
36 changes: 36 additions & 0 deletions e2e-tests/test-applications/nextjs-test-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
5 changes: 5 additions & 0 deletions e2e-tests/test-applications/nextjs-test-app/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
4 changes: 4 additions & 0 deletions e2e-tests/test-applications/nextjs-test-app/next.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/** @type {import('next').NextConfig} */
const nextConfig = {};

export default nextConfig;
22 changes: 22 additions & 0 deletions e2e-tests/test-applications/nextjs-test-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "nextjs-test-app",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"react": "^18",
"react-dom": "^18",
"next": "14.2.14"
},
"devDependencies": {
"typescript": "^5",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18"
}
}
42 changes: 42 additions & 0 deletions e2e-tests/test-applications/nextjs-test-app/src/app/globals.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
:root {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would probably just remove the CSS files. They shouldn't add anything to the tests.

--background: #ffffff;
--foreground: #171717;
}

@media (prefers-color-scheme: dark) {
:root {
--background: #0a0a0a;
--foreground: #ededed;
}
}

html,
body {
max-width: 100vw;
overflow-x: hidden;
}

body {
color: var(--foreground);
background: var(--background);
font-family: Arial, Helvetica, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

* {
box-sizing: border-box;
padding: 0;
margin: 0;
}

a {
color: inherit;
text-decoration: none;
}

@media (prefers-color-scheme: dark) {
html {
color-scheme: dark;
}
}
21 changes: 21 additions & 0 deletions e2e-tests/test-applications/nextjs-test-app/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { Metadata } from "next";
import "./globals.css";

export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
};

export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en">
<body>
{children}
</body>
</html>
);
}
165 changes: 165 additions & 0 deletions e2e-tests/test-applications/nextjs-test-app/src/app/page.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
.page {
--gray-rgb: 0, 0, 0;
--gray-alpha-200: rgba(var(--gray-rgb), 0.08);
--gray-alpha-100: rgba(var(--gray-rgb), 0.05);

--button-primary-hover: #383838;
--button-secondary-hover: #f2f2f2;

display: grid;
grid-template-rows: 20px 1fr 20px;
align-items: center;
justify-items: center;
min-height: 100svh;
padding: 80px;
gap: 64px;
font-family: var(--font-geist-sans);
}

@media (prefers-color-scheme: dark) {
.page {
--gray-rgb: 255, 255, 255;
--gray-alpha-200: rgba(var(--gray-rgb), 0.145);
--gray-alpha-100: rgba(var(--gray-rgb), 0.06);

--button-primary-hover: #ccc;
--button-secondary-hover: #1a1a1a;
}
}

.main {
display: flex;
flex-direction: column;
gap: 32px;
grid-row-start: 2;
}

.main ol {
font-family: var(--font-geist-mono);
padding-left: 0;
margin: 0;
font-size: 14px;
line-height: 24px;
letter-spacing: -0.01em;
list-style-position: inside;
}

.main li:not(:last-of-type) {
margin-bottom: 8px;
}

.main code {
font-family: inherit;
background: var(--gray-alpha-100);
padding: 2px 4px;
border-radius: 4px;
font-weight: 600;
}

.ctas {
display: flex;
gap: 16px;
}

.ctas a {
appearance: none;
border-radius: 128px;
height: 48px;
padding: 0 20px;
border: none;
border: 1px solid transparent;
transition: background 0.2s, color 0.2s, border-color 0.2s;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
font-size: 16px;
line-height: 20px;
font-weight: 500;
}

a.primary {
background: var(--foreground);
color: var(--background);
gap: 8px;
}

a.secondary {
border-color: var(--gray-alpha-200);
min-width: 180px;
}

.footer {
grid-row-start: 3;
display: flex;
gap: 24px;
}

.footer a {
display: flex;
align-items: center;
gap: 8px;
}

.footer img {
flex-shrink: 0;
}

/* Enable hover only on non-touch devices */
@media (hover: hover) and (pointer: fine) {
a.primary:hover {
background: var(--button-primary-hover);
border-color: transparent;
}

a.secondary:hover {
background: var(--button-secondary-hover);
border-color: transparent;
}

.footer a:hover {
text-decoration: underline;
text-underline-offset: 4px;
}
}

@media (max-width: 600px) {
.page {
padding: 32px;
padding-bottom: 80px;
}

.main {
align-items: center;
}

.main ol {
text-align: center;
}

.ctas {
flex-direction: column;
}

.ctas a {
font-size: 14px;
height: 40px;
padding: 0 16px;
}

a.secondary {
min-width: auto;
}

.footer {
flex-wrap: wrap;
align-items: center;
justify-content: center;
}
}

@media (prefers-color-scheme: dark) {
.logo {
filter: invert();
}
}
Loading
Loading