commit
a1388c6962
@ -0,0 +1,13 @@
|
||||
{
|
||||
"env": {
|
||||
"development": {
|
||||
"presets": ["next/babel"]
|
||||
},
|
||||
"production": {
|
||||
"presets": ["next/babel"]
|
||||
},
|
||||
"test": {
|
||||
"presets": ["@babel/env", "@babel/react"]
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,33 +0,0 @@
|
||||
import React from "react";
|
||||
import Router from "next/router";
|
||||
import ReactMarkdown from "react-markdown";
|
||||
|
||||
export type PostProps = {
|
||||
id: number;
|
||||
title: string;
|
||||
author: {
|
||||
name: string;
|
||||
email: string;
|
||||
} | null;
|
||||
content: string;
|
||||
published: boolean;
|
||||
};
|
||||
|
||||
const Post = ( {post} : {post : PostProps}) => {
|
||||
const authorName = post.author ? post.author.name : "Unknown author";
|
||||
return (
|
||||
<div onClick={() => Router.push("/p/[id]", `/p/${post.id}`)}>
|
||||
<h2>{post.title}</h2>
|
||||
<small>By {authorName}</small>
|
||||
<ReactMarkdown children={post.content} />
|
||||
<style jsx>{`
|
||||
div {
|
||||
color: inherit;
|
||||
padding: 2rem;
|
||||
}
|
||||
`}</style>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Post;
|
||||
@ -0,0 +1,14 @@
|
||||
const nextJest = require('next/jest')
|
||||
|
||||
const createJestConfig = nextJest({
|
||||
dir: './',
|
||||
})
|
||||
|
||||
const customJestConfig = {
|
||||
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
|
||||
moduleDirectories: ['node_modules', '<rootDir>/'],
|
||||
testEnvironment: 'jest-environment-jsdom',
|
||||
testRegex: '(/__tests__/.*|(\\.|/)(test))\\.[jt]sx?$'
|
||||
}
|
||||
|
||||
module.exports = createJestConfig(customJestConfig)
|
||||
@ -0,0 +1,6 @@
|
||||
// Optional: configure or set up a testing framework before each test.
|
||||
// If you delete this file, remove `setupFilesAfterEnv` from `jest.config.js`
|
||||
|
||||
// Used for __tests__/testing-library.js
|
||||
// Learn more: https://github.com/testing-library/jest-dom
|
||||
import '@testing-library/jest-dom/extend-expect'
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,56 +0,0 @@
|
||||
{/* <div className={`${style['bloc-content']} col-12 col-md-10 d-flex row my-2 mx-0 py-2 py-md-2 px-0 px-md-3 `}>
|
||||
<h2 className="col-12 my-2">A gagner</h2>
|
||||
<div className="col d-flex justify-content-center">
|
||||
<div className={`${style['productToGain']}`}>
|
||||
<Image
|
||||
src={rotatingRightImage}
|
||||
alt="coffret de thé marron rempli de sachets de toutes couleurs"
|
||||
fill
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="col d-flex justify-content-center">
|
||||
<div className={`${style['productToGain']}`}>
|
||||
<Image
|
||||
src={rotatingRightImage}
|
||||
alt="coffret de thé marron rempli de sachets de toutes couleurs"
|
||||
fill
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="col d-flex justify-content-center">
|
||||
<div className={`${style['productToGain']}`}>
|
||||
<Image
|
||||
src={rotatingRightImage}
|
||||
alt="coffret de thé marron rempli de sachets de toutes couleurs"
|
||||
fill
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="col-12">
|
||||
<div className='btn btn-primary my-2'>
|
||||
<Link href="shop">Et bien d'autres !</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div> */}
|
||||
|
||||
|
||||
|
||||
{/* <Section backgroundImagePath={'/images/three-cups-of-tea-steeping.png'}>
|
||||
<h2>Présentation du jeu concours</h2>
|
||||
<h4 className="fw-light">
|
||||
Gagnez de superbes cadeaux en achetant nos produits !
|
||||
<br />
|
||||
Pour participer, il vous suffit d'effectuer un achat en boutique d'une valeur supérieure à XXX euros. Retrouvez votre code sur la facture !
|
||||
<br />
|
||||
Saisissez votre code ... Félicitations ! Vous avez gagné un cadeau ! Il nous vous reste plus qu'à le récupérer en magasin.
|
||||
<br />
|
||||
Après la [XXX période], vous participerez au jeu concours final afin de gagner XXX. Un participation par personne est comptabilisée pour le concours final.
|
||||
</h4>
|
||||
</Section>
|
||||
<Section backgroundImagePath={'/images/top-view-of-a-tea-towel-and-container-holding-grain.png'}>
|
||||
<h2>Présentation de Thé Tip Top</h2>
|
||||
<h4 className="fw-light">
|
||||
Thé Tip Top est une entreprise de thé [XXX ajouter des spécifications en se basant sur le cahier des charges]
|
||||
</h4>
|
||||
</Section> */}
|
||||
@ -0,0 +1,77 @@
|
||||
import { PlaywrightTestConfig, devices } from '@playwright/test'
|
||||
import path from 'path'
|
||||
|
||||
// Use process.env.PORT by default and fallback to port 3000
|
||||
const PORT = process.env.PORT || 3000
|
||||
|
||||
// Set webServer.url and use.baseURL with the location of the WebServer respecting the correct set port
|
||||
const baseURL = `http://localhost:${PORT}`
|
||||
|
||||
// Reference: https://playwright.dev/docs/test-configuration
|
||||
const config: PlaywrightTestConfig = {
|
||||
// Timeout per test
|
||||
timeout: 30 * 1000,
|
||||
// Test directory
|
||||
testDir: path.join(__dirname, 'e2e'),
|
||||
// If a test fails, retry it additional 2 times
|
||||
retries: 2,
|
||||
// Artifacts folder where screenshots, videos, and traces are stored.
|
||||
outputDir: 'test-results/',
|
||||
|
||||
// Run your local dev server before starting the tests:
|
||||
// https://playwright.dev/docs/test-advanced#launching-a-development-web-server-during-the-tests
|
||||
webServer: {
|
||||
command: 'npm run dev',
|
||||
url: baseURL,
|
||||
timeout: 120 * 1000,
|
||||
reuseExistingServer: !process.env.CI,
|
||||
},
|
||||
|
||||
use: {
|
||||
// Use baseURL so to make navigations relative.
|
||||
// More information: https://playwright.dev/docs/api/class-testoptions#test-options-base-url
|
||||
baseURL,
|
||||
|
||||
// Retry a test if its failing with enabled tracing. This allows you to analyse the DOM, console logs, network traffic etc.
|
||||
// More information: https://playwright.dev/docs/trace-viewer
|
||||
trace: 'retry-with-trace',
|
||||
|
||||
// All available context options: https://playwright.dev/docs/api/class-browser#browser-new-context
|
||||
// contextOptions: {
|
||||
// ignoreHTTPSErrors: true,
|
||||
// },
|
||||
},
|
||||
|
||||
projects: [
|
||||
{
|
||||
name: 'Desktop Chrome',
|
||||
use: {
|
||||
...devices['Desktop Chrome'],
|
||||
},
|
||||
},
|
||||
// {
|
||||
// name: 'Desktop Firefox',
|
||||
// use: {
|
||||
// ...devices['Desktop Firefox'],
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// name: 'Desktop Safari',
|
||||
// use: {
|
||||
// ...devices['Desktop Safari'],
|
||||
// },
|
||||
// },
|
||||
// Test against mobile viewports.
|
||||
// {
|
||||
// name: 'Mobile Chrome',
|
||||
// use: {
|
||||
// ...devices['Pixel 5'],
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// name: 'Mobile Safari',
|
||||
// use: devices['iPhone 12'],
|
||||
// },
|
||||
],
|
||||
}
|
||||
export default config
|
||||
|
Before Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
echo 'The following "npm" command builds your Node.js/React application for'
|
||||
echo 'production in the local "build" directory (i.e. within the'
|
||||
echo '"/var/jenkins_home/workspace/simple-node-js-react-app" directory),'
|
||||
echo 'correctly bundles React in production mode and optimizes the build for'
|
||||
echo 'the best performance.'
|
||||
set -x
|
||||
npm run build
|
||||
set +x
|
||||
|
||||
echo 'The following "npm" command runs your Node.js/React application in'
|
||||
echo 'development mode and makes the application available for web browsing.'
|
||||
echo 'The "npm start" command has a trailing ampersand so that the command runs'
|
||||
echo 'as a background process (i.e. asynchronously). Otherwise, this command'
|
||||
echo 'can pause running builds of CI/CD applications indefinitely. "npm start"'
|
||||
echo 'is followed by another command that retrieves the process ID (PID) value'
|
||||
echo 'of the previously run process (i.e. "npm start") and writes this value to'
|
||||
echo 'the file ".pidfile".'
|
||||
set -x
|
||||
npm start &
|
||||
sleep 1
|
||||
echo $! > .pidfile
|
||||
set +x
|
||||
|
||||
echo 'Now...'
|
||||
echo 'Visit http://localhost:3000 to see your Node.js/React application in action.'
|
||||
echo '(This is why you specified the "args ''-p 3000:3000''" parameter when you'
|
||||
echo 'created your initial Pipeline as a Jenkinsfile.)'
|
||||
@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
echo 'The following command terminates the "npm start" process using its PID'
|
||||
echo '(written to ".pidfile"), all of which were conducted when "deliver.sh"'
|
||||
echo 'was executed.'
|
||||
set -x
|
||||
kill $(cat .pidfile)
|
||||
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
echo 'The following "npm" command (if executed) installs the "cross-env"'
|
||||
echo 'dependency into the local "node_modules" directory, which will ultimately'
|
||||
echo 'be stored in the Jenkins home directory. As described in'
|
||||
echo 'https://docs.npmjs.com/cli/install, the "--save-dev" flag causes the'
|
||||
echo '"cross-env" dependency to be installed as "devDependencies". For the'
|
||||
echo 'purposes of this tutorial, this flag is not important. However, when'
|
||||
echo 'installing this dependency, it would typically be done so using this'
|
||||
echo 'flag. For a comprehensive explanation about "devDependencies", see'
|
||||
echo 'https://stackoverflow.com/questions/18875674/whats-the-difference-between-dependencies-devdependencies-and-peerdependencies.'
|
||||
set -x
|
||||
# npm install --save-dev cross-env
|
||||
set +x
|
||||
|
||||
echo 'The following "npm" command tests that your simple Node.js/React'
|
||||
echo 'application renders satisfactorily. This command actually invokes the test'
|
||||
echo 'runner Jest (https://facebook.github.io/jest/).'
|
||||
set -x
|
||||
npm test
|
||||
@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"jsx": "react"
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue