Skip to content

Commit

Permalink
Merge pull request #5 from rshewitt/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
rshewitt authored Apr 25, 2024
2 parents 30cd10a + 35a95d1 commit 9727f28
Show file tree
Hide file tree
Showing 57 changed files with 7,584 additions and 5,860 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/test-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Test and Deploy

on:
pull_request:
branches: [ main ]
push:
branches: [ main ]

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@v4

- name: Cypress Run
uses: cypress-io/github-action@v6
with:
project: .
browser: chrome
build: npm run build
start: npm run dev
wait-on: "http://localhost:3000"
deploy:
runs-on: ubuntu-22.04
needs: test
steps:
- name: 'Checkout'
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.x"
cache: "npm"
- name: Install dependencies
run: npm i
- name: Build
run: npm run build
- name: Configure AWS
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-2
- run: aws s3 sync ./out s3://mchewittwedding.com
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
.yarn/install-state.gz

# do not check this into source control!
/lambda
/cloudfront

# cypress
/cypress/screenshots

.env

# testing
Expand Down
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM node:20-bookworm-slim

WORKDIR /app

COPY package.json ./

RUN npm install

EXPOSE 3000

COPY . .

CMD ["npm", "run", "dev"]
9 changes: 9 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { defineConfig } from "cypress";

export default defineConfig({
e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
},
},
});
11 changes: 11 additions & 0 deletions cypress/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { defineConfig } from "cypress";

export default defineConfig({
defaultCommandTimeout: 10000,
e2e: {
baseUrl: "http://localhost:3000",
specPattern: "cypress/e2e/*.cy.ts",
},
videoCompression: false,
screenshotOnRunFailure: false,
});
12 changes: 12 additions & 0 deletions cypress/e2e/spec.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
describe("Navigation", () => {
it("should navigate the page", () => {
cy.visit("http://localhost:3000/");

cy.get('img[alt="home_img"]').should("be.visible");
cy.get('button[id="welcome_button"]').click();
cy.get('div[id="registry_button"]').should("be.visible");
cy.get('button[id="react-burger-menu-btn"]').should("be.visible");

// TODO: write more tests...
});
});
5 changes: 5 additions & 0 deletions cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "[email protected]",
"body": "Fixtures are a great way to mock data for responses to routes"
}
37 changes: 37 additions & 0 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/// <reference types="cypress" />
// ***********************************************
// This example commands.ts shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add('login', (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
//
// declare global {
// namespace Cypress {
// interface Chainable {
// login(email: string, password: string): Chainable<void>
// drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
// }
// }
// }
20 changes: 20 additions & 0 deletions cypress/support/e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// ***********************************************************
// This example support/e2e.ts is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')
12 changes: 12 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: '3'

services:
app:
build:
context: .
dockerfile: Dockerfile
ports:
- '3000:3000'
volumes:
- .:/app
- /app/node_modules
1 change: 1 addition & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
output: "export",
images: { unoptimized: true },
};

export default nextConfig;
Loading

0 comments on commit 9727f28

Please sign in to comment.