Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add testes #211

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
07526c3
feat: add tests and github pipeline
gabrielMatosBoubee Nov 28, 2024
7403fb1
fix: make it run in pr
gabrielMatosBoubee Nov 28, 2024
98b2e2b
fix: upgrade to deno 2.0
gabrielMatosBoubee Nov 28, 2024
2482892
feat: add cypress and node runner
gabrielMatosBoubee Nov 28, 2024
d6d9dc3
chore: test
gabrielMatosBoubee Nov 28, 2024
f8b7ca7
chore: test
gabrielMatosBoubee Nov 28, 2024
fe8b2c0
chore: test
gabrielMatosBoubee Nov 28, 2024
904ceed
chore: test
gabrielMatosBoubee Nov 28, 2024
3fc1b9b
chore: test
gabrielMatosBoubee Nov 28, 2024
23de987
chore: test
gabrielMatosBoubee Nov 28, 2024
d15e6f9
chore: test
gabrielMatosBoubee Nov 28, 2024
1d8713d
chore: test
gabrielMatosBoubee Nov 28, 2024
f01e655
chore: test
gabrielMatosBoubee Nov 28, 2024
bf2df71
chore: test
gabrielMatosBoubee Nov 29, 2024
e0c2f31
chore: test
gabrielMatosBoubee Nov 29, 2024
ae0d104
chore: test
gabrielMatosBoubee Nov 29, 2024
4f27aa5
chore: test
gabrielMatosBoubee Nov 29, 2024
241003a
chore: test
gabrielMatosBoubee Dec 2, 2024
b187b4f
chore: test
gabrielMatosBoubee Dec 2, 2024
dbfe457
chore: test
gabrielMatosBoubee Dec 2, 2024
706928b
chore: test
gabrielMatosBoubee Dec 2, 2024
1979e6c
chore: test
gabrielMatosBoubee Dec 2, 2024
10631dd
chore: test
gabrielMatosBoubee Dec 2, 2024
ad81927
chore: test
gabrielMatosBoubee Dec 2, 2024
f258bcb
feat: tests done
gabrielMatosBoubee Dec 2, 2024
2da77b9
feat: tests done
gabrielMatosBoubee Dec 2, 2024
3ba5d24
feat: tests done
gabrielMatosBoubee Dec 2, 2024
32ea9d6
feat: tests done
gabrielMatosBoubee Dec 2, 2024
4574906
feat: tests done
gabrielMatosBoubee Dec 2, 2024
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
33 changes: 33 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CI Pipeline

on: pull_request

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Setup repo
uses: actions/checkout@v4

- name: Setup Deno
uses: denoland/setup-deno@61fe2df320078202e33d7d5ad347e7dcfa0e8f31 # v1.1.2
with:
deno-version: v2.x

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "18"

- name: Install Cypress Binary
run: npm install -g cypress

- name: Install Deno dependencies
run: deno install

- name: Add global npm bin to PATH
run: echo "/opt/hostedtoolcache/node/18.20.5/x64/bin" >> $GITHUB_PATH # Adiciona o caminho ao PATH

- name: Run tests
run: deno task start & deno task test-terminal
1 change: 1 addition & 0 deletions components/minicart/Minicart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ export default function Cart(

{/* This contains the STOREFRONT cart. */}
<input
data-test-name="cart-json"
type="hidden"
name="storefront-cart"
value={encodeURIComponent(
Expand Down
1 change: 1 addition & 0 deletions components/product/AddToCartButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ function AddToCartButton(props: Props) {

<button
disabled
data-test-name="add-to-cart"
class={clx("flex-grow peer-checked:hidden", _class?.toString())}
hx-on:click={useScript(onClick)}
>
Expand Down
7 changes: 7 additions & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const { defineConfig } = require('cypress')

module.exports = defineConfig({
e2e: {
baseUrl: 'http://localhost:8000',
},
})
16 changes: 16 additions & 0 deletions cypress/e2e/buy-product.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
describe("My First Test", () => {
it('finds the content "type"', () => {
cy.visit("http://localhost:8000/");

const SIX_SECONDS = 6000;
cy.wait(SIX_SECONDS);

cy.get('button[data-test-name="add-to-cart"]').first().click();

cy.get('input[data-test-name="cart-json"]').invoke("val").should(
"not.be.empty",
);

cy.visit("http://localhost:8000/checkout");
});
});
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"
}
25 changes: 25 additions & 0 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// ***********************************************
// This example commands.js 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) => { ... })
20 changes: 20 additions & 0 deletions cypress/support/e2e.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// ***********************************************************
// This example support/e2e.js 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')
33 changes: 17 additions & 16 deletions deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"imports": {
"$fresh/": "https://deno.land/x/[email protected]/",
"$fresh/": "https://deno.land/x/[email protected]/",
"cypress": "npm:[email protected]",
"deno-cypress-runner": "npm:deno-cypress-runner@^1.0.0",
"preact": "npm:[email protected]",
"preact-render-to-string": "npm:[email protected]",
"@cliffy/prompt": "jsr:@cliffy/prompt@^1.0.0-rc.5",
Expand Down Expand Up @@ -29,15 +31,15 @@
"@zaubrik/djwt": "jsr:@zaubrik/djwt@^3.0.2",
"fast-json-patch": "npm:fast-json-patch@^3.1.1",
"https://esm.sh/*[email protected]": "npm:[email protected]",
"@deco/deco": "jsr:@deco/deco@1.102.3",
"@deco/deco": "jsr:@deco/deco@1.107.0",
"simple-git": "npm:simple-git@^3.25.0",
"std/": "https://deno.land/[email protected]/",
"deco/": "https://cdn.jsdelivr.net/gh/deco-cx/deco@1.102.3/",
"apps/": "https://cdn.jsdelivr.net/gh/deco-cx/apps@0.59.16/",
"deco/": "https://cdn.jsdelivr.net/gh/deco-cx/deco@1.107.1/",
"apps/": "https://cdn.jsdelivr.net/gh/deco-cx/apps@0.64.2/",
"@preact/signals": "https://esm.sh/*@preact/[email protected]",
"@preact/signals-core": "https://esm.sh/*@preact/[email protected]",
"daisyui": "npm:[email protected]",
"@deco/dev": "jsr:@deco/dev@1.102.0"
"@deco/dev": "jsr:@deco/dev@1.107.0"
},
"tasks": {
"start": "deno run -A --unstable-http --env https://deco.cx/run -- deno task dev",
Expand All @@ -54,8 +56,10 @@
"build": "deno run -A dev.ts build",
"preview": "deno run -A main.ts",
"generate-icons": "deno run -A --unstable static/generate-icons.ts",
"dev": "deno run -A --env --unstable --unstable-hmr dev.ts",
"reload": "deno cache -r https://deco.cx/run"
"dev": "deno run -A --env --unstable-kv --unstable-hmr dev.ts",
"reload": "deno cache -r https://deco.cx/run",
"test": "cypress open",
"test-terminal": "cypress run"
},
"githooks": {
"pre-commit": "check"
Expand All @@ -66,20 +70,17 @@
"README.md",
"_fresh",
"**/_fresh/*",
".deco"
".deco",
"cypress",
"cypress.config.js"
],
"lint": {
"rules": {
"exclude": [
"no-window"
],
"tags": [
"fresh",
"recommended"
]
"exclude": ["no-window"],
"tags": ["fresh", "recommended"]
}
},
"nodeModulesDir": false,
"nodeModulesDir": true,
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "preact",
Expand Down
2 changes: 1 addition & 1 deletion fresh.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import * as $_app from "./routes/_app.tsx";

import { type Manifest } from "$fresh/server.ts";
import type { Manifest } from "$fresh/server.ts";

const manifest = {
routes: {
Expand Down
5,932 changes: 5,931 additions & 1 deletion static/tailwind.css

Large diffs are not rendered by default.

13 changes: 6 additions & 7 deletions tailwind.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
@tailwind utilities;

@layer base {

/* Allow changing font family via CMS */
html {
font-family: var(--font-family);
}

/** Remove default styles from input[type=number] */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
-webkit-appearance: none;
margin: 0;
}
Expand All @@ -25,15 +24,15 @@
}

.group:disabled .group-disabled\:animate-progress {
animation: progress-frame ease normal
animation: progress-frame ease normal;
}

@keyframes progress-frame {
0% {
--dot-progress: 0%
--dot-progress: 0%;
}

to {
--dot-progress: 100%
--dot-progress: 100%;
}
}
}
Loading