Skip to content

Commit

Permalink
test(route): correct the test sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
Silence-dream committed Oct 4, 2022
1 parent 10f4af0 commit 2a40b32
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions web/cypress/e2e/route/batch-delete-route.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,36 +63,38 @@ context('Create and Batch Deletion Routes', () => {
for (let i = 0; i < 3; i += 1) {
cy.wait(timeout);
cy.get('.ant-pro-table-list-toolbar-right').contains('Create').click();
cy.get('.ant-row').contains('Next').click().click();
cy.get(selector.name).type(`test${i}`);
cy.get(selector.description).type(`desc${i}`);
cy.get(selector.hosts_0).type(data.host1);
cy.get(selector.uris_0).clear().type(`/get${i}`);

// config label
cy.contains('Manage').click();

// eslint-disable-next-line @typescript-eslint/no-loop-func
cy.get(selector.drawerBody).within(($drawer) => {
cy.wrap($drawer)
.contains('button', 'Add')
.should('not.be.disabled')
.click()
.click({ force: true })
.then(() => {
cy.get(selector.labels_0_labelKey).type(`label${i}`);
cy.get(selector.labels_0_labelValue).type(`value${i}`);
cy.contains('Confirm').click();
cy.contains('Confirm').click({ force: true });
});
});

cy.contains('button', 'Next').should('not.be.disabled').click();
cy.get('.ant-row').contains('Next').click({ force: true });

cy.get(selector.nodes_0_host).type(data.host2, {
timeout,
});
cy.get(selector.nodes_0_port).type(data.port);
cy.get(selector.nodes_0_weight).type(data.weight);

cy.get('.ant-row').contains('Next').click();
cy.get('.ant-row').contains('Next').click();
cy.get('.ant-row').contains('Submit').click();
// cy.contains('button', 'Next').should('not.be.disabled').click();

cy.contains(data.submitSuccess);
cy.contains('Goto List').click();
cy.url().should('contains', 'routes/list');
Expand All @@ -115,33 +117,33 @@ context('Create and Batch Deletion Routes', () => {
it('should batch delete the name of the route', function () {
cy.contains('Route').click();
const cases = [
[1, 0, 2], //full match
[1, 0, 2], // full match
[0, 1, 2], // partial match
[0, 1, 2], //none match
[0, 1, 2], // none match
];
const prefix = 'test';
cy.wrap([0, 2, 'x']).each(($n, i) => {
cy.get(selector.nameSearchInput).clear().type(`${prefix}${$n}`);
cy.contains('Search').click();
cy.wrap(cases[i]).each(($n) => {
cy.contains(`${prefix}${$n}`).should('not.exist');
cy.wrap(cases[i]).each(($m) => {
cy.contains(`${prefix}${$m}`).should('not.exist');
});
});
});

it('should batch delete the path of the route', function () {
cy.contains('Route').click();
const cases = [
[1, 0, 2], //full match
[1, 0, 2], // full match
[0, 1, 2], // partial match
[0, 1, 2], //none match
[0, 1, 2], // none match
];
const prefix = '/get';
cy.wrap([0, 2, 'x']).each(($n, i) => {
cy.get(selector.nameSearchInput).clear().type(`${prefix}${$n}`);
cy.contains('Search').click();
cy.wrap(cases[i]).each(($n) => {
cy.contains(`${prefix}${$n}`).should('not.exist');
cy.wrap(cases[i]).each(($m) => {
cy.contains(`${prefix}${$m}`).should('not.exist');
});
});
});
Expand Down

0 comments on commit 2a40b32

Please sign in to comment.