-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore(cypress): bump package * chore(prettier): enable prettier on cypress tests files * fix(e2e): enable back auth tests * fix(e2e): enable back ressources tests * fix(e2e): enable back remaining tests * chore: enable back cypress workflow * feat(cypress): upload failed files as artifacts * fix(cypress): failing tests * fix: import fs * fix: code review
- Loading branch information
Showing
35 changed files
with
811 additions
and
775 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
name: TestE2E | ||
|
||
on: | ||
pull_request: | ||
types: [opened, reopened, review_requested, ready_for_review, synchronize] | ||
|
||
jobs: | ||
cypress-run: | ||
if: github.event.pull_request.draft == false | ||
name: Run Test E2E | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out Git repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Checkout API Git repository | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: getlago/lago-api | ||
ref: ${{ github.event.inputs.api_branch }} | ||
path: api | ||
token: ${{ secrets.GH_TOKEN }} | ||
|
||
- name: Build Front local image | ||
run: | | ||
docker build -t getlago/front:ci ./ | ||
- name: Build API local image | ||
run: | | ||
docker build -t getlago/api:ci ./api | ||
- name: Generate API RSA Key | ||
run: | | ||
echo "LAGO_RSA_PRIVATE_KEY=\"`openssl genrsa 2048 | base64`\"" >> .env | ||
- name: Launch APP + API | ||
env: | ||
LAGO_LICENSE: ${{ secrets.LAGO_LICENSE }} | ||
run: | | ||
docker compose -f ./ci/docker-compose.ci.yml --env-file ./.env up -d db redis api front | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
|
||
- name: Cypress run | ||
uses: cypress-io/github-action@v6 | ||
env: | ||
CYPRESS_GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | ||
with: | ||
browser: chrome | ||
record: false | ||
config-file: ./cypress/cypress.config.js | ||
config: baseUrl=http://localhost,viewportHeight=800,viewportWidth=1280,video=true | ||
spec: | | ||
cypress/e2e/00-auth/* | ||
cypress/e2e/10-resources/* | ||
cypress/e2e/t10-* | ||
cypress/e2e/t20-* | ||
cypress/e2e/t30-* | ||
- name: Upload screenshots | ||
uses: actions/upload-artifact@v4 | ||
if: failure() | ||
with: | ||
name: cypress-screenshots | ||
path: cypress/screenshots | ||
if-no-files-found: ignore | ||
|
||
- name: Upload videos | ||
uses: actions/upload-artifact@v4 | ||
if: failure() | ||
with: | ||
name: cypress-videos | ||
path: cypress/videos | ||
if-no-files-found: ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ dist | |
.env | ||
yarn-error.log | ||
coverage | ||
cypress/downloads |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ dist | |
generated | ||
globals.d.ts | ||
ci | ||
cypress/* | ||
cypress/downloads | ||
cypress/screenshots |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,26 @@ | ||
const { defineConfig } = require('cypress') | ||
const fs = require('fs') | ||
|
||
require('dotenv').config({ path: '../.env' }) | ||
|
||
module.exports = defineConfig({ | ||
projectId: 'u863yi', | ||
e2e: { | ||
baseUrl: process.env.CYPRESS_APP_URL, | ||
experimentalRunAllSpecs: true, | ||
setupNodeEvents(on) { | ||
on('after:spec', (_spec, results) => { | ||
if (results && results.video) { | ||
// Do we have failures for any retry attempts? | ||
const failures = results.tests.some((test) => | ||
test.attempts.some((attempt) => attempt.state === 'failed'), | ||
) | ||
if (!failures) { | ||
// delete the video if the spec passed and no tests retried | ||
fs.unlinkSync(results.video) | ||
} | ||
} | ||
}) | ||
}, | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,51 @@ | ||
import { TAX_TEN_CODE, TAX_TWENTY_CODE } from '../../support/reusableConstants' | ||
|
||
describe('Create taxes', () => { | ||
it('remove me when other tests are uncommented', () => { | ||
expect(true).to.equal(true) | ||
it('should create taxes', () => { | ||
cy.visit('/settings/taxes') | ||
cy.url().should('include', '/settings/taxes') | ||
|
||
// Make sure no tax exists | ||
cy.get('[data-test="empty-title"]').should('exist') | ||
|
||
// Create tax 10% | ||
cy.get('[data-test="create-tax-button"]').click() | ||
cy.url().should('include', '/create/tax') | ||
cy.get('input[name="name"]').type(TAX_TEN_CODE) | ||
cy.get('input[name="code"]').type(TAX_TEN_CODE) | ||
cy.get('input[name="rate"]').type('10') | ||
cy.get('[data-test="submit"]').click() | ||
|
||
// Create tax 20% | ||
cy.get('[data-test="create-tax-button"]').click() | ||
cy.url().should('include', '/create/tax') | ||
cy.get('input[name="name"]').type(TAX_TWENTY_CODE) | ||
cy.get('input[name="code"]').type(TAX_TWENTY_CODE) | ||
cy.get('input[name="rate"]').type('20') | ||
cy.get('[data-test="submit"]').click() | ||
|
||
cy.get(`[data-test="${TAX_TEN_CODE}"]`).should('exist') | ||
cy.get(`[data-test="${TAX_TWENTY_CODE}"]`).should('exist') | ||
}) | ||
|
||
it('should assign tax to organization', () => { | ||
cy.visit('/settings/invoice') | ||
cy.url().should('include', '/settings/invoice') | ||
|
||
// Make sure no tax are already assigned | ||
cy.get('[data-test="empty-taxes"]') | ||
.scrollIntoView({ | ||
offset: { top: -100, left: 0 }, | ||
duration: 0, | ||
}) | ||
.should('exist') | ||
|
||
// Assign tax 20% | ||
cy.get('[data-test="add-tax-button"]').click() | ||
cy.get('[data-test="add-organization-tax-dialog"]').should('exist') | ||
cy.get('input[name="selectTax"]').click() | ||
cy.get('[data-option-index="1"]').click() | ||
cy.get('[data-test="submit-add-organization-tax-dialog-assign-button"]').click() | ||
cy.get(`[data-test="applied-tax-${TAX_TWENTY_CODE}"]`).should('exist') | ||
}) | ||
// TODO: uncomment when clickhouse migration is dones | ||
// it('should create taxes', () => { | ||
// cy.visit('/settings/taxes') | ||
// cy.url().should('include', '/settings/taxes') | ||
// // Make sure no tax exists | ||
// cy.get('[data-test="empty-title"]').should('exist') | ||
|
||
// // Create tax 10% | ||
// cy.get('[data-test="create-tax-button"]').click() | ||
// cy.url().should('include', '/create/tax') | ||
// cy.get('input[name="name"]').type(TAX_TEN_CODE) | ||
// cy.get('input[name="code"]').type(TAX_TEN_CODE) | ||
// cy.get('input[name="rate"]').type('10') | ||
// cy.get('[data-test="submit"]').click() | ||
// // Create tax 20% | ||
// cy.get('[data-test="create-tax-button"]').click() | ||
// cy.url().should('include', '/create/tax') | ||
// cy.get('input[name="name"]').type(TAX_TWENTY_CODE) | ||
// cy.get('input[name="code"]').type(TAX_TWENTY_CODE) | ||
// cy.get('input[name="rate"]').type('20') | ||
// cy.get('[data-test="submit"]').click() | ||
|
||
// cy.get(`[data-test="${TAX_TEN_CODE}"]`).should('exist') | ||
// cy.get(`[data-test="${TAX_TWENTY_CODE}"]`).should('exist') | ||
// }) | ||
|
||
// TODO: uncomment | ||
// it('sould assign tax to organization', () => { | ||
// cy.visit('/settings/invoice') | ||
// cy.url().should('include', '/settings/invoice') | ||
|
||
// // Make sure no tax are already assigned | ||
// cy.get('[data-test="empty-taxes"]') | ||
// .scrollIntoView({ | ||
// offset: { top: -100, left: 0 }, | ||
// duration: 0, | ||
// }) | ||
// .should('exist') | ||
|
||
// // Assign tax 20% | ||
// cy.get('[data-test="add-tax-button"]').click() | ||
// cy.get('[data-test="add-organization-tax-dialog"]').should('exist') | ||
// cy.get('input[name="selectTax"]').click() | ||
// cy.get('[data-option-index="1"]').click() | ||
// cy.get('[data-test="submit-add-organization-tax-dialog-assign-button"]').click() | ||
// cy.get(`[data-test="applied-tax-${TAX_TWENTY_CODE}"]`).should('exist') | ||
// }) | ||
}) |
Oops, something went wrong.