Skip to content

Commit 32d022b

Browse files
committed
Fix TEST_SKIP flag; Update README.md
Signed-off-by: Francesco Torchia <[email protected]>
1 parent b0d1131 commit 32d022b

File tree

6 files changed

+58
-9
lines changed

6 files changed

+58
-9
lines changed

.github/workflows/test.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ jobs:
5858
TEST_PASSWORD: ${{ env.CATTLE_BOOTSTRAP_PASSWORD }}
5959
CATTLE_BOOTSTRAP_PASSWORD: ${{ env.CATTLE_BOOTSTRAP_PASSWORD }}
6060
TEST_BASE_URL: ${{ env.DEV_UI_URL }}
61-
TEST_SKIP: setup
6261
API: ${{ env.CATTLE_SERVER_URL }}
6362
run: |
6463
yarn e2e --browser chrome

README.md

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
1-
> :warning: Warning! This project is in its very early stages of development. Expect frequent changes and potential breaking updates as we iterate on features and architecture.
2-
31
# rancher-ai-ui
42

3+
The Rancher AI UI extension adds an AI-powered chat assistant directly into the Rancher Dashboard.
4+
5+
It helps users interact with clusters and workloads using conversational queries and suggested actions — improving discoverability, troubleshooting, and automation.
6+
7+
It also adds direct links in the Rancher UI to the Chat, available on resource lists, resource detail pages and the global navigation — making it quick to start a conversation about any cluster object or action.
8+
9+
Key features
10+
- Conversational assistant integrated into Rancher UI
11+
- Actionable suggestions and templates to speed common workflows
12+
- Support for configurable LLM backends (local or remote)
13+
514
## Running for Development
615
This is what you probably want to get started.
716
```bash
@@ -35,20 +44,38 @@ yarn serve-pkgs
3544
```
3645

3746
## E2E tests
38-
Running locally:
47+
48+
#### Launch the mock Agent
3949
```bash
40-
# Build and Run the mock Agent
4150
cd mock-agent
4251
yarn install
4352
yarn start
53+
```
4454

45-
# Launch dev UI
55+
#### Launch UI in dev mode
56+
```bash
4657
API=https://your-rancher VUE_APP_AGENT_MESSAGES_WS_PATH=ws://localhost:8000/ws/agent yarn dev
58+
```
4759

48-
# Launch Cypress Dashboard
60+
#### Launch Cypress
61+
62+
```bash
63+
# Launch Cypress dashboard - interactive mode
4964
TEST_SKIP=setup TEST_PASSWORD=${rancher-password} yarn cypress:open
65+
66+
# Run Cypress tests in background
67+
TEST_SKIP=setup TEST_PASSWORD=${rancher-password} yarn cypress:run
5068
```
5169

70+
#### Environment variables
71+
- `API`, the address of your Rancher instance.
72+
- `TEST_USERNAME`, default `admin`.
73+
- `TEST_PASSWORD`, user password or custom during first Rancher run.
74+
- `CATTLE_BOOTSTRAP_PASSWORD`, initialization password.
75+
- `TEST_BASE_URL`, Rancher UI dev URL, default `https://localhost:8005`.
76+
- `TEST_SKIP=setup`, avoid to execute bootstrap setup tests for already initialized Rancher instances, it has to be toggled in case of new instances
77+
78+
5279
License
5380
=======
5481
Check Rancher AI UI Apache License details [here](LICENSE)

cypress.config.ts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ require('dotenv').config();
1010
/**
1111
* VARIABLES
1212
*/
13+
let testDirs = ['setup', 'pages'];
1314
const hasCoverage = (process.env.TEST_INSTRUMENT === 'true') || false; // Add coverage if instrumented
1415
const skipSetup = process.env.TEST_SKIP?.includes('setup');
1516
const baseUrl = (process.env.TEST_BASE_URL || 'https://localhost:8005').replace(/\/$/, '');
@@ -49,6 +50,28 @@ if (apiUrl && !baseUrl.startsWith(apiUrl)) {
4950
console.log('\n ❗ API variable is different to TEST_BASE_URL - tests may fail due to authentication issues');
5051
}
5152

53+
/**
54+
* Filter test spec paths based on env var configuration
55+
* @returns
56+
*/
57+
const getSpecPattern = (dirs: string[], envs: NodeJS.ProcessEnv): string[] => {
58+
// Gets paths with only
59+
const onlyDirs = dirs.filter((dir) => (envs.TEST_ONLY?.split(',').map((env) => env.trim()).includes(dir)));
60+
61+
// List the test directories to be included
62+
const activeDirs = dirs.filter((dir) => !(envs.TEST_SKIP?.split(',').map((env) => env.trim()).includes(dir)));
63+
64+
const finalDirs = onlyDirs.length ? onlyDirs : activeDirs;
65+
const paths = finalDirs.map((dir) => `cypress/e2e/tests/${ dir }/**/*.spec.ts`);
66+
67+
if (process.env.NODE_ENV !== 'test') {
68+
// eslint-disable-next-line no-console
69+
console.log(`Running tests for paths: ${ paths.join(', ') }`);
70+
}
71+
72+
return paths;
73+
};
74+
5275
export default defineConfig({
5376
projectId: process.env.TEST_PROJECT_ID,
5477
defaultCommandTimeout: process.env.TEST_TIMEOUT ? +process.env.TEST_TIMEOUT : 10000,
@@ -89,7 +112,7 @@ export default defineConfig({
89112
e2e: {
90113
fixturesFolder: 'cypress/e2e/blueprints',
91114
experimentalSessionAndOrigin: true,
92-
specPattern: 'cypress/e2e/tests/**/*.spec.ts',
115+
specPattern: getSpecPattern(testDirs, process.env),
93116
baseUrl,
94117
async setupNodeEvents(on, config) {
95118
// For more info: https://docs.cypress.io/guides/tooling/code-coverage
File renamed without changes.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"lint-l10n": "./node_modules/.bin/yamllint pkg/rancher-ai-ui/l10n/en-us.yaml",
2525
"cypress:open": "cypress open --e2e --browser chrome",
2626
"cypress:run": "cypress run",
27-
"e2e": "TEST_SKIP=setup CATTLE_BOOTSTRAP_PASSWORD=$CATTLE_BOOTSTRAP_PASSWORD TEST_PASSWORD=$TEST_PASSWORD TEST_USERNAME=$TEST_USERNAME VAI_ENABLED=$VAI_ENABLED TEST_BASE_URL=$TEST_BASE_URL API=$API yarn cypress:run --spec 'cypress/e2e/tests/rancher-setup.spec.ts,cypress/e2e/tests/**/*.spec.ts'"
27+
"e2e": "CATTLE_BOOTSTRAP_PASSWORD=$CATTLE_BOOTSTRAP_PASSWORD TEST_PASSWORD=$TEST_PASSWORD TEST_USERNAME=$TEST_USERNAME VAI_ENABLED=$VAI_ENABLED TEST_BASE_URL=$TEST_BASE_URL API=$API yarn cypress:run"
2828
},
2929
"devDependencies": {
3030
"@types/lodash": "4.17.20",

0 commit comments

Comments
 (0)