Skip to content

Commit

Permalink
feat: Generate basic code snippets (#2387)
Browse files Browse the repository at this point in the history
* WIP - add code snippet to swagger

Signed-off-by: at670475 <andrea.tabone@broadcom.com>

* Fix

Signed-off-by: at670475 <andrea.tabone@broadcom.com>

* Add template

Signed-off-by: at670475 <andrea.tabone@broadcom.com>

* customize snippets

Signed-off-by: at670475 <andrea.tabone@broadcom.com>

* small fix

Signed-off-by: at670475 <andrea.tabone@broadcom.com>

* Clean up

Signed-off-by: at670475 <andrea.tabone@broadcom.com>

* Revert ignored tests

Signed-off-by: at670475 <andrea.tabone@broadcom.com>

* Fix eslint warn

Signed-off-by: at670475 <andrea.tabone@broadcom.com>

* refactoring

Signed-off-by: at670475 <andrea.tabone@broadcom.com>

* Refactoring

Signed-off-by: at670475 <andrea.tabone@broadcom.com>

* Update swagger-react version and enable filters prop

Signed-off-by: at670475 <andrea.tabone@broadcom.com>

* Fix css and add jsdoc

Signed-off-by: at670475 <andrea.tabone@broadcom.com>

* revert changes

Signed-off-by: at670475 <andrea.tabone@broadcom.com>

* Add e2e tests

Signed-off-by: at670475 <andrea.tabone@broadcom.com>

* Fix npm vulnerabilities

Signed-off-by: at670475 <andrea.tabone@broadcom.com>

* revert package-lock

Signed-off-by: at670475 <andrea.tabone@broadcom.com>

* fix sonar codesmell

Signed-off-by: at670475 <andrea.tabone@broadcom.com>

* remove todo

Signed-off-by: at670475 <andrea.tabone@broadcom.com>

* suppress eslint complain

Signed-off-by: at670475 <andrea.tabone@broadcom.com>

* fix sonar

Signed-off-by: at670475 <andrea.tabone@broadcom.com>

* Fix sonar pt.2

Signed-off-by: at670475 <andrea.tabone@broadcom.com>

* Add unit tests

Signed-off-by: at670475 <andrea.tabone@broadcom.com>

* Add more tests

Signed-off-by: at670475 <andrea.tabone@broadcom.com>

* Add unit tests...

Signed-off-by: at670475 <andrea.tabone@broadcom.com>

* fix eslint

Signed-off-by: at670475 <andrea.tabone@broadcom.com>

* Refactoring and test

Signed-off-by: at670475 <andrea.tabone@broadcom.com>

* fix

Signed-off-by: at670475 <andrea.tabone@broadcom.com>

* Include utils folder for coverage

Signed-off-by: at670475 <andrea.tabone@broadcom.com>

* Fix tests

Signed-off-by: at670475 <andrea.tabone@broadcom.com>
  • Loading branch information
taban03 committed May 30, 2022
1 parent 7202827 commit 79c67d0
Show file tree
Hide file tree
Showing 10 changed files with 36,715 additions and 585 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
/* eslint-disable no-undef */
/*
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Copyright Contributors to the Zowe Project.
*/
/* eslint-disable spaced-comment */
/// <reference types="Cypress" />

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Copyright Contributors to the Zowe Project.
*/
const PATH_TO_VERSION_SELECTORS = '.detail-page > div.content-description-container > div > div.serviceTab > div.api-diff-container > div.api-diff-form > div:nth-child(2) > div > div';
const PATH_TO_VERSION_SELECTORS2 = '.detail-page > div.content-description-container > div > div.serviceTab > div.api-diff-container > div.api-diff-form > div:nth-child(4) > div > div';
const PATH_TO_VERSION_SELECTOR_ITEMS = '#menu- > div.MuiPaper-root.MuiMenu-paper.MuiPopover-paper.MuiPaper-elevation8.MuiPaper-rounded > ul> li';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
describe('>>> Swagger Test', () => {
/*
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Copyright Contributors to the Zowe Project.
*/
describe('>>> Swagger Try Out and Code Snippets Test', () => {
beforeEach(() => {
cy.visit(`${Cypress.env('catalogHomePage')}/#/login`);

Expand Down Expand Up @@ -54,4 +63,22 @@ describe('>>> Swagger Test', () => {
.find('.response-col_status')
.should('contain', '401');
});

it('Should execute request and display basic code snippets', () => {
cy.get('.opblock-summary').eq(0).click();
cy.get('.try-out').should('exist');
cy.get('.try-out').click();

cy.get('button.execute').click();
// check the first tab of the code snippet panel. The order should be always the same
cy.get(
'#operations-API_Catalog-getAllAPIContainersUsingGET > div.no-margin > div > div.responses-wrapper > div.responses-inner > div > div > div:nth-child(1) > div:nth-child(1)'
).should('exist');
cy.get('div.curl-command > div:nth-child(1) > div:nth-child(1) > h4').should('contain', 'cURL (CMD)');
cy.get(
'#operations-API_Catalog-getAllAPIContainersUsingGET > div.no-margin > div > div.responses-wrapper > div.responses-inner > div > div > div:nth-child(1) > div.curl-command > div:nth-child(3) > pre'
).should('exist');
cy.get('div.curl-command > div:nth-child(1) > div:nth-child(2)').click();
cy.get('div.curl-command > div:nth-child(3) > pre').should('exist');
});
});
Loading

0 comments on commit 79c67d0

Please sign in to comment.