mirror of
https://github.com/jaypyles/Scraperr.git
synced 2025-10-30 05:57:12 +00:00
Compare commits
5 Commits
9857fa96e0
...
47c4c9a7d1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
47c4c9a7d1 | ||
|
|
4352988666 | ||
|
|
00759151e6 | ||
|
|
bfae00ca72 | ||
|
|
e810700569 |
10
.github/actions/run-cypress-tests/action.yaml
vendored
10
.github/actions/run-cypress-tests/action.yaml
vendored
@@ -20,6 +20,16 @@ runs:
|
||||
with:
|
||||
node-version: 22
|
||||
|
||||
- name: Setup yarn
|
||||
shell: bash
|
||||
run: npm install -g yarn
|
||||
|
||||
- name: Install xvfb for headless testing
|
||||
shell: bash
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y xvfb libnss3 libatk1.0-0 libatk-bridge2.0-0 libcups2 libdrm2 libxkbcommon0 libxcomposite1 libxdamage1 libxfixes3 libxrandr2 libgbm1 libasound2t64 libpango-1.0-0 libcairo2 libgtk-3-0 libgdk-pixbuf2.0-0 libx11-6 libx11-xcb1 libxcb1 libxss1 libxtst6 libnspr4
|
||||
|
||||
- name: Setup Docker project
|
||||
shell: bash
|
||||
run: |
|
||||
|
||||
32
.github/workflows/cypress-tests.yml
vendored
Normal file
32
.github/workflows/cypress-tests.yml
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
name: Cypress Tests
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
secrets:
|
||||
openai_key:
|
||||
required: true
|
||||
|
||||
|
||||
jobs:
|
||||
cypress-tests:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Run Cypress Tests
|
||||
id: run-tests
|
||||
uses: ./.github/actions/run-cypress-tests
|
||||
with:
|
||||
openai_key: ${{ secrets.openai_key }}
|
||||
continue-on-error: true
|
||||
|
||||
- name: Check container logs on failure
|
||||
if: steps.run-tests.outcome == 'failure'
|
||||
run: |
|
||||
echo "Cypress tests failed. Dumping container logs..."
|
||||
docker logs scraperr_api || true
|
||||
|
||||
- name: Fail job if Cypress failed
|
||||
if: steps.run-tests.outcome == 'failure'
|
||||
run: exit 1
|
||||
- uses: actions/checkout@v4
|
||||
27
.github/workflows/pytest.yml
vendored
Normal file
27
.github/workflows/pytest.yml
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
name: Pytest
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
unit-tests:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set env
|
||||
run: echo "ENV=test" >> $GITHUB_ENV
|
||||
|
||||
- name: Install pdm
|
||||
run: pip install pdm
|
||||
|
||||
- name: Install project dependencies
|
||||
run: pdm install
|
||||
|
||||
- name: Install playwright
|
||||
run: pdm run playwright install
|
||||
|
||||
- name: Run tests
|
||||
run: PYTHONPATH=. pdm run pytest -v -ra api/backend/tests
|
||||
|
||||
37
.github/workflows/tests.yml
vendored
37
.github/workflows/tests.yml
vendored
@@ -10,26 +10,8 @@ on:
|
||||
|
||||
|
||||
jobs:
|
||||
unit-tests:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set env
|
||||
run: echo "ENV=test" >> $GITHUB_ENV
|
||||
|
||||
- name: Install pdm
|
||||
run: pip install pdm
|
||||
|
||||
- name: Install project dependencies
|
||||
run: pdm install
|
||||
|
||||
- name: Install playwright
|
||||
run: pdm run playwright install
|
||||
|
||||
- name: Run tests
|
||||
run: PYTHONPATH=. pdm run pytest -v -ra api/backend/tests
|
||||
pytest:
|
||||
uses: ./.github/workflows/pytest.yml
|
||||
|
||||
cypress-tests:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -37,26 +19,15 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Run Cypress Tests
|
||||
id: run-tests
|
||||
uses: ./.github/actions/run-cypress-tests
|
||||
with:
|
||||
openai_key: ${{ secrets.OPENAI_KEY }}
|
||||
openai_key: ${{ secrets.openai_key }}
|
||||
continue-on-error: true
|
||||
|
||||
- name: Check container logs on failure
|
||||
if: steps.run-tests.outcome == 'failure'
|
||||
run: |
|
||||
echo "Cypress tests failed. Dumping container logs..."
|
||||
docker logs scraperr_api || true
|
||||
|
||||
- name: Fail job if Cypress failed
|
||||
if: steps.run-tests.outcome == 'failure'
|
||||
run: exit 1
|
||||
|
||||
success-message:
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- unit-tests
|
||||
- pytest
|
||||
- cypress-tests
|
||||
steps:
|
||||
- name: Send Discord Message
|
||||
|
||||
2
.github/workflows/version.yml
vendored
2
.github/workflows/version.yml
vendored
@@ -43,7 +43,7 @@ jobs:
|
||||
VERSION=$(./scripts/version.sh "$VERSION_TYPE")
|
||||
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
||||
echo "Version is $VERSION"
|
||||
echo "::set-output name=version::$VERSION"
|
||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||
env:
|
||||
VERSION_TYPE: ${{ env.VERSION_TYPE }}
|
||||
|
||||
|
||||
@@ -161,7 +161,20 @@ export const addElement = (name: string, xpath: string) => {
|
||||
cy.get('[data-cy="add-button"]').click();
|
||||
};
|
||||
|
||||
export const checkAiDisabled = () => {
|
||||
const disabledMessage = cy.contains(
|
||||
/must set either OPENAI_KEY or OLLAMA_MODEL to use AI features/i
|
||||
);
|
||||
|
||||
if (disabledMessage) {
|
||||
throw new Error(
|
||||
"Must set either OPENAI_KEY or OLLAMA_MODEL to use AI features."
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
export const buildAgentJob = (url: string, prompt: string) => {
|
||||
checkAiDisabled();
|
||||
enterJobUrl(url);
|
||||
cy.get("[data-cy='prompt-input']").type(prompt);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user