Skip to content

Commit f0813bb

Browse files
feat: bring in staging (#513)
1 parent 235c1cc commit f0813bb

File tree

21 files changed

+205
-111
lines changed

21 files changed

+205
-111
lines changed

.github/workflows/cy.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Cypress Tests
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- synchronize
8+
9+
jobs:
10+
cypress:
11+
runs-on: ubuntu-latest
12+
13+
env:
14+
USERNAME: ${{ secrets.USERNAME }}
15+
PASSWORD: ${{ secrets.PASSWORD }}
16+
17+
steps:
18+
- name: Check out code
19+
uses: actions/checkout@v2
20+
21+
- name: Set up Node.js
22+
uses: actions/setup-node@v2
23+
with:
24+
node-version: '18'
25+
26+
- name: Install dependencies
27+
run: npm install
28+
- name: Get PR number
29+
id: pr_number
30+
run: echo "PR_NUMBER=$(echo $GITHUB_REF | sed -n 's/refs\/pull\/\([0-9]*\)\/merge/\1/p')" >> $GITHUB_ENV
31+
32+
- name: Replace URL and running cypress test
33+
run: |
34+
sed -i 's/baseUrl: .*/baseUrl: "https:\/\/deploy-preview-${{ env.PR_NUMBER }}--zenml-ui-staging.netlify.app",/' cypress.config.ts
35+
36+
- name: Run e2e tests
37+
run: |
38+
export USERNAME=$USERNAME
39+
export PASSWORD=$PASSWORD
40+
npx cypress run
41+
42+
# - name: Run Cypress tests
43+
# run: npx cypress run
44+
# continue-on-error: true
45+
46+
- name: Check Cypress exit code
47+
run: |
48+
echo "Cypress Exit Code: $?"

cypress.config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { defineConfig } from 'cypress';
2-
2+
require('dotenv').config();
33
export default defineConfig({
4+
viewportWidth: 1380,
5+
viewportHeight: 1024,
6+
env: { ...process.env },
47
e2e: {
58
specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}',
69
baseUrl: 'http://localhost:3000',

cypress/e2e/connecterTable/connectorTable.spec.cy.ts renamed to cypress/e2e/connectorTable/connectorTable.spec.cy.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ describe('FilterComponent E2E Tests', () => {
1010
beforeEach(() => {
1111
login();
1212
cy.waitUntilDashboardIsLoaded();
13-
cy.wait(500);
13+
cy.wait(1000);
1414
cy.get('[id="connector"]').click(); // Replace with your custom wait command
1515
});
1616

@@ -67,7 +67,7 @@ describe('FilterComponent E2E Tests', () => {
6767
columnList.forEach((col) => {
6868
filterByString(col, emptyText);
6969
});
70-
filterByBoolean();
70+
filterByBoolean(emptyText);
7171
});
7272
it('should navigate through pagination', () => {
7373
// Assuming you have a button or link for next and previous pagination
@@ -77,20 +77,22 @@ describe('FilterComponent E2E Tests', () => {
7777
});
7878
it("should display connector's component", () => {
7979
// cy.wait(5000);
80+
cy.waitForLoaderToDisappear();
8081
cy.get('table').should('exist');
8182

8283
// Select the first row within the table (modify the selector as needed)
8384
cy.get('table tbody tr:eq(4)').click({ force: true });
8485

8586
cy.get('[data-testid="component_tab"]').click();
8687
// cy.get('table').should('exist');
88+
cy.waitForLoaderToDisappear();
8789

8890
// cy.get('table').should('exist');
8991
const columnList = ['ID', 'Name', 'Flavor'];
9092
const emptyText = 'No components';
9193
columnList.forEach((col) => {
9294
filterByString(col, emptyText);
9395
});
94-
filterByBoolean();
96+
filterByBoolean(emptyText);
9597
});
9698
});

cypress/e2e/pipelineTable/pipelineTable.spec.cy.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { apiCall } from '../utils/apiCallUtils';
1+
// import { apiCall } from '../utils/apiCallUtils';
22
import { dag } from '../utils/dagUtils';
33
import { filterByStatus } from '../utils/filterByStatusUtils';
44
import { filterByString } from '../utils/filterByStringUtils';
@@ -12,7 +12,7 @@ describe('FilterComponent E2E Tests', () => {
1212
beforeEach(() => {
1313
login();
1414
cy.waitUntilDashboardIsLoaded();
15-
apiCall();
15+
cy.wait(1000);
1616
cy.get('[id="pipelines"]').click();
1717

1818
// Replace with your custom wait command
@@ -47,7 +47,8 @@ describe('FilterComponent E2E Tests', () => {
4747
});
4848

4949
it('should work with valid value', () => {
50-
search('pipeline');
50+
const emptyText = 'We are sorry';
51+
search('pipeline', emptyText);
5152
});
5253

5354
it('should apply filters where string', () => {
@@ -59,22 +60,23 @@ describe('FilterComponent E2E Tests', () => {
5960
});
6061

6162
it('should navigate through pagination', () => {
63+
cy.waitForLoaderToDisappear();
6264
// Assuming you have a button or link for next and previous pagination
6365
// You can click these buttons to navigate through pages
6466
pagination(); // Click the "Previous" button
6567
// Add more assertions as needed
6668
});
6769

6870
it('should display pipelineDetails', () => {
69-
// cy.wait(5000);
71+
cy.waitForLoaderToDisappear();
7072
cy.get('table').should('exist');
7173

7274
// Select the first row within the table (modify the selector as needed)
7375
cy.get('table tbody tr:first').should('exist');
7476

7577
// Click on the first row
7678
cy.get('table tbody tr:first').click({ force: true });
77-
cy.wait(5000);
79+
cy.waitForLoaderToDisappear();
7880
cy.get('table').should('exist');
7981

8082
// Select the first row within the table (modify the selector as needed)
@@ -87,12 +89,12 @@ describe('FilterComponent E2E Tests', () => {
8789
it("should display pipeline's runs", () => {
8890
// cy.wait(5000);
8991
cy.waitForLoaderToDisappear();
90-
cy.get('table').should('exist');
92+
cy.checkTableAndH4Visibility('Nothing to see here');
9193

9294
// Select the first row within the table (modify the selector as needed)
93-
cy.get('table tbody tr:first').click({ force: true });
95+
cy.checkTableAndClickRow();
9496

95-
cy.get('table').should('exist');
97+
cy.checkTableAndH4Visibility('No runs');
9698
cy.waitForLoaderToDisappear();
9799
const columnList = ['Run ID', 'Run Name'];
98100
const emptyText = 'No runs';

cypress/e2e/repository/repository.spec.cy.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { apiCall } from '../utils/apiCallUtils';
2-
31
import { filterByStatus } from '../utils/filterByStatusUtils';
42
import { filterByString } from '../utils/filterByStringUtils';
53
import { login } from '../utils/loginUtils';
@@ -9,7 +7,7 @@ describe('FilterComponent E2E Tests', () => {
97
beforeEach(() => {
108
login();
119
cy.waitUntilDashboardIsLoaded();
12-
apiCall();
10+
cy.wait(1000);
1311
cy.get('[id="repositories"]').click();
1412

1513
// Replace with your custom wait command
@@ -62,17 +60,15 @@ describe('FilterComponent E2E Tests', () => {
6260
});
6361

6462
it('should navigate through pagination', () => {
63+
cy.waitForLoaderToDisappear();
6564
// Assuming you have a button or link for next and previous pagination
6665
// You can click these buttons to navigate through pages
6766
pagination(); // Click the "Previous" button
6867
// Add more assertions as needed
6968
});
7069

7170
it("should display respository's runs", () => {
72-
// cy.wait(5000);
7371
cy.waitForLoaderToDisappear();
74-
// cy.get('table').should('exist');
75-
7672
// Select the first row within the table (modify the selector as needed)
7773
cy.get('[data-testid="repository_card"]')
7874
.first() // Select the first element with the data-testid

cypress/e2e/runsTable/runsTable.spec.cy.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ describe('FilterComponent E2E Tests', () => {
1212
beforeEach(() => {
1313
login();
1414
cy.waitUntilDashboardIsLoaded();
15-
cy.wait(700);
15+
cy.wait(1000);
1616
// apiCall();
1717
cy.get('[id="runs"]').click();
1818
});
@@ -50,10 +50,12 @@ describe('FilterComponent E2E Tests', () => {
5050
});
5151

5252
it('should work with valid value', () => {
53-
search('pipeline');
53+
const emptyText = 'We are sorry';
54+
search('pipeline', emptyText);
5455
});
5556

5657
it('should apply filters where string', () => {
58+
cy.waitForLoaderToDisappear();
5759
const columnList = ['Run ID', 'Run Name'];
5860
const emptyText = 'We are sorry';
5961
columnList.forEach((col) => {
@@ -62,6 +64,7 @@ describe('FilterComponent E2E Tests', () => {
6264
filterByStatus();
6365
});
6466
it('should navigate through pagination', () => {
67+
cy.waitForLoaderToDisappear();
6568
// Assuming you have a button or link for next and previous pagination
6669
// You can click these buttons to navigate through pages
6770
pagination(); // Click the "Previous" button
@@ -77,6 +80,7 @@ describe('FilterComponent E2E Tests', () => {
7780

7881
// Click on the first row
7982
cy.get('table tbody tr:first').click({ force: true });
83+
cy.waitForLoaderToDisappear();
8084
dag();
8185
});
8286
});

cypress/e2e/secretTable/secretTable.spec.cy.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,15 @@ describe('FilterComponent E2E Tests', () => {
2828
});
2929

3030
it('should work with valid value', () => {
31-
search('asd2');
31+
const emptyText = 'We are sorry';
32+
search('asd2', emptyText);
3233
});
3334

3435
it('should apply filters where string', () => {
36+
const emptyText = 'We are sorry';
3537
const columnList = ['ID', 'Name', 'Scope'];
3638
columnList.forEach((col) => {
37-
filterByString(col);
39+
filterByString(col, emptyText);
3840
});
3941
});
4042
it('should navigate through pagination', () => {

cypress/e2e/stackComponentTable/stackComponentTable.spec.cy.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,20 @@ describe('FilterComponent E2E Tests', () => {
4545
});
4646

4747
it('should work with valid value', () => {
48-
search('asd2');
48+
const emptyText = 'We are sorry';
49+
search('asd2', emptyText);
4950
});
5051

5152
it('should apply filters where string', () => {
5253
const columnList = ['ID', 'Name', 'Flavor'];
54+
const emptyText = 'We are sorry';
5355
columnList.forEach((col) => {
54-
filterByString(col);
56+
filterByString(col, emptyText);
5557
});
56-
filterByBoolean();
58+
filterByBoolean(emptyText);
5759
});
5860
it('should navigate through pagination', () => {
61+
cy.waitForLoaderToDisappear();
5962
// Assuming you have a button or link for next and previous pagination
6063
// You can click these buttons to navigate through pages
6164
pagination(); // Click the "Previous" button
@@ -64,12 +67,13 @@ describe('FilterComponent E2E Tests', () => {
6467
it("should display component's stack", () => {
6568
// cy.wait(5000);
6669
cy.waitForLoaderToDisappear();
67-
cy.get('table').should('exist');
70+
cy.checkTableAndH4Visibility('Nothing to see here');
6871

6972
// Select the first row within the table (modify the selector as needed)
7073
cy.get('table tbody tr:eq(4)').click({ force: true });
7174

7275
cy.get('[data-testid="stack_tab"]').click();
76+
cy.waitForLoaderToDisappear();
7377
cy.get('table').should('exist');
7478

7579
cy.get('table').should('exist');
@@ -78,6 +82,6 @@ describe('FilterComponent E2E Tests', () => {
7882
columnList.forEach((col) => {
7983
filterByString(col, emptyText);
8084
});
81-
filterByBoolean();
85+
filterByBoolean(emptyText);
8286
});
8387
});

cypress/e2e/stackTable/stackTable.spec.cy.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ describe('FilterComponent E2E Tests', () => {
1212
beforeEach(() => {
1313
login();
1414
cy.waitUntilDashboardIsLoaded();
15-
cy.wait(500);
15+
cy.wait(1000);
1616
cy.get('[id="stack"]').click(); // Replace with your custom wait command
1717
});
1818

@@ -33,17 +33,20 @@ describe('FilterComponent E2E Tests', () => {
3333
});
3434

3535
it('should work with valid value', () => {
36-
search('asd2');
36+
const emptyText = 'We are sorry';
37+
search('asd2', emptyText);
3738
});
3839

3940
it('should apply filters where string', () => {
4041
const columnList = ['ID', 'Name'];
42+
const emptyText = 'We are sorry';
4143
columnList.forEach((col) => {
42-
filterByString(col);
44+
filterByString(col, emptyText);
4345
});
44-
filterByBoolean();
46+
filterByBoolean(emptyText);
4547
});
4648
it('should navigate through pagination', () => {
49+
cy.waitForLoaderToDisappear();
4750
// Assuming you have a button or link for next and previous pagination
4851
// You can click these buttons to navigate through pages
4952
pagination(); // Click the "Previous" button
@@ -52,6 +55,7 @@ describe('FilterComponent E2E Tests', () => {
5255

5356
it('should display stackDetails', () => {
5457
// cy.wait(5000);
58+
cy.waitForLoaderToDisappear();
5559
cy.get('table').should('exist');
5660

5761
// Select the first row within the table (modify the selector as needed)
@@ -61,6 +65,7 @@ describe('FilterComponent E2E Tests', () => {
6165
cy.get('table tbody tr:eq(4)').click({ force: true });
6266

6367
cy.get('[data-testid="run_tab"]').click();
68+
cy.waitForLoaderToDisappear();
6469
cy.get('table').should('exist');
6570
cy.wait(5000);
6671
// Select the first row within the table (modify the selector as needed)
@@ -74,13 +79,14 @@ describe('FilterComponent E2E Tests', () => {
7479
it("should display Stacks's runs", () => {
7580
// cy.wait(5000);
7681
cy.waitForLoaderToDisappear();
77-
cy.get('table').should('exist');
82+
cy.checkTableAndH4Visibility('Nothing to see here');
7883

7984
// Select the first row within the table (modify the selector as needed)
8085
cy.get('table tbody tr:eq(4)').click({ force: true });
81-
8286
cy.get('[data-testid="run_tab"]').click();
83-
cy.get('table').should('exist');
87+
cy.waitForLoaderToDisappear();
88+
cy.checkTableAndH4Visibility('No runs');
89+
8490
cy.waitForLoaderToDisappear();
8591
const columnList = ['Run ID', 'Run Name'];
8692
const emptyText = 'No runs';
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
export const filterByBoolean = () => {
1+
export const filterByBoolean = (emptyText) => {
22
cy.get('[data-testid="filter-icon"]').click();
33
cy.get('[data-testid="column-name-dropdown"]').select('Shared');
44
cy.get('[data-testid="shared-option"]').select('False');
5-
cy.get('table').should('be.visible');
5+
cy.waitForLoaderToDisappear();
6+
cy.checkTableAndH4Visibility(emptyText);
67
};

0 commit comments

Comments
 (0)