mirror of
https://github.com/wassname/Open-Assistant.git
synced 2026-07-17 11:23:49 +08:00
ci: run contract tests through separate cypress command and add into CI
This commit is contained in:
@@ -15,6 +15,9 @@ jobs:
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: "3.10"
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
|
||||
- run: cd oasst-shared && pip install -e .
|
||||
|
||||
@@ -22,9 +25,14 @@ jobs:
|
||||
|
||||
- run: cd backend && pip install -r requirements.txt
|
||||
|
||||
- run: cd frontend && npm install
|
||||
|
||||
- run: ./scripts/backend-development/start-mock-server.sh
|
||||
|
||||
- name: Run contract tests
|
||||
- name: Run Python OasstApiClient contract tests
|
||||
run: ./scripts/oasst-shared-development/test.sh
|
||||
|
||||
- name: Run JavaScript OasstApiClient contract tests
|
||||
run: ./scripts/frontend-development/run-contract-test.sh
|
||||
|
||||
- run: ./scripts/backend-development/stop-mock-server.sh
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
|
||||
|
||||
# switch to website directory
|
||||
pushd "$parent_path/../../website"
|
||||
|
||||
set -xe
|
||||
|
||||
npm run cypress:run:contract
|
||||
|
||||
popd
|
||||
@@ -0,0 +1,9 @@
|
||||
import { defineConfig } from "cypress";
|
||||
|
||||
export default defineConfig({
|
||||
e2e: {
|
||||
// No baseUrl here, because we don't need it for contract testing
|
||||
baseUrl: null,
|
||||
specPattern: "cypress/contract/*.cy.{ts,js}",
|
||||
},
|
||||
});
|
||||
+1
@@ -1,6 +1,7 @@
|
||||
import OasstApiClient from "src/lib/oasst_api_client";
|
||||
|
||||
describe("Contract test for Oasst API", function () {
|
||||
// Assumes this is running the mock server.
|
||||
const oasstApiClient = new OasstApiClient("http://localhost:8080", "test");
|
||||
|
||||
it("can fetch a task", async () => {
|
||||
@@ -12,6 +12,7 @@
|
||||
"build-storybook": "build-storybook",
|
||||
"cypress": "cypress open",
|
||||
"cypress:run": "cypress run",
|
||||
"cypress:run:contract": "cypress run --config-file ./cypress.config.contract.js",
|
||||
"cypress:image-baseline": "cypress-image-diff -u",
|
||||
"fix:lint": "eslint --fix src/ --ext .js,.jsx,.ts,.tsx",
|
||||
"fix:format": "prettier --write ./src",
|
||||
|
||||
Reference in New Issue
Block a user