Skip to content

Commit

Permalink
Merge branch 'development' into dependabot/npm_and_yarn/node-polyfill…
Browse files Browse the repository at this point in the history
…-webpack-plugin-4.0.0
  • Loading branch information
txau authored Jun 20, 2024
2 parents 109f97c + 6d22026 commit dd5d64e
Show file tree
Hide file tree
Showing 7 changed files with 329 additions and 39 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: e2e cypress
name: e2e cypress BASE

on:
push:
Expand Down Expand Up @@ -121,6 +121,7 @@ jobs:
browser: chrome
component: false
config-file: cypress.config.ts
spec: "cypress/e2e/*.cy.ts"
timeout-minutes: 25
env:
DBHOST: localhost:27017
Expand Down
142 changes: 142 additions & 0 deletions .github/workflows/ci_e2e_cypress_pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
name: e2e cypress PAGES

on:
push:
branches:
- production
- development
- staging
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
e2e-cypress:
runs-on: ubuntu-20.04
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.6-amd64
ports:
- 9200/tcp
options: -e="discovery.type=single-node" --health-cmd="curl http://localhost:9200/_cluster/health" --health-interval=10s --health-timeout=30s --health-retries=10
redis:
image: redis:5.0.14
ports:
- 6379:6379

steps:
- name: Start MongoDB
uses: supercharge/[email protected]
with:
mongodb-version: 5.0.27
mongodb-replica-set: test-rs
- name: Checkout reposistory
uses: actions/checkout@v4
- name: Checkout submodules
run: git submodule update --init --recursive
- name: Setup Nodejs
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Cache node modules
uses: actions/cache@v2
with:
path: ./node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
- name: install dependencies
run: yarn install
- run: sudo apt update
- run: sudo apt-get install poppler-utils
- name: Cache build
id: cache-build
uses: actions/cache@v2
with:
path: ./prod
key: >-
${{ runner.os }}-build-${{ hashFiles('app/**/*.*') }}-
${{ hashFiles('database/**/*.*') }}-
${{ hashFiles('**/yarn.lock') }}-
${{ hashFiles('**/webpack.production.config.js') }}-
${{ hashFiles('**/.babelrc') }}-
${{ hashFiles('webpack/**/config.js') }}-
- name: build production
if: steps.cache-build.outputs.cache-hit != 'true'
run: yarn production-build
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Clone dummy services
uses: actions/checkout@v4
with:
repository: huridocs/dummy_extractor_services
path: dummy_extractor_services
- run: python3 -m venv .venv
working-directory: dummy_extractor_services
- run: make install_venv -C dummy_extractor_services
- run: make start -C dummy_extractor_services > logs.log &
- run: sleep 5 && wget --waitretry=5 --retry-connrefused -v http://localhost:5051/info
- name: Log on failure
if: ${{ failure() }}
run: cat dummy_extractor_services/logs.log
- run: yarn blank-state
id: blank-state-attempt1
continue-on-error: true
env:
DBHOST: localhost:27017
ELASTICSEARCH_URL: http://localhost:${{ job.services.elasticsearch.ports[9200] }}
DATABASE_NAME: uwazi_e2e
INDEX_NAME: uwazi_e2e
TRANSPILED: true
- run: yarn blank-state --force
id: blank-state-attempt2
if: steps.blank-state-attempt1.outcome == 'failure'
env:
DBHOST: localhost:27017
ELASTICSEARCH_URL: http://localhost:${{ job.services.elasticsearch.ports[9200] }}
DATABASE_NAME: uwazi_e2e
INDEX_NAME: uwazi_e2e
TRANSPILED: true
- run: yarn ix-config
env:
DBHOST: localhost:27017
DATABASE_NAME: uwazi_e2e
- name: start Uwazi
env:
NOTIFICATION_DELAY: 50
DBHOST: localhost:27017
ELASTICSEARCH_URL: http://localhost:${{ job.services.elasticsearch.ports[9200] }}
DATABASE_NAME: uwazi_e2e
INDEX_NAME: uwazi_e2e
EXTERNAL_SERVICES: true
run: yarn run-production > output.txt &
- name: wait for uwazi to be ready
run: sleep 5 && wget --waitretry=5 --retry-connrefused -v http://localhost:3000/
timeout-minutes: 3
- name: Cypress run
uses: cypress-io/github-action@v6
with:
browser: chrome
component: false
config-file: cypress.config.ts
spec: "cypress/e2e/pages/*.cy.ts"
timeout-minutes: 25
env:
DBHOST: localhost:27017
ELASTICSEARCH_URL: http://localhost:${{ job.services.elasticsearch.ports[9200] }}
TRANSPILED: true
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: snapshots
path: cypress/e2e/**/__image_snapshots__/
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: video
path: cypress/videos/
- name: Print server output
run: cat output.txt
if: failure()
142 changes: 142 additions & 0 deletions .github/workflows/ci_e2e_cypress_ssettings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
name: e2e cypress SETTINGS

on:
push:
branches:
- production
- development
- staging
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
e2e-cypress:
runs-on: ubuntu-20.04
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.6-amd64
ports:
- 9200/tcp
options: -e="discovery.type=single-node" --health-cmd="curl http://localhost:9200/_cluster/health" --health-interval=10s --health-timeout=30s --health-retries=10
redis:
image: redis:5.0.14
ports:
- 6379:6379

steps:
- name: Start MongoDB
uses: supercharge/[email protected]
with:
mongodb-version: 5.0.27
mongodb-replica-set: test-rs
- name: Checkout reposistory
uses: actions/checkout@v4
- name: Checkout submodules
run: git submodule update --init --recursive
- name: Setup Nodejs
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Cache node modules
uses: actions/cache@v2
with:
path: ./node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
- name: install dependencies
run: yarn install
- run: sudo apt update
- run: sudo apt-get install poppler-utils
- name: Cache build
id: cache-build
uses: actions/cache@v2
with:
path: ./prod
key: >-
${{ runner.os }}-build-${{ hashFiles('app/**/*.*') }}-
${{ hashFiles('database/**/*.*') }}-
${{ hashFiles('**/yarn.lock') }}-
${{ hashFiles('**/webpack.production.config.js') }}-
${{ hashFiles('**/.babelrc') }}-
${{ hashFiles('webpack/**/config.js') }}-
- name: build production
if: steps.cache-build.outputs.cache-hit != 'true'
run: yarn production-build
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Clone dummy services
uses: actions/checkout@v4
with:
repository: huridocs/dummy_extractor_services
path: dummy_extractor_services
- run: python3 -m venv .venv
working-directory: dummy_extractor_services
- run: make install_venv -C dummy_extractor_services
- run: make start -C dummy_extractor_services > logs.log &
- run: sleep 5 && wget --waitretry=5 --retry-connrefused -v http://localhost:5051/info
- name: Log on failure
if: ${{ failure() }}
run: cat dummy_extractor_services/logs.log
- run: yarn blank-state
id: blank-state-attempt1
continue-on-error: true
env:
DBHOST: localhost:27017
ELASTICSEARCH_URL: http://localhost:${{ job.services.elasticsearch.ports[9200] }}
DATABASE_NAME: uwazi_e2e
INDEX_NAME: uwazi_e2e
TRANSPILED: true
- run: yarn blank-state --force
id: blank-state-attempt2
if: steps.blank-state-attempt1.outcome == 'failure'
env:
DBHOST: localhost:27017
ELASTICSEARCH_URL: http://localhost:${{ job.services.elasticsearch.ports[9200] }}
DATABASE_NAME: uwazi_e2e
INDEX_NAME: uwazi_e2e
TRANSPILED: true
- run: yarn ix-config
env:
DBHOST: localhost:27017
DATABASE_NAME: uwazi_e2e
- name: start Uwazi
env:
NOTIFICATION_DELAY: 50
DBHOST: localhost:27017
ELASTICSEARCH_URL: http://localhost:${{ job.services.elasticsearch.ports[9200] }}
DATABASE_NAME: uwazi_e2e
INDEX_NAME: uwazi_e2e
EXTERNAL_SERVICES: true
run: yarn run-production > output.txt &
- name: wait for uwazi to be ready
run: sleep 5 && wget --waitretry=5 --retry-connrefused -v http://localhost:3000/
timeout-minutes: 3
- name: Cypress run
uses: cypress-io/github-action@v6
with:
browser: chrome
component: false
config-file: cypress.config.ts
spec: "cypress/e2e/settings/*.cy.ts"
timeout-minutes: 25
env:
DBHOST: localhost:27017
ELASTICSEARCH_URL: http://localhost:${{ job.services.elasticsearch.ports[9200] }}
TRANSPILED: true
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: snapshots
path: cypress/e2e/**/__image_snapshots__/
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: video
path: cypress/videos/
- name: Print server output
run: cat output.txt
if: failure()
8 changes: 4 additions & 4 deletions app/api/sync/specs/syncWorker.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ describe('syncWorker', () => {
await db.disconnect();
});

it('should sync the configured templates and its defined properties', async () => {
it('should sync the whitelisted templates and properties', async () => {
await runAllTenants();
await tenants.run(async () => {
const syncedTemplates = await templates.get();
Expand Down Expand Up @@ -459,15 +459,15 @@ describe('syncWorker', () => {
}, 'target1');
});

describe('when a template that is configured has been deleted', () => {
describe('when a template that is whitelisted has been deleted', () => {
it('should not throw an error', async () => {
await tenants.run(async () => {
await entitiesModel.delete({ template: template1 });
//@ts-ignore
await templates.delete({ _id: template1 });
}, 'host1');

await expect(syncWorker.runAllTenants()).resolves.not.toThrowError();
await expect(syncWorker.runAllTenants()).resolves.not.toThrow();
});
});

Expand Down Expand Up @@ -575,7 +575,7 @@ describe('syncWorker', () => {
fixtures.settings[0].sync[0].config.pages = [];
await applyFixtures(fixtures, {});

await expect(runAllTenants).rejects.toThrowError(
await expect(runAllTenants).rejects.toThrow(
new Error('Invalid elements found in ordering - pages')
);

Expand Down
Loading

0 comments on commit dd5d64e

Please sign in to comment.