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

fix: online debug test case #1761

Merged
merged 2 commits into from
Apr 13, 2021
Merged
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
44 changes: 23 additions & 21 deletions web/cypress/integration/route/online-debug.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ context('Online debug', () => {
// click send without type debugUrl
cy.contains(routeLocaleUS['page.route.button.send']).click({ force: true });
cy.contains(routeLocaleUS['page.route.input.placeholder.requestUrl']).should('exist');
cy.get(this.domSelector.notificationCloseIcon).click();
cy.get(this.domSelector.notificationCloseIcon).click({ multiple: true });

// input invalid uris
data.invalidUrls.forEach((uri) => {
Expand All @@ -120,16 +120,18 @@ context('Online debug', () => {

// should not show the notification about input the valid request url
cy.contains(routeLocaleUS['page.route.input.placeholder.requestUrl']).should('exist');
cy.get(this.domSelector.notificationCloseIcon).click();
cy.get(this.domSelector.notificationCloseIcon).click({ multiple: true });
});
});

it('should autocomplete header',function () {
it('should autocomplete header', function () {
cy.visit('/');
cy.contains(menuLocaleUS['menu.routes']).click();
const currentToken = localStorage.getItem('token');

// show online debug draw
cy.get(this.domSelector.refresh).click();
cy.contains('Advanced').click();
cy.contains(routeLocaleUS['page.route.onlineDebug']).click();
cy.get(domSelector.debugDraw).should('be.visible');
cy.get(domSelector.headerTab).should('be.visible').click();
Expand Down Expand Up @@ -199,7 +201,7 @@ context('Online debug', () => {
cy.get(this.domSelector.drawerClose).click();
});

it('should debug GET request with query parammeters and jwt auth successfully', function() {
it('should debug GET request with query parammeters and jwt auth successfully', function () {
cy.visit('/');
cy.contains(menuLocaleUS['menu.routes']).click();
const currentToken = localStorage.getItem('token');
Expand Down Expand Up @@ -238,7 +240,7 @@ context('Online debug', () => {
});
});

it('should debug POST request with raw json successfully', function() {
it('should debug POST request with raw json successfully', function () {
cy.visit('/');
cy.contains(menuLocaleUS['menu.routes']).click();
const currentToken = localStorage.getItem('token');
Expand Down Expand Up @@ -275,35 +277,35 @@ context('Online debug', () => {
});
cy.wait('@DebugAPI');
cy.get(domSelector.codeMirrorResp).contains('code').should('be.visible');
cy.get(domSelector.codeMirrorResp).within(() => {
cy.get('.cm-property').should(($property) => {
$property.map((i, el) => {
if (Cypress.$(el).text() === '"name"') {
const findRouteName = Cypress.$(el).next().text();
expect(findRouteName).to.equal(`"${this.routeData.debugPostJson.name}"`);
}
if (Cypress.$(el).text() === '"data"') {
const data = Cypress.$(el).next().text();
expect(data).to.not.equal('null');
}
})
cy.get(domSelector.codeMirrorResp).within(() => {
cy.get('.cm-property').should(($property) => {
$property.map((i, el) => {
if (Cypress.$(el).text() === '"name"') {
const findRouteName = Cypress.$(el).next().text();
expect(findRouteName).to.equal(`"${this.routeData.debugPostJson.name}"`);
}
if (Cypress.$(el).text() === '"data"') {
const data = Cypress.$(el).next().text();
expect(data).to.not.equal('null');
}
})
});
})
});
});

it('should delete routes create for test cases successfully', function() {
it('should delete routes create for test cases successfully', function () {
cy.visit('/');
cy.contains(menuLocaleUS['menu.routes']).click();

const testRouteNames = [data.routeName, this.routeData.debugPostJson.name];
for( let routeName in testRouteNames) {
for (let routeName in testRouteNames) {
cy.contains(`${testRouteNames[routeName]}`).siblings().contains('More').click();
cy.contains('Delete').click({ force: true });
cy.get(this.domSelector.deleteAlert).should('be.visible').within(() => {
cy.contains('OK').click();
});
cy.get(this.domSelector.notification).should('contain', this.data.deleteRouteSuccess);
cy.get(this.domSelector.notificationCloseIcon).click();
cy.get(this.domSelector.notificationCloseIcon).click({ multiple: true });
cy.reload();
}
});
Expand Down