-
Notifications
You must be signed in to change notification settings - Fork 7
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
fix: tests e2e #220
fix: tests e2e #220
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
O que comentei com você no Slack, até tem um lugar aqui setando env
cloud-commerce/.github/workflows/test-e2e.yml
Lines 81 to 92 in f88629c
- shell: bash | |
env: | |
ECOM_STORE_ID: ${{ secrets.ECOM_STORE_ID }} | |
ECOM_AUTHENTICATION_ID: ${{ secrets.ECOM_AUTHENTICATION_ID }} | |
ECOM_API_KEY: ${{ secrets.ECOM_API_KEY }} | |
MERCADOPAGO_TOKEN: ${{ secrets.MERCADOPAGO_TOKEN }} | |
FRENET_TOKEN: ${{ secrets.FRENET_TOKEN }} | |
GALAXPAY_ID: ${{ secrets.GALAXPAY_ID }} | |
GALAXPAY_HASH: ${{ secrets.GALAXPAY_HASH }} | |
INFINITEPAY_ID: ${{ secrets.INFINITEPAY_ID }} | |
INFINITEPAY_SECRET: ${{ secrets.INFINITEPAY_SECRET }} | |
run: pnpm build |
Me parece válido criar um build só pros apps inclusive (talvez só sem packages/storefront e stores) e usar aqui, ex:
Line 19 in f88629c
"test:apps": "turbo run test --filter='./packages/{apps/**,modules}'",
No teste em si não tá setando env vars:
cloud-commerce/.github/workflows/test-e2e.yml
Lines 125 to 129 in f88629c
- name: Run tests | |
shell: bash | |
run: | | |
sleep 20 | |
pnpm test:e2e |
Então vai emular as functions sem as variáveis de ambiente. Adicionalmente, também não sei se setar elas em env da sessão do bash (como você fez pra build) seria suficiente, o que sabemos é que firebase-tools lê .env, acho que não pega todas as variáveis da sessão não por isso crio o .env aqui por exemplo
Line 284 in ac4d67d
" > functions/.env |
.github/workflows/test-e2e.yml
Outdated
sleep 10 | ||
sleep 20 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isso aqui não é bom não...
Precisa mesmo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Não precisa não, coloquei so pra verificar umas coisas. Mas já vou voltar.
try { | ||
req = await fetch(`${modulesUrl}/calculate_shipping?app_id=${appId}`, { | ||
method: 'POST', | ||
body: JSON.stringify(bodyCalculateShipping), | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
}); | ||
|
||
data = (await req.json()).result; | ||
} catch (err) { | ||
console.error(err); | ||
} | ||
console.log('>> ', req, ' ', data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try catch em teste ? 🤔
|
.github/workflows/test-e2e.yml
Outdated
cp functions/.env functions/many/.env | ||
cp functions/.env functions/with-apps/.env | ||
cp functions/.env functions/ssr/.env |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isso daqui não deve ser necessário, se estiver sendo necessário outro comando (do @cloudcommerce/cli
) deve rolar antes do teste
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cloud-commerce/packages/cli/src/build.ts
Line 16 in aad3bf4
const filesToCopy = ['.env', 'config.json', 'ssr/content/settings.json']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cloud-commerce/packages/cli/src/cli.ts
Lines 97 to 99 in aad3bf4
if (argv._.includes('deploy')) { | |
return $firebase('deploy'); | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (argv._.includes('prepare')) {
// prepareCodebase
// return
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cloudcommerce prepare && test...
@leomp12 estava observando o pipeline do workflow dos teste, os secrets estão mesmo setados? |
packages/cli/src/cli.ts
Outdated
await prepareCodebases(true); | ||
return $`echo 'prepare'`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await prepareCodebases(true); | |
return $`echo 'prepare'`; | |
return prepareCodebases(false); |
Tem nada de echo
😄
Esse argumento booleano aí é o isDev
, ele faz preparar o codebase SSR pra dev server, acho que não precisa aqui (e faria o setup dos testes demorar mais)
Tão não, só no https://github.com/ecomplus/store 🤡 |
Vou colocar os |
Vamos convencionar um |
Acabei adicionando o teste para FRENET aqui também, depois que me toquei que deveria ser outra PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
valeu @wisley7l 👍🏾
No description provided.