Skip to content
Open
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
43 changes: 31 additions & 12 deletions .github/workflows/pullRequest.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,37 @@
name: Pull request checks
on: pull_request
name: Run E2E tests
on:
push:
jobs:
cypress-tests:
name: Cypress tests
test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: web
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2 # this package kind of sucks, handle install in cypress step

- uses: pnpm/action-setup@v2
with:
version: 7 # why is this needed?
- uses: cypress-io/github-action@v5
version: 8

- name: Cache node_modules and cypress
id: pnpm-cache
uses: actions/cache@v3
with:
working-directory: web
install-command: pnpm i --frozen-lockfile
build: pnpm run build:node
start: pnpm run preview:node
command: pnpm run test:preview
path: |
web/node_modules
/home/runner/.cache/Cypress
key: ${{ runner.os }}-${{ hashFiles('web/pnpm-lock.yaml') }}

- name: Install dependencies if uncached
if: steps.pnpm-cache.outputs.cache-hit != 'true'
run: pnpm i --frozen-lockfile

- name: Build
run: pnpm build:node

- name: Serve
run: pnpm run preview:node &

- name: Run tests
run: pnpm run test:preview
3 changes: 1 addition & 2 deletions web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ npm create astro@latest -- --template basics

![basics](https://user-images.githubusercontent.com/4677417/186188965-73453154-fdec-4d6b-9c34-cb35c248ae5b.png)


## 🚀 Project Structure

Inside of your Astro project, you'll see the following folders and files:
Expand Down Expand Up @@ -44,7 +43,7 @@ All commands are run from the root of the project, from a terminal:
| Command | Action |
| :--------------------- | :----------------------------------------------- |
| `npm install` | Installs dependencies |
| `npm run dev` | Starts local dev server at `localhost:3000` |
| `npm run dev` | Starts local dev server at `localhost:4321` |
| `npm run build` | Build your production site to `./dist/` |
| `npm run preview` | Preview your build locally, before deploying |
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |
Expand Down
4 changes: 2 additions & 2 deletions web/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { defineConfig } from "astro/config";
import node from "@astrojs/node";
import vercelEdge from "@astrojs/vercel/edge";
import vercelServerless from "@astrojs/vercel/serverless";
import svelte from "@astrojs/svelte";

// https://astro.build/config
export default defineConfig({
output: "server",
adapter: !!process.env.NODE_ADAPTER
? node({ mode: "standalone" })
: vercelEdge({ analytics: true }),
: vercelServerless({ analytics: true }),
integrations: [svelte()],
});
2 changes: 1 addition & 1 deletion web/cypress/e2e/index.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe("Calculation Test", () => {
cy.intercept(
Cypress.env("TEST_PREVIEW") ? "/_astro/**" : "/**/svelte-hooks*"
).as("astro");
const page = cy.visit("http://localhost:3000");
const page = cy.visit("http://localhost:4321");
cy.wait("@astro");

page.get("input").type("1");
Expand Down
18 changes: 9 additions & 9 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/node": "^5.1.1",
"@astrojs/svelte": "^2.1.0",
"@astrojs/vercel": "^3.2.5",
"@vercel/analytics": "^1.0.0",
"astro": "^2.3.1",
"svelte": "^3.54.0"
"@astrojs/node": "^6.0.3",
"@astrojs/svelte": "^4.0.3",
"@astrojs/vercel": "^5.0.2",
"@vercel/analytics": "^1.1.1",
"astro": "^3.3.0",
"svelte": "^4.2.1"
},
"devDependencies": {
"cypress": "^12.11.0",
"sass": "^1.61.0",
"typescript": "^5.0.4"
"cypress": "^13.3.1",
"sass": "^1.69.3",
"typescript": "^5.2.2"
}
}
Loading