Skip to content

Commit 9c27b57

Browse files
authored
test: enhanced test stability (#1645)
1 parent ca3d33d commit 9c27b57

File tree

5 files changed

+16
-18
lines changed

5 files changed

+16
-18
lines changed

web/cypress/integration/consumer/create_and_delete_consumer.spec.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ context('Create and Delete Consumer', () => {
2727
it('creates consumer with key-auth', function () {
2828
cy.visit('/');
2929
cy.contains('Consumer').click();
30+
cy.get(this.domSelector.empty).should('be.visible');
3031
cy.contains('Create').click();
31-
3232
// basic information
3333
cy.get(this.domSelector.username).type(this.data.consumerName);
3434
cy.get(this.domSelector.description).type(this.data.description);
@@ -59,8 +59,7 @@ context('Create and Delete Consumer', () => {
5959
});
6060

6161
it('should view the consumer', function () {
62-
cy.visit('/');
63-
cy.contains('Consumer').click();
62+
cy.visit('/consumer/list');
6463

6564
cy.get(this.domSelector.nameSelector).type(this.data.consumerName);
6665
cy.contains('Search').click();
@@ -74,17 +73,14 @@ context('Create and Delete Consumer', () => {
7473
});
7574

7675
it('delete the consumer', function () {
77-
cy.visit('/');
78-
cy.contains('Consumer').click();
79-
cy.contains(this.data.consumerName).siblings().contains('Delete').click();
76+
cy.visit('/consumer/list');
77+
cy.contains(this.data.consumerName).should('be.visible').siblings().contains('Delete').click();
8078
cy.contains('button', 'Confirm').click();
8179
cy.get(this.domSelector.notification).should('contain', this.data.deleteConsumerSuccess);
8280
});
8381

8482
it('creates consumer with wrong json', function () {
85-
// go to consumer create page
86-
cy.visit('/');
87-
cy.contains('Consumer').click();
83+
cy.visit('/consumer/list');
8884
cy.contains('Create').click();
8985
// basic information
9086
cy.get(this.domSelector.username).type(this.data.consumerName);

web/cypress/integration/pluginTemplate/create-edit-delete-plugin-template.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ context('Create Edit and Delete PluginTemplate', () => {
2828
it('should create pluginTemplate', function () {
2929
cy.visit('/');
3030
cy.contains('Route').click();
31-
cy.contains('Plugin Template Config').click();
31+
cy.get(this.domSelector.empty).should('be.visible');
32+
cy.contains('Plugin Template Config').should('be.visible').click();
33+
cy.get(this.domSelector.empty).should('be.visible');
3234
cy.contains('Create').click();
3335

3436
cy.get(this.domSelector.description).type(this.data.pluginTemplateName);
@@ -52,7 +54,6 @@ context('Create Edit and Delete PluginTemplate', () => {
5254

5355
it('should edit the pluginTemplate', function () {
5456
cy.visit('plugin-template/list');
55-
5657
cy.get(this.domSelector.refresh).click();
5758
cy.get(this.domSelector.descriptionSelector).type(this.data.pluginTemplateName);
5859
cy.contains('button', 'Search').click();
@@ -68,7 +69,6 @@ context('Create Edit and Delete PluginTemplate', () => {
6869

6970
it('should delete pluginTemplate', function () {
7071
cy.visit('plugin-template/list');
71-
7272
cy.get(this.domSelector.refresh).click();
7373
cy.get(this.domSelector.descriptionSelector).type(this.data.pluginTemplateName);
7474
cy.contains('button', 'Search').click();

web/cypress/integration/pluginTemplate/create-plugin-template-with-route.spec.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ context('Create PluginTemplate Binding To Route', () => {
2727
it('should create test pluginTemplate', function () {
2828
cy.visit('/');
2929
cy.contains('Route').click();
30-
cy.contains('Plugin Template Config').click();
30+
cy.get(this.domSelector.empty).should('be.visible');
31+
cy.contains('Plugin Template Config').should('be.visible').click();
32+
cy.get(this.domSelector.empty).should('be.visible');
3133
cy.contains('Create').click();
3234
cy.get(this.domSelector.description).type(this.data.pluginTemplateName);
3335
cy.contains('Next').click();

web/cypress/integration/route/create-edit-delete-route.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ context('Create and Delete Route', () => {
3232
it('should create route', function () {
3333
cy.visit('/');
3434
cy.contains('Route').click();
35+
cy.get(this.domSelector.empty).should('be.visible');
3536
cy.contains('Create').click();
3637
cy.get(this.domSelector.name).type(name);
3738
cy.get(this.domSelector.description).type(this.data.description);

web/cypress/integration/service/edit-service-with-upstream.spec.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,9 @@ context('Edit Service with Upstream', () => {
2525
});
2626

2727
it('should create a test upstream', function () {
28-
cy.visit('/');
29-
cy.contains('Upstream').click();
28+
cy.visit('/upstream/list');
29+
cy.get(this.domSelector.empty).should('be.visible');
3030
cy.contains('Create').click();
31-
3231
cy.get(this.domSelector.name).type(this.data.upstreamName);
3332
cy.get(this.domSelector.nodes_0_host).type(this.data.ip1);
3433
cy.contains('Next').click();
@@ -40,6 +39,7 @@ context('Edit Service with Upstream', () => {
4039
it('should create a test service', function () {
4140
cy.visit('/');
4241
cy.contains('Service').click();
42+
cy.get(this.domSelector.empty).should('be.visible');
4343
cy.contains('Create').click();
4444
cy.get(this.domSelector.name).type(this.data.serviceName);
4545
cy.get(this.domSelector.description).type(this.data.description);
@@ -54,8 +54,7 @@ context('Edit Service with Upstream', () => {
5454
});
5555

5656
it('should edit the service', function () {
57-
cy.visit('/');
58-
cy.contains('Service').click();
57+
cy.visit('/service/list');
5958

6059
cy.get(this.domSelector.nameSearch).type(this.data.serviceName);
6160
cy.contains('Search').click();

0 commit comments

Comments
 (0)