Skip to content

Commit 79c67d0

Browse files
authored
feat: Generate basic code snippets (#2387)
* 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>
1 parent 7202827 commit 79c67d0

File tree

10 files changed

+36715
-585
lines changed

10 files changed

+36715
-585
lines changed

api-catalog-ui/frontend/cypress/integration/e2e/detail-page/detail-page.test.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
/* eslint-disable no-undef */
1+
/*
2+
* This program and the accompanying materials are made available under the terms of the
3+
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
4+
* https://www.eclipse.org/legal/epl-v20.html
5+
*
6+
* SPDX-License-Identifier: EPL-2.0
7+
*
8+
* Copyright Contributors to the Zowe Project.
9+
*/
210
/* eslint-disable spaced-comment */
311
/// <reference types="Cypress" />
412

api-catalog-ui/frontend/cypress/integration/e2e/detail-page/service-version-compare.test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* This program and the accompanying materials are made available under the terms of the
3+
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
4+
* https://www.eclipse.org/legal/epl-v20.html
5+
*
6+
* SPDX-License-Identifier: EPL-2.0
7+
*
8+
* Copyright Contributors to the Zowe Project.
9+
*/
110
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';
211
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';
312
const PATH_TO_VERSION_SELECTOR_ITEMS = '#menu- > div.MuiPaper-root.MuiMenu-paper.MuiPopover-paper.MuiPaper-elevation8.MuiPaper-rounded > ul> li';

api-catalog-ui/frontend/cypress/integration/e2e/detail-page/swagger-try-out.test.js renamed to api-catalog-ui/frontend/cypress/integration/e2e/detail-page/swagger-try-out-and-code-snippets.test.js

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1-
describe('>>> Swagger Test', () => {
1+
/*
2+
* This program and the accompanying materials are made available under the terms of the
3+
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
4+
* https://www.eclipse.org/legal/epl-v20.html
5+
*
6+
* SPDX-License-Identifier: EPL-2.0
7+
*
8+
* Copyright Contributors to the Zowe Project.
9+
*/
10+
describe('>>> Swagger Try Out and Code Snippets Test', () => {
211
beforeEach(() => {
312
cy.visit(`${Cypress.env('catalogHomePage')}/#/login`);
413

@@ -54,4 +63,22 @@ describe('>>> Swagger Test', () => {
5463
.find('.response-col_status')
5564
.should('contain', '401');
5665
});
66+
67+
it('Should execute request and display basic code snippets', () => {
68+
cy.get('.opblock-summary').eq(0).click();
69+
cy.get('.try-out').should('exist');
70+
cy.get('.try-out').click();
71+
72+
cy.get('button.execute').click();
73+
// check the first tab of the code snippet panel. The order should be always the same
74+
cy.get(
75+
'#operations-API_Catalog-getAllAPIContainersUsingGET > div.no-margin > div > div.responses-wrapper > div.responses-inner > div > div > div:nth-child(1) > div:nth-child(1)'
76+
).should('exist');
77+
cy.get('div.curl-command > div:nth-child(1) > div:nth-child(1) > h4').should('contain', 'cURL (CMD)');
78+
cy.get(
79+
'#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'
80+
).should('exist');
81+
cy.get('div.curl-command > div:nth-child(1) > div:nth-child(2)').click();
82+
cy.get('div.curl-command > div:nth-child(3) > pre').should('exist');
83+
});
5784
});

0 commit comments

Comments
 (0)