Skip to content

Commit

Permalink
(e2e): catalog versions e2e weekly tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tplevko committed Jan 7, 2025
1 parent 6ca0112 commit 707cb77
Show file tree
Hide file tree
Showing 8 changed files with 402 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ jobs:
working-directory: packages/ui-tests
wait-on: 'http://127.0.0.1:4173'
wait-on-timeout: 120
env: grepTags=-weekly
env:
CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
Expand Down Expand Up @@ -164,6 +165,7 @@ jobs:
working-directory: packages/ui-tests
wait-on: 'http://127.0.0.1:4173'
wait-on-timeout: 120
env: grepTags=-weekly
env:
CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
Expand Down Expand Up @@ -223,6 +225,7 @@ jobs:
working-directory: packages/ui-tests
wait-on: 'http://127.0.0.1:4173'
wait-on-timeout: 120
env: grepTags=-weekly
env:
CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
Expand Down
243 changes: 243 additions & 0 deletions .github/workflows/e2e-weekly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,243 @@
name: 🏗️ E2E Weekly Tests (Cypress)

on:
schedule:
- cron: "0 0 * * 7"

jobs:
install:
runs-on: ubuntu-latest

container:
image: cypress/browsers:node-20.13.1-chrome-125.0.6422.60-1-ff-126.0-edge-125.0.2535.51-1
options: --user 1001

steps:
- name: 👷‍♀️ Checkout
uses: actions/checkout@v4

- uses: actions/cache@v4
with:
path: |
**/node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'

# Install dependencies
- run: yarn install --immutable

# Build packages excluding @kaoto/camel-catalog since it was build during installing dependencies
- name: Build packages
run: yarn workspaces foreach --verbose --all --topological-dev --exclude @kaoto/camel-catalog run build

# Build lib
- name: Build @kaoto/kaoto package in lib mode
run: yarn workspace @kaoto/kaoto run build:lib

- name: 💾 Save build folder
uses: actions/upload-artifact@v4
with:
name: ui-dist
if-no-files-found: error
path: packages/ui/dist

- name: 💾 Save catalog build folder
uses: actions/upload-artifact@v4
with:
name: catalog-dist
if-no-files-found: error
path: packages/catalog-generator/dist/camel-catalog

test-on-firefox:
needs: install
runs-on: ubuntu-latest
container:
image: cypress/browsers:node-20.13.1-chrome-125.0.6422.60-1-ff-126.0-edge-125.0.2535.51-1
options: --user 1001

steps:
- name: 👷‍♀️ Checkout
uses: actions/checkout@v4

- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'

- name: 🗄️ Download the UI build folder
uses: actions/download-artifact@v4
with:
name: ui-dist
path: packages/ui/dist

- name: 🗄️ Download the catalog build folder
uses: actions/download-artifact@v4
with:
name: catalog-dist
path: packages/camel-catalog/dist

- name: 🔨 Cypress run
uses: cypress-io/github-action@v6.7.8
with:
browser: firefox
# we have already installed all dependencies above
# install: false
start: yarn workspace @kaoto/kaoto run preview --host
config: baseUrl=http://localhost:4173
working-directory: packages/ui-tests
wait-on: 'http://127.0.0.1:4173'
wait-on-timeout: 120
env: grepTags=weekly
env:
CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: 💾 Save videos
if: failure()
uses: actions/upload-artifact@v4
with:
name: videos-firefox
path: packages/ui-tests/cypress/videos

- name: 💾 Save screenshots
if: failure()
uses: actions/upload-artifact@v4
with:
name: screenshots-firefox
path: packages/ui-tests/cypress/screenshots

test-on-chrome:
needs: install
runs-on: ubuntu-latest
container:
image: cypress/browsers:node-20.13.1-chrome-125.0.6422.60-1-ff-126.0-edge-125.0.2535.51-1
options: --user 1001

steps:
- name: 👷‍♀️ Checkout
uses: actions/checkout@v4

- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'

- name: 🗄️ Download the UI build folder
uses: actions/download-artifact@v4
with:
name: ui-dist
path: packages/ui/dist

- name: 🗄️ Download the catalog build folder
uses: actions/download-artifact@v4
with:
name: catalog-dist
path: packages/camel-catalog/dist

- name: 🔨 Cypress run
uses: cypress-io/github-action@v6.7.8
with:
browser: chrome
# we have already installed all dependencies above
# install: false
start: yarn workspace @kaoto/kaoto run preview --host
config: baseUrl=http://localhost:4173
working-directory: packages/ui-tests
wait-on: 'http://127.0.0.1:4173'
wait-on-timeout: 120
env: grepTags=weekly
env:
CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: 💾 Save videos
if: failure()
uses: actions/upload-artifact@v4
with:
name: videos-chrome
path: packages/ui-tests/cypress/videos

- name: 💾 Save screenshots
if: failure()
uses: actions/upload-artifact@v4
with:
name: screenshots-chrome
path: packages/ui-tests/cypress/screenshots

test-on-edge:
needs: install
runs-on: ubuntu-latest
container:
image: cypress/browsers:node-20.13.1-chrome-125.0.6422.60-1-ff-126.0-edge-125.0.2535.51-1
options: --user 1001

steps:
- name: 👷‍♀️ Checkout
uses: actions/checkout@v4

- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'

- name: 🗄️ Download the UI build folder
uses: actions/download-artifact@v4
with:
name: ui-dist
path: packages/ui/dist

- name: 🗄️ Download the catalog build folder
uses: actions/download-artifact@v4
with:
name: catalog-dist
path: packages/camel-catalog/dist

- name: 🔨 Cypress run
uses: cypress-io/github-action@v6.7.8
with:
browser: edge
# we have already installed all dependencies above
# install: false
start: yarn workspace @kaoto/kaoto run preview --host
config: baseUrl=http://localhost:4173
working-directory: packages/ui-tests
wait-on: 'http://127.0.0.1:4173'
wait-on-timeout: 120
env: grepTags=weekly
env:
CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: 💾 Save videos
if: failure()
uses: actions/upload-artifact@v4
with:
name: videos-edge
path: packages/ui-tests/cypress/videos

- name: 💾 Save screenshots
if: failure()
uses: actions/upload-artifact@v4
with:
name: screenshots-edge
path: packages/ui-tests/cypress/screenshots
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
describe('Test for catalog versions', () => {
beforeEach(() => {
cy.openHomePage();
});

const testData = [
{ type: 'Main', version: 'Camel Main 4.9.0' },
{ type: 'Main', version: 'Camel Main 4.4.0.redhat-00046' },
{ type: 'Main', version: 'Camel Main 4.8.0.redhat-00017' },
{ type: 'Main', version: 'Camel Main 4.4.4' },
{ type: 'Main', version: 'Camel Main 4.8.2' },
{ type: 'Quarkus', version: 'Camel Quarkus 3.17.0' },
{ type: 'Quarkus', version: 'Camel Quarkus 3.15.1' },
{ type: 'Quarkus', version: 'Camel Quarkus 3.8.4' },
{ type: 'Quarkus', version: 'Camel Quarkus 3.15.0.redhat-00007' },
{ type: 'Quarkus', version: 'Camel Quarkus 3.8.0.redhat-00018' },
{ type: 'Spring Boot', version: 'Camel Spring Boot 4.4.0.redhat-00039' },
{ type: 'Spring Boot', version: 'Camel Spring Boot 4.8.0.redhat-00022' },
{ type: 'Spring Boot', version: 'Camel Spring Boot 4.4.4' },
{ type: 'Spring Boot', version: 'Camel Spring Boot 4.8.2' },
{ type: 'Spring Boot', version: 'Camel Spring Boot 4.9.0' },
];
testData.forEach((data) => {
it(`Catalog version test for ${data.version}`, { tags: ['weekly'] }, () => {
cy.uploadFixture('flows/camelRoute/catalogConfig.yaml');
cy.openDesignPage();

cy.hoverOnRuntime(data.type);
cy.get(`[data-testid^="runtime-selector-${data.version}"] button.pf-v5-c-menu__item`)
.first()
.click({ force: true });
cy.get('body').then((body) => {
if (body.find('[testid="loading-schemas"]').length > 0) {
cy.waitSchemasLoading();
}
});

cy.openStepConfigurationTab('timer', 0);
cy.selectFormTab('All');
// Check the configured fields didn't change in the node
cy.checkConfigInputObject('parameters.timerName', 'testTimerName');
cy.checkConfigInputObject('parameters.delay', '2000');
cy.checkConfigInputObject('parameters.period', '2000');
cy.checkConfigInputObject('parameters.repeatCount', '10');

cy.openStepConfigurationTab('setHeader', 0);
cy.selectFormTab('All');
// Check the configured fields didn't change in the node
cy.checkConfigInputObject('expression', 'testExpression');
cy.checkConfigInputObject('id', 'testId');
cy.checkConfigInputObject('name', 'testName');

cy.openStepConfigurationTab('log', 0);
cy.selectFormTab('All');
// Check the configured fields didn't change in the node
cy.checkConfigInputObject('description', 'log');
cy.checkConfigInputObject('logName', 'testLoggerName');
cy.contains('button', 'Processor advanced properties').click();
cy.checkConfigInputObject('marker', 'testMarker');
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ describe('Tests for switching description and ID in settings page', () => {
});

// Reset nodeLabel to description
after(() => {
afterEach(() => {
cy.openSettings();
cy.selectInTypeaheadField('nodeLabel', 'description');
cy.get('[data-testid="settings-form-save-btn"]').click();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
- route:
id: route-3933
from:
id: from-3455
uri: timer
parameters:
delay: "2000"
fixedRate: false
period: "2000"
repeatCount: "10"
timerName: testTimerName
steps:
- setHeader:
id: setHeader-2258
expression:
simple:
id: testId
expression: testExpression
name: testName
- log:
id: log-3491
description: log
logName: testLoggerName
marker: testMarker
message: ${body}
3 changes: 3 additions & 0 deletions packages/ui-tests/cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ import './next-commands/nodeConfiguration';
import './next-commands/design';
import './next-commands/metadata';

import registerCypressGrep from '@cypress/grep/src/support';
registerCypressGrep();

Cypress.on('uncaught:exception', (_err, _runnable) => {
// returning false here prevents Cypress from
// failing the test
Expand Down
4 changes: 3 additions & 1 deletion packages/ui-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"license": "Apache License v2.0",
"scripts": {
"e2e": "cypress open --config-file=cypress.config.ts",
"e2e:headless": "cypress run",
"e2e:headless": "cypress run --env grepTags=-weekly",
"e2e:headless-weekly": "cypress run --env grepTags=weekly",
"e2e-preview": "cypress open --config-file=cypress.config.ts --config baseUrl=http://localhost:4173/",
"e2e-preview:headless": "cypress run --config baseUrl=http://localhost:4173/",
"lint": "yarn eslint \"cypress/**/*.{ts,tsx}\" \"stories/**/*.{ts,tsx}\"",
Expand All @@ -22,6 +23,7 @@
"chromatic": "chromatic --build-script-name 'build:storybook' --exit-zero-on-changes --project-token=chpt_7a4940aa65b14ab"
},
"devDependencies": {
"@cypress/grep": "^4.1.0",
"@eslint/js": "^9.10.0",
"@kaoto/kaoto": "workspace:*",
"@storybook/addon-essentials": "^8.2.8",
Expand Down
Loading

0 comments on commit 707cb77

Please sign in to comment.