Skip to content

Commit

Permalink
fix: resolve errors in e2e tests for cypress
Browse files Browse the repository at this point in the history
Signed-off-by: tariq-hasan <[email protected]>
  • Loading branch information
tariq-hasan committed Aug 24, 2024
1 parent 0b4e7c1 commit 7f2d7db
Show file tree
Hide file tree
Showing 9 changed files with 25,849 additions and 10,853 deletions.
15 changes: 7 additions & 8 deletions .github/workflows/test-node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 12.18.1
node-version: 16.20.2

- name: Format katib code
run: |
Expand All @@ -44,12 +44,12 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 12.18.1
node-version: 16.20.2

- name: Fetch Kubeflow and install common code dependencies
run: |
COMMIT=$(cat pkg/ui/v1beta1/frontend/COMMIT)
cd /tmp && git clone https://github.com/kubeflow/kubeflow.git
cd /tmp && git clone https://github.com/tariq-hasan/kubeflow.git
cd kubeflow
git checkout $COMMIT
cd components/crud-web-apps/common/frontend/kubeflow-common-lib
Expand All @@ -74,15 +74,15 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup node version to 12
- name: Setup node version to 16
uses: actions/setup-node@v4
with:
node-version: 12
node-version: 16

- name: Fetch Kubeflow and install common code dependencies
run: |
COMMIT=$(cat pkg/ui/v1beta1/frontend/COMMIT)
cd /tmp && git clone https://github.com/kubeflow/kubeflow.git
cd /tmp && git clone https://github.com/tariq-hasan/kubeflow.git
cd kubeflow
git checkout $COMMIT
cd components/crud-web-apps/common/frontend/kubeflow-common-lib
Expand All @@ -97,5 +97,4 @@ jobs:
- name: Serve UI & run Cypress tests in Chrome and Firefox
run: |
cd pkg/ui/v1beta1/frontend
npm run start & npx wait-on http://localhost:4200
npm run ui-test-ci-all
npm run start & npx wait-on http://localhost:4200 && npm run ui-test-ci-all
22 changes: 17 additions & 5 deletions cmd/ui/v1beta1/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,41 @@ RUN apt-get update && apt-get install git -y

WORKDIR /kf
COPY ./pkg/ui/v1beta1/frontend/COMMIT ./
RUN git clone https://github.com/kubeflow/kubeflow.git && \
RUN git clone https://github.com/tariq-hasan/kubeflow.git && \
COMMIT=$(cat ./COMMIT) && \
cd kubeflow && \
git checkout $COMMIT

# --- Build the frontend kubeflow library ---
FROM node:12 AS frontend-kubeflow-lib
FROM node:16 AS frontend-kubeflow-lib

WORKDIR /src

ARG LIB=/kf/kubeflow/components/crud-web-apps/common/frontend/kubeflow-common-lib
COPY --from=fetch-kubeflow-kubeflow $LIB/package*.json ./
RUN npm ci
RUN npm config set fetch-retry-mintimeout 200000 && \
npm config set fetch-retry-maxtimeout 1200000 && \
npm config get registry && \
npm config set registry https://registry.npmjs.org/ && \
npm config get https-proxy && \
npm config rm https-proxy && \
npm ci

COPY --from=fetch-kubeflow-kubeflow $LIB/ ./
RUN npm run build

# --- Build the frontend ---
FROM node:12 AS frontend
FROM node:16 AS frontend

WORKDIR /src
COPY ./pkg/ui/v1beta1/frontend/package*.json ./
RUN npm ci
RUN npm config set fetch-retry-mintimeout 200000 && \
npm config set fetch-retry-maxtimeout 1200000 && \
npm config get registry && \
npm config set registry https://registry.npmjs.org/ && \
npm config get https-proxy && \
npm config rm https-proxy && \
npm ci

COPY ./pkg/ui/v1beta1/frontend/ .
COPY --from=frontend-kubeflow-lib /src/dist/kubeflow/ ./node_modules/kubeflow/
Expand Down
2 changes: 1 addition & 1 deletion pkg/ui/v1beta1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ To make changes to the UI you need to install:

- Tools, defined [here](https://github.com/kubeflow/katib/blob/master/docs/developer-guide.md#requirements).

- `node` (v12.18.1) and `npm` (v6.13). Recommended to install `node` and `npm` using [`nvm`](https://github.com/nvm-sh/nvm). After installing `nvm`, you can run `nvm install 12.18.1` to install `node` version 12.18.1 and run `nvm use 12.18.1` to use that version.
- `node` (v16.20.2) and `npm` (v8.19.4). Recommended to install `node` and `npm` using [`nvm`](https://github.com/nvm-sh/nvm). After installing `nvm`, you can run `nvm install 16.20.2` to install `node` version 16.20.2 and run `nvm use 16.20.2` to use that version.

## Development

Expand Down
2 changes: 1 addition & 1 deletion pkg/ui/v1beta1/frontend/COMMIT
Original file line number Diff line number Diff line change
@@ -1 +1 @@
046c6d3c8
7e52c174d
4 changes: 4 additions & 0 deletions pkg/ui/v1beta1/frontend/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"allowedCommonJsDependencies": [
"date-fns",
"lodash"
],
"preserveSymlinks": true,
"outputPath": "dist/frontend",
"index": "src/index.html",
Expand Down
8 changes: 4 additions & 4 deletions pkg/ui/v1beta1/frontend/cypress/e2e/index-page.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,19 @@ describe('Index page', () => {
const status = parseStatus(experiments[i]);
if (status.phase === STATUS_TYPE.READY) {
cy.wrap(element)
.find('lib-status>mat-icon')
.find('lib-status-icon>mat-icon')
.should('contain', 'check_circle');
} else if (status.phase === STATUS_TYPE.STOPPED) {
cy.wrap(element)
.find('lib-status>lib-icon')
.find('lib-status-icon>lib-icon')
.should('have.attr', 'icon', 'custom:stoppedResource');
} else if (status.phase === STATUS_TYPE.UNAVAILABLE) {
cy.wrap(element)
.find('lib-status>mat-icon')
.find('lib-status-icon>mat-icon')
.should('contain', 'timelapse');
} else if (status.phase === STATUS_TYPE.WARNING) {
cy.wrap(element)
.find('lib-status>mat-icon')
.find('lib-status-icon>mat-icon')
.should('contain', 'warning');
} else if (
status.phase === STATUS_TYPE.WAITING ||
Expand Down
Loading

0 comments on commit 7f2d7db

Please sign in to comment.