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

feat: Generate basic code snippets #2387

Merged
merged 32 commits into from
May 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
09b3644
WIP - add code snippet to swagger
taban03 May 13, 2022
7b120f5
Fix
taban03 May 16, 2022
2c0b7ed
Add template
taban03 May 18, 2022
9ae814b
customize snippets
taban03 May 19, 2022
3569aae
small fix
taban03 May 19, 2022
25b7bb7
Clean up
taban03 May 24, 2022
3a6bc50
Revert ignored tests
taban03 May 24, 2022
fb93d4b
Fix eslint warn
taban03 May 24, 2022
5fccc10
refactoring
taban03 May 24, 2022
e6fdfea
Refactoring
taban03 May 24, 2022
7a6b620
Update swagger-react version and enable filters prop
taban03 May 24, 2022
1609adb
Fix css and add jsdoc
taban03 May 25, 2022
78d82fe
Merge branch 'v2.x.x' into apiml/GH2273/snippet_gen
taban03 May 25, 2022
f6e6156
revert changes
taban03 May 25, 2022
a52a20a
Add e2e tests
taban03 May 25, 2022
242c236
Fix npm vulnerabilities
taban03 May 25, 2022
a1fbf6a
revert package-lock
taban03 May 25, 2022
8c1c0b2
fix sonar codesmell
taban03 May 25, 2022
b51df05
remove todo
taban03 May 26, 2022
d77e5e0
suppress eslint complain
taban03 May 26, 2022
dc1bfe1
fix sonar
taban03 May 26, 2022
43ee1a0
Fix sonar pt.2
taban03 May 26, 2022
9a827da
Add unit tests
taban03 May 26, 2022
21743a4
Add more tests
taban03 May 26, 2022
1b83a5d
Add unit tests...
taban03 May 26, 2022
f9cf4e0
fix eslint
taban03 May 26, 2022
52dabd4
Merge branch 'v2.x.x' into apiml/GH2273/snippet_gen
taban03 May 27, 2022
409293f
Refactoring and test
taban03 May 27, 2022
f781283
fix
taban03 May 27, 2022
a6a2f41
Include utils folder for coverage
taban03 May 27, 2022
1410fce
Merge branch 'v2.x.x' into apiml/GH2273/snippet_gen
taban03 May 27, 2022
7eb35d8
Fix tests
taban03 May 30, 2022
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
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