Merge branch 'master' into develop

feature/ga
Eric 4 years ago
commit a1388c6962

@ -0,0 +1,13 @@
{
"env": {
"development": {
"presets": ["next/babel"]
},
"production": {
"presets": ["next/babel"]
},
"test": {
"presets": ["@babel/env", "@babel/react"]
}
}
}

20
Jenkinsfile vendored

@ -28,17 +28,25 @@ cat ./.env'''
}
}
stage('build') {
stage('Build') {
steps {
sh 'ls -l'
sh '''npm install
npm run build
npm start & sleep 1'''
}
}
stage('build2') {
stage('Test') {
steps {
sh '''npm install
npm run build
npm start & sleep 1'''
sh 'npm test & sleep 1'
}
}
stage('Deliver') {
steps {
sh '''chmod +x ./scripts/deliver.sh
./scripts/deliver.sh'''
input 'Finished using the web site? (Click "Proceed")'
}
}

@ -1,7 +1,7 @@
import Image from 'next/image'
import logo from '../public/images/logo.webp';
import logoInstagram from '../public/images/logo instagram.webp';
import logoLinkedin from '../public/images/logo linkedin.webp';
import logoFacebook from '../public/images/png/logo_facebook.png';
import style from '../styles/Footer.module.css'
import Link from 'next/link';
@ -46,7 +46,7 @@ const Footer = () => {
</li>
<li className="nav-item py-2 px-2">
<Link href="https://www.facebook.com/profile.php?id=100088390638593" legacyBehavior><a className={style.link} >
<Image src={logoLinkedin} alt="lien facebook" width="40"
<Image src={logoFacebook} alt="lien facebook" width="40"
height="40" />
</a></Link>
</li>

@ -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'

16042
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -1,5 +1,5 @@
{
"name": "hello-next",
"name": "thetiptop",
"version": "1.0.0",
"description": "",
"keywords": [],
@ -38,13 +38,23 @@
},
"devDependencies": {
"@playwright/test": "^1.28.1",
"@testing-library/dom": "^8.19.0",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^14.4.3",
"@tomfreudenberg/next-auth-mock": "^0.5.5",
"@types/chance": "^1.1.3",
"@types/jest": "^29.2.4",
"@types/next-auth": "3.13.0",
"@types/node": "18.11.9",
"@types/react": "18.0.25",
"@types/node": "^18.11.9",
"@types/react": "^18.0.25",
"babel-jest": "^29.3.1",
"jest": "^29.3.1",
"jest-environment-jsdom": "^29.3.1",
"prisma": "^4.6.1",
"supertest": "^6.3.3",
"ts-node": "10.9.1",
"typescript": "4.8.4"
"typescript": "^4.8.4"
},
"prisma": {
"seed": "ts-node prisma/seed.ts"

@ -62,7 +62,7 @@ function html(params: { url: string; host: string; theme: Theme }) {
background-color: #F7F8FA !important
}
.hover-bg-primary-600:hover {
background-color: #006600e6 !important
background-color: #006600 !important
}
.hover-text-slate-600:hover {
color: #585E83 !important
@ -96,7 +96,7 @@ function html(params: { url: string; host: string; theme: Theme }) {
color: #121212 !important
}
.dark-text-primary-500 {
color: #006600e6 !important
color: #006600 !important
}
.dark-text-primary-200 {
color: #94B5FF !important
@ -196,7 +196,7 @@ function html(params: { url: string; host: string; theme: Theme }) {
</tr>
<tr>
<td align="center">
<a href="${url}" class="sm-block dark-text-primary-500 hover-bg-primary-600 dark-bg-gray-50 dark-hover-bg-gray-50" style="text-decoration: none; display: inline-block; border-radius: 8px; background-color: #006600e6; padding: 14px 24px; text-align: center; font-size: 16px; font-weight: 700; color: #f9fafb; box-shadow: 0px 2px 4px -1px rgba(0, 0, 0, 0.06), 0px 4px 6px -1px rgba(0, 0, 0, 0.1)">
<a href="${url}" class="sm-block dark-text-primary-500 hover-bg-primary-600 dark-bg-gray-50 dark-hover-bg-gray-50" style="text-decoration: none; display: inline-block; border-radius: 8px; background-color: #006600; padding: 14px 24px; text-align: center; font-size: 16px; font-weight: 700; color: #f9fafb; box-shadow: 0px 2px 4px -1px rgba(0, 0, 0, 0.06), 0px 4px 6px -1px rgba(0, 0, 0, 0.1)">
<!--[if mso
]><i
style="

@ -1,6 +1,6 @@
import React from "react";
import Head from "next/head";
import { getCsrfToken, signIn } from "next-auth/react";
import { signIn } from "next-auth/react";
import { useForm } from "react-hook-form";
import { AiOutlineGoogle } from 'react-icons/ai'
import style from '../styles/Connexion.module.css';

@ -155,6 +155,7 @@ const Index = () => {
<div className="form-group mx-auto my-3 w-100">
<input type="text"
id="codeInput" aria-describedby="codeHelp"
data-testid="codeInput"
placeholder="A293049430..."
minLength={10}
maxLength={10}
@ -166,23 +167,18 @@ const Index = () => {
<div className="invalid-feedback alert alert-danger">{errors.codeCadeau?.message}</div>
</div>
<div className="form-group mx-auto my-3 w-100">
<button type="submit" className={`${style['aButton']} btn btn-primary`}>Découvrir mon cadeau !</button>
<button type="submit" data-testid="submit" className={`${style['aButton']} btn btn-primary`}>Découvrir mon cadeau !</button>
</div>
</form>
</div>
</div>}
{winAnimation && <div className="col-12 align-items-center d-flex flex-column">
<div className={`${style['cadeau-bloc-content']} col-12 col-md-6`} onClick={() => setWinAnimation(false)}
>
<div className={`${style['cadeau-bloc']}`}>
<h1>Vous avez gagnez : un {response.winProduct.nomProduit.toLowerCase()} !</h1>
</div>
</div>
<div className={`${style['imageWrapper']}`}>
<Image
src={arrowUp}
@ -193,22 +189,11 @@ const Index = () => {
className={`${style['rotatingImage']}`}
/>
</div>
<div className="row">
<button onClick={getCadeau} className={`${style['aButton']} btn btn-primary`}>Voir mes cadeaux !</button>
<button onClick={() => setWinAnimation(false)} className={`${style['aButton']} btn btn-primary mt-2`}>Rejouer un ticket !</button>
</div>
</div>}
</div>
<div className={`${style['footerGrass']} position-absolute`}>
<Image

@ -227,7 +227,7 @@ const MonCompte = (props: Props) => {
<th scope="row">{++index}</th>
<td>{info.codeCadeau}</td>
<td>{info.produit.nomProduit}</td>
<td>{info.produit.retrait ? '❌ déja récupéré' : '✔️ venir me chercher !'}</td>
<td>{!info.produit.retrait ? '❌ déja récupéré' : '✔️ venir me chercher !'}</td>
</tr>
})}
</tbody>

@ -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

@ -1,3 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="48" height="48" viewBox="0 0 48 48">
<image id="Calque_3" data-name="Calque 3" x="-12" y="-10" width="68" height="68" xlink:href="data:img/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEQAAABECAYAAAA4E5OyAAAHMklEQVR4nO2ba3ATVRTH//dustm0TSEgbSkolrdaWnwBHR84ltcwoNZiGAHFQR0VHR8joqhov4hURlERXzMKlqqAAkZHOooI4gOEsQo6gA9AxLaAtU1baLNJdtfZijy2SbN396bUIb+ZfNmcc+7Zf+7j3LsbAmAugAlIotPgADAYwLCkHK00UwChTpBIZ6GFnukKGEkKYiApiIGkIAaSghhICmLAcboTIE7AkU5AXeT4NaVZg9KkQVM6Ph9mQWavTiUmzGKy6nl50LkjHbsz+1J4uxKk6KJoba01AhzVgLp6DQd/UbFvQ7jX5Eekajtt6zxz/dEorZ2gQ3rIWw+3SHlTxVn9hwgjiu93Cce/aCc1XaQ0AGlegnOGCxg2XFhYryD881Zl04gC4fVE5ZpQQZY81OIcdqdr3s3PuHOJhnE2w/m8AjCiQHCGKcb8tF359sIhwgJOqR4nYYJ8uT4yY9qz7slOFWPa6wkW8DlV4MIhghKkeP/LVeE3Rxc51/IKnhBBqhq1t68odHSDLkbi8EkqMLrIqew5qBb2y6IP8miJ67K7ckEwp5mgolc66QbYHiJm8fXLor0DCsqXPRpMsRuMmyAfvREqmDRbejnl37mio8T4D19XAVNvmC+VrSgNnm0nEBdBVi+ScyfeKj5B7U+ctpBUFBfNkRaWPxFMtxrHtiD6kjrhPtezp6FXREVUUTyxRHrNqr9tQcaWSGViYidPZrpQ0D2H1IVWfG0JsmWzcl+Wm3i43AVffP0yafa6NeHxrFEtL7vlJcFu00okrhOop+dgDO4xCmen5sFNo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ulsvUQh8FfMC95txde2INff49q1aV1kTScSxV+xNLSAdaj8B5czwStHO5Zv26Zs6gSi+D//KFI2Ybr4tdUA3A5JL71UWPzFp5FVp0sUlcD/cVlowdUTHavtxOH6FuLIMY6VH7wm/zLuLpcgqa3FqKny3ib+Jg3K2vnBeyc/IlXZDcb9GF1fjiUVk/Yd1qo7oLf4d/2u7vYQFPMQA4l8cTcngzywdlno8oIpYtgrwMm5t/gPBdH8zZvy00UzXT9yjJvYV7vH3yR+pRe1n6wIFw691tmSKcF9sjACib5noSRmx/VXNWp1le+HX504Q9xaNNPFPecOefl/7GTnegDry0uC3gHjnOv75NPh3lTaRVO0K/VHvEZ7cmJP6w8SoK5Rq9uzTdm499PIiunzJbnXDDFhueotLwFwi1kHu38POZmKJ3O8ostV5/AQCJ5jYTUgpXstDjVV4e/flB7TnpRqebWH+H8PaT2PWHLsJOaM/wCoTf7FzEBSEANJQQwkBTGQFMRAUhADSUEM6IIkruz7/+HWS/fdALae6Uq0AjT8A7T9bClX8xf2AAAAAElFTkSuQmCC"/>
</svg>

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

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

@ -3,9 +3,9 @@
/* margin-top:auto; */
width:100%;
display: table-footer-group;
background-color: #006600e6;
background-color: #006600;
}
/* .footerContent{
background-color: #006600e6;
background-color: #006600;
} */

@ -0,0 +1,6 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"jsx": "react"
}
}

@ -25,7 +25,7 @@
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx"
"**/*.tsx",
],
"ts-node": {
"compilerOptions": {

Loading…
Cancel
Save