mirror of
https://github.com/jaypyles/Scraperr.git
synced 2025-10-30 05:57:12 +00:00
Compare commits
6 Commits
47c4c9a7d1
...
02619eb184
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
02619eb184 | ||
|
|
58c6c09fc9 | ||
|
|
bf896b4c6b | ||
|
|
e3b9c11ab7 | ||
|
|
32da3375b3 | ||
|
|
b5131cbe4c |
3
.github/workflows/merge.yml
vendored
3
.github/workflows/merge.yml
vendored
@@ -15,8 +15,11 @@ jobs:
|
||||
version:
|
||||
needs: tests
|
||||
uses: ./.github/workflows/version.yml
|
||||
secrets:
|
||||
git_token: ${{ secrets.GPAT_TOKEN }}
|
||||
|
||||
build-and-deploy:
|
||||
if: needs.version.outputs.version_bump == 'true'
|
||||
needs: version
|
||||
uses: ./.github/workflows/docker-image.yml
|
||||
secrets:
|
||||
|
||||
27
.github/workflows/version.yml
vendored
27
.github/workflows/version.yml
vendored
@@ -2,10 +2,16 @@ name: Version
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
secrets:
|
||||
git_token:
|
||||
required: true
|
||||
outputs:
|
||||
version:
|
||||
description: "The new version number"
|
||||
value: ${{ jobs.version.outputs.version }}
|
||||
version_bump:
|
||||
description: "Whether the version was bumped"
|
||||
value: ${{ jobs.version.outputs.version_bump }}
|
||||
|
||||
jobs:
|
||||
version:
|
||||
@@ -37,7 +43,27 @@ jobs:
|
||||
|
||||
echo "VERSION_TYPE=$VERSION_TYPE" >> $GITHUB_ENV
|
||||
|
||||
- name: Check for version bump
|
||||
id: check_version_bump
|
||||
run: |
|
||||
COMMIT_MSG=$(git log -1 --pretty=%B)
|
||||
if [[ $COMMIT_MSG =~ ^feat\(breaking\) ]]; then
|
||||
echo "version_bump=true" >> $GITHUB_OUTPUT
|
||||
elif [[ $COMMIT_MSG =~ .*\[no\ bump\].* ]]; then
|
||||
echo "version_bump=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Skip version bump
|
||||
if: steps.check_version_bump.outputs.version_bump == 'false'
|
||||
run: |
|
||||
echo "Skipping version bump as requested"
|
||||
gh run cancel ${{ github.run_id }}
|
||||
exit 0
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.git_token }}
|
||||
|
||||
- name: Set version
|
||||
if: steps.check_version_bump.outputs.version_bump != 'false'
|
||||
id: set_version
|
||||
run: |
|
||||
VERSION=$(./scripts/version.sh "$VERSION_TYPE")
|
||||
@@ -48,6 +74,7 @@ jobs:
|
||||
VERSION_TYPE: ${{ env.VERSION_TYPE }}
|
||||
|
||||
- name: Update chart file
|
||||
if: steps.check_version_bump.outputs.version_bump != 'false'
|
||||
run: |
|
||||
sed -i "s/^version: .*/version: $VERSION/" helm/Chart.yaml
|
||||
|
||||
|
||||
@@ -7,11 +7,10 @@ import {
|
||||
} from "../utilities/job.utilities";
|
||||
import { mockSubmitJob } from "../utilities/mocks";
|
||||
|
||||
describe.only("Agent", () => {
|
||||
describe("Agent", () => {
|
||||
beforeEach(() => {
|
||||
mockSubmitJob();
|
||||
login();
|
||||
cy.visit("/agent");
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@@ -19,6 +18,9 @@ describe.only("Agent", () => {
|
||||
});
|
||||
|
||||
it("should be able to scrape some data", () => {
|
||||
cy.visit("/agent");
|
||||
cy.wait(1000);
|
||||
|
||||
const url = "https://books.toscrape.com";
|
||||
const prompt = "Collect all the links on the page";
|
||||
buildAgentJob(url, prompt);
|
||||
|
||||
@@ -4,7 +4,7 @@ export const cleanUpJobs = () => {
|
||||
|
||||
cy.wait("@retrieve", { timeout: 15000 });
|
||||
|
||||
cy.get("tbody tr", { timeout: 10000 }).should("have.length.at.least", 1);
|
||||
cy.get("tbody tr", { timeout: 20000 }).should("have.length.at.least", 1);
|
||||
|
||||
const tryClickSelectAll = (attempt = 1, maxAttempts = 5) => {
|
||||
cy.log(`Attempt ${attempt} to click Select All`);
|
||||
@@ -124,6 +124,7 @@ export const openAdvancedJobOptions = () => {
|
||||
};
|
||||
|
||||
export const selectJobFromSelector = () => {
|
||||
checkAiDisabled();
|
||||
cy.get("div[id='select-job']", { timeout: 10000 }).first().click();
|
||||
cy.get("li[role='option']", { timeout: 10000 }).first().click();
|
||||
};
|
||||
@@ -162,15 +163,13 @@ export const addElement = (name: string, xpath: string) => {
|
||||
};
|
||||
|
||||
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."
|
||||
cy.getAllLocalStorage().then((result) => {
|
||||
const storage = JSON.parse(
|
||||
result["http://localhost"]["persist:root"] as string
|
||||
);
|
||||
}
|
||||
const settings = JSON.parse(storage.settings);
|
||||
expect(settings.aiEnabled).to.equal(true);
|
||||
});
|
||||
};
|
||||
|
||||
export const buildAgentJob = (url: string, prompt: string) => {
|
||||
|
||||
@@ -12,6 +12,7 @@ export const Disabled = ({ message }: DisabledProps) => {
|
||||
display="flex"
|
||||
justifyContent="center"
|
||||
alignItems="center"
|
||||
data-testid="disabled-message"
|
||||
>
|
||||
<h4
|
||||
style={{
|
||||
|
||||
Reference in New Issue
Block a user