fix: FE CI unstable (#1734)
Co-authored-by: guoqqqi <979918879@qq.com>
diff --git a/web/cypress.json b/web/cypress.json
index db84cd7..88b22c0 100644
--- a/web/cypress.json
+++ b/web/cypress.json
@@ -3,6 +3,5 @@
"viewportHeight": 1080,
"baseUrl": "http://localhost:8000",
"video": true,
- "numTestsKeptInMemory": 0,
"videoUploadOnPasses": false
}
diff --git a/web/cypress/integration/pluginTemplate/create-plugin-template-with-route.spec.js b/web/cypress/integration/pluginTemplate/create-plugin-template-with-route.spec.js
index 6b673ba..8be0f49 100644
--- a/web/cypress/integration/pluginTemplate/create-plugin-template-with-route.spec.js
+++ b/web/cypress/integration/pluginTemplate/create-plugin-template-with-route.spec.js
@@ -40,8 +40,9 @@
cy.visit('/routes/list');
cy.contains('Create').click();
- cy.get(this.domSelector.empty).should('be.visible');
- cy.get(this.domSelector.name).click();
+
+ // NOTE: make sure all components rerender done
+ cy.contains('Next').click().click();
cy.get(this.domSelector.name).type(this.data.routeName);
cy.contains('Next').click();
cy.get(this.domSelector.nodes_0_host).type(this.data.ip1);
diff --git a/web/cypress/integration/route/create-edit-duplicate-delete-route.spec.js b/web/cypress/integration/route/create-edit-duplicate-delete-route.spec.js
index 3333832..6e16a7e 100644
--- a/web/cypress/integration/route/create-edit-duplicate-delete-route.spec.js
+++ b/web/cypress/integration/route/create-edit-duplicate-delete-route.spec.js
@@ -59,7 +59,7 @@
cy.get(this.domSelector.name).type('modalName');
});
cy.get(this.domSelector.operator).click();
- cy.contains('Equal').click();
+ cy.get('[title=Equal]').should('be.visible').click();
cy.get(this.domSelector.value).type('value');
cy.contains('Confirm').click();
@@ -139,7 +139,8 @@
cy.contains('Search').click();
cy.contains(name).siblings().contains('Configure').click();
- cy.wait(500);
+ // NOTE: make sure all components rerender done
+ cy.get('#status').should('have.class', 'ant-switch-checked');
cy.get(this.domSelector.name).clear().type(newName);
cy.get(this.domSelector.description).clear().type(this.data.description2);
cy.contains('Next').click();
@@ -166,13 +167,15 @@
it('should duplicate the route', function () {
cy.visit('/');
cy.contains('Route').click();
+ cy.reload();
cy.get(this.domSelector.nameSelector).type(newName);
cy.contains('Search').click();
cy.contains(newName).siblings().contains('More').click();
cy.contains('Duplicate').click();
- cy.wait(500);
+ // NOTE: make sure all components rerender done
+ cy.get('#status').should('have.class', 'ant-switch-checked');
cy.get(this.domSelector.name).clear().type(duplicateNewName);
cy.get(this.domSelector.description).clear().type(this.data.description2);
cy.contains('Next').click();
diff --git a/web/cypress/integration/route/create-route-with-proxy-rewrite-plugin.spec.js b/web/cypress/integration/route/create-route-with-proxy-rewrite-plugin.spec.js
index b051fce..1d8173d 100644
--- a/web/cypress/integration/route/create-route-with-proxy-rewrite-plugin.spec.js
+++ b/web/cypress/integration/route/create-route-with-proxy-rewrite-plugin.spec.js
@@ -106,7 +106,9 @@
cy.get(this.domSelector.nameSelector).type(this.data.routeName);
cy.contains('Search').click();
cy.contains(this.data.routeName).siblings().contains('Configure').click();
- cy.wait(500);
+
+ // NOTE: make sure all components rerender done
+ cy.get('#status').should('have.class', 'ant-switch-checked');
cy.get(this.domSelector.name).type(this.data.routeName);
cy.contains(routeLocaleUS['page.route.form.itemLabel.newPath']).should('be.visible');
diff --git a/web/cypress/integration/route/search-route.spec.js b/web/cypress/integration/route/search-route.spec.js
index aed1837..381b9fe 100644
--- a/web/cypress/integration/route/search-route.spec.js
+++ b/web/cypress/integration/route/search-route.spec.js
@@ -98,9 +98,8 @@
});
it('should search the route with labels', function () {
- cy.visit('/routes/list');
// search one label
- cy.contains(data.test0).should('exist');
+ cy.reload();
cy.get(this.domSelector.labelSelect_0).click({ timeout });
cy.get(this.domSelector.dropdown).contains(data.value0).should('be.visible').click();
cy.contains('Search').click();
diff --git a/web/cypress/support/commands.js b/web/cypress/support/commands.js
index d443339..2f28b64 100644
--- a/web/cypress/support/commands.js
+++ b/web/cypress/support/commands.js
@@ -72,6 +72,17 @@
});
});
+ cy.get(domSelector.codeMirrorMode).invoke('text').then(text => {
+ if (text === 'Form') {
+ // FIXME: https://github.com/cypress-io/cypress/issues/7306
+ cy.wait(5000);
+ cy.get(domSelector.codeMirrorMode).should('be.visible');
+ cy.get(domSelector.codeMirrorMode).click();
+ cy.get(domSelector.selectDropdown).should('be.visible');
+ cy.get(domSelector.selectJSON).click();
+ }
+ });
+
cy.window().then(({ codemirror }) => {
if (codemirror) {
codemirror.setValue(JSON.stringify(data));