Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: delete wait in test #1370

Merged
merged 5 commits into from
Jan 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions web/cypress/integration/route/search-route.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ context('Create and Search Route', () => {
nodes_0_host: '#nodes_0_host',
searchName: '[title=Name]',
searchLabels: '[title=Labels]',
refresh: '.anticon-reload',
};

beforeEach(() => {
Expand All @@ -50,7 +51,6 @@ context('Create and Search Route', () => {
});

it('should create route test1, test2, test3', function () {
// go to route create page
cy.visit('/');
cy.contains('Route').click();
for (let i = 0; i < 3; i += 1) {
Expand Down Expand Up @@ -78,7 +78,6 @@ context('Create and Search Route', () => {
cy.contains('Next').click();
cy.contains('Submit').click();
cy.contains('Submit Successfully');
// back to route list page
cy.contains('Goto List').click();
cy.url().should('contains', 'routes/list');
}
Expand Down Expand Up @@ -114,7 +113,7 @@ context('Create and Search Route', () => {
cy.contains('Route').click();

// search one label
cy.wait(500);
cy.get(domSelector.refresh).click();
cy.get(domSelector.searchLabels).click();
cy.get(this.domSelector.dropdown).within(() => {
cy.contains(data.value0).click();
Expand All @@ -130,7 +129,7 @@ context('Create and Search Route', () => {
cy.visit('/routes/list');
for (let i = 0; i < 3; i += 1) {
cy.contains(`test${i}`).siblings().contains('Delete').click();
cy.contains('button', 'Confirm').click();
cy.contains('button', 'Confirm').click({ timeout });
cy.get(this.domSelector.notification).should('contain', data.deleteRouteSuccess);
}
});
Expand Down
6 changes: 0 additions & 6 deletions web/cypress/integration/ssl/ssl-smoketest.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ context('ssl smoke test', () => {
};

beforeEach(() => {
// init login
cy.login();
cy.fixture('certificate.json').as('certificate');
});
Expand All @@ -33,7 +32,6 @@ context('ssl smoke test', () => {
// go to ssl create page
cy.visit('/');
cy.contains('SSL').click();
cy.wait(500);
cy.contains('Create').click();

const validCert = this.certificate.valid.cert;
Expand All @@ -43,14 +41,12 @@ context('ssl smoke test', () => {

cy.contains('Next').click();
cy.contains('Submit').click();
cy.wait(500);
cy.url().should('contains', 'ssl/list');
});

it('should delete the ssl record just created', function () {
cy.visit('/');
cy.contains('SSL').click();
cy.wait(500);
const sni = this.certificate.valid.sni;
cy.contains(sni).parents().contains('Delete').click();
cy.contains('button', 'Confirm').click();
Expand All @@ -61,7 +57,6 @@ context('ssl smoke test', () => {
// go to ssl create page
cy.visit('/');
cy.contains('SSL').click();
cy.wait(500);
cy.contains('Create').click();

const invalidCert = this.certificate.invalid.cert;
Expand All @@ -70,7 +65,6 @@ context('ssl smoke test', () => {
cy.get('#key').type(invalidKey);

cy.contains('Next').click();
cy.wait(100);
cy.get(domSelectors.notificationDesc).should('contain', "key and cert don't match");
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -18,72 +18,58 @@

context('Create and Delete Upstream', () => {
const name = `upstreamName${new Date().valueOf()}`;
const sleepTime = 100; // the unit is milliseconds
const domSelectors = {
notification: '.ant-notification-notice-message',
selectItem: '.ant-select-item-option-content',
};

beforeEach(() => {
// init login
cy.login();
});

it('should create upstream with default type (roundrobin)', () => {
// go to upstream create page
cy.visit('/');
cy.contains('Upstream').click();
cy.wait(sleepTime * 5);
cy.contains('Create').click();

// input name and description
cy.get('#name').type(name);
cy.get('#desc').type('desc_by_autotest');

// input information
cy.get('#nodes_0_host').type('127.0.0.1');
cy.get('#nodes_0_port').clear().type('7000');
cy.contains('Next').click();
cy.contains('Submit').click();
cy.get(domSelectors.notification).should('contain', 'Create Upstream Successfully');
cy.contains('Create Upstream Successfully');
cy.wait(sleepTime * 5);
cy.url().should('contains', 'upstream/list');
});

it('should delete the upstream', () => {
cy.visit('/');
cy.contains('Upstream').click();
cy.wait(sleepTime * 5);
cy.contains(name).siblings().contains('Delete').click();
cy.contains('button', 'Confirm').click();
cy.get(domSelectors.notification).should('contain', 'Delete Upstream Successfully');
});

it('should create chash upstream', () => {
// go to upstream create page
cy.visit('/');
cy.contains('Upstream').click();
cy.wait(sleepTime * 5);
cy.contains('Create').click();

// input name and description
cy.get('#name').type(name);
cy.get('#desc').type('desc_by_autotest');

// change upstream type to chash, todo: optimize the search method
cy.get('[title=roundrobin]').click();
cy.wait(sleepTime);
cy.get(domSelectors.selectItem).within(() => {
cy.contains('chash').click();
});
cy.get('#hash_on').click();
cy.wait(sleepTime);
cy.get(domSelectors.selectItem).within(() => {
cy.contains('vars').click();
});
cy.get('#key').click();
cy.wait(sleepTime);
cy.get(domSelectors.selectItem).within(() => {
cy.contains('remote_addr').click();
});
Expand All @@ -102,14 +88,12 @@ context('Create and Delete Upstream', () => {
cy.contains('Next').click();
cy.contains('Submit').click();
cy.get(domSelectors.notification).should('contain', 'Create Upstream Successfully');
cy.wait(sleepTime * 5);
cy.url().should('contains', 'upstream/list');
});

it('should delete the upstream', () => {
cy.visit('/');
cy.contains('Upstream').click();
cy.wait(sleepTime * 5);
cy.contains(name).siblings().contains('Delete').click();
cy.contains('button', 'Confirm').click();
cy.get(domSelectors.notification).should('contain', 'Delete Upstream Successfully');
Expand Down