-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add tests, fix view public and trs link (#1433)
Add some tests https://ucsc-cgl.atlassian.net/browse/SEAB-3733 icon: https://ucsc-cgl.atlassian.net/browse/SEAB-3827 fix redirect: https://ucsc-cgl.atlassian.net/browse/SEAB-3825 trs link: https://ucsc-cgl.atlassian.net/browse/SEAB-3828e
- Loading branch information
Showing
8 changed files
with
367 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
import { goToTab, insertAppTools, isActiveTab, resetDB, setTokenUserViewPort, typeInInput } from '../../support/commands'; | ||
import { LambdaEvent } from '../../../src/app/shared/swagger'; | ||
|
||
describe('GitHub App Tools', () => { | ||
resetDB(); | ||
insertAppTools(); | ||
setTokenUserViewPort(); | ||
|
||
function selectUnpublishedTab(org: string) { | ||
cy.get('#tool-path').should('be.visible'); | ||
cy.get('mat-panel-title') | ||
.contains(org) | ||
.parentsUntil('mat-accordion') | ||
.should('be.visible') | ||
.contains('.mat-tab-label-content', 'Unpublished') | ||
.should('be.visible') | ||
.click(); | ||
} | ||
|
||
function selectUnpublishedGitHubAppTab(org: string) { | ||
cy.get('#workflow-path').should('be.visible'); | ||
cy.get('mat-panel-title') | ||
.contains(org) | ||
.parentsUntil('mat-accordion') | ||
.should('be.visible') | ||
.contains('.mat-tab-label-content', 'Unpublished') | ||
.click(); | ||
} | ||
|
||
function selectGitHubAppTool(tool: string) { | ||
cy.get('#workflow-path').should('be.visible'); | ||
cy.contains('div .no-wrap', tool).should('be.visible').click(); | ||
cy.get('#workflow-path').contains(tool); | ||
} | ||
|
||
describe('My Tools', () => { | ||
it('Side Bar', () => { | ||
cy.visit('/my-tools'); | ||
|
||
// Registration | ||
cy.get('#register_tool_button').click(); | ||
cy.contains('Register using GitHub Apps'); | ||
cy.get('#3-register-workflow-option').click(); | ||
cy.contains('Install our GitHub App on your'); | ||
cy.get('.modal-footer').contains('Next').first().click(); | ||
cy.contains('Navigate to GitHub to install our GitHub app'); | ||
cy.contains('Tool storage type').click(); | ||
cy.contains('Close').click(); | ||
|
||
// GitHub App Logs | ||
cy.contains('See GitHub Apps Logs').click(); | ||
cy.contains('There were problems retrieving GitHub App logs for this organization.'); | ||
cy.contains('Close').click(); | ||
cy.server(); | ||
cy.route({ | ||
method: 'GET', | ||
url: '/api/lambdaEvents/**', | ||
response: [], | ||
}).as('lambdaEvents'); | ||
cy.contains('See GitHub Apps Logs').click(); | ||
cy.contains('There are no GitHub App logs for this organization.'); | ||
cy.contains('Close').click(); | ||
|
||
const realResponse: LambdaEvent[] = [ | ||
{ | ||
eventDate: 1582165220000, | ||
githubUsername: 'testUser', | ||
id: 1, | ||
message: 'HTTP 418 ', | ||
organization: 'C', | ||
reference: 'refs/head/main', | ||
repository: 'test-github-app-tools', | ||
success: true, | ||
type: 'PUSH', | ||
}, | ||
]; | ||
cy.route({ | ||
method: 'GET', | ||
url: '/api/lambdaEvents/**', | ||
response: realResponse, | ||
}).as('lambdaEvents'); | ||
cy.contains('See GitHub Apps Logs').click(); | ||
cy.contains('1 – 1 of 1'); | ||
cy.contains('Close').click(); | ||
}); | ||
|
||
it('GitHub Tool Private View', () => { | ||
selectGitHubAppTool('test-github-app-tools/testing'); | ||
cy.get('#publishButton').should('not.be.disabled'); | ||
cy.get('#publishButton').contains('Unpublish'); | ||
cy.get('[data-cy=viewPublicWorkflowButton]').should('not.be.disabled'); | ||
cy.get('[data-cy=refreshButton]').should('not.exist'); | ||
|
||
goToTab('Info'); | ||
isActiveTab('Info'); | ||
|
||
// Add tests once fixed. | ||
goToTab('Launch'); | ||
isActiveTab('Launch'); | ||
|
||
goToTab('Versions'); | ||
isActiveTab('Versions'); | ||
cy.get('table>tbody>tr').should('have.length', 1); | ||
cy.contains('button', 'Actions').should('be.visible').click(); | ||
cy.contains('button', 'Refresh Version').should('be.disabled'); | ||
|
||
// Fix hiding a version. You have to refresh the page to see that it was hidden in the table | ||
cy.contains('Edit').click(); | ||
cy.get('[data-cy=hiddenLabel]').click(); | ||
cy.get('[data-cy=save-version]').click(); | ||
// cy.get('[data-cy=valid').should('exist'); | ||
|
||
goToTab('Files'); | ||
isActiveTab('Files'); | ||
cy.contains('tools/Dockstore.cwl'); | ||
cy.contains('class: CommandLineTool'); | ||
goToTab('Configuration'); | ||
cy.contains('Configuration'); | ||
cy.contains('/.dockstore.yml'); | ||
|
||
selectUnpublishedGitHubAppTab('github.com/C'); | ||
selectGitHubAppTool('test-github-app-tools/md5sum'); | ||
cy.get('#publishButton').should('not.be.disabled'); | ||
cy.get('[data-cy=viewPublicWorkflowButton]').should('not.exist'); | ||
cy.get('#publishButton').contains('Publish').click(); | ||
cy.contains('Default Version Required'); | ||
cy.contains('button', 'OK').click(); | ||
goToTab('Versions'); | ||
cy.contains('button', 'Actions').should('be.visible').click(); | ||
cy.contains('button', 'Set as').click(); | ||
cy.get('#publishButton').should('not.be.disabled'); | ||
cy.get('#publishButton').contains('Publish').click(); | ||
|
||
// Fix that the entry list on the left doesn't update without refreshing the page | ||
// selectGitHubAppTool('test-github-app-tools/testing'); | ||
}); | ||
|
||
it('Public view', () => { | ||
cy.get('[data-cy=viewPublicWorkflowButton]').click(); | ||
cy.get('[data-cy=tool-icon]').should('exist'); | ||
cy.contains('Tool Information'); | ||
cy.contains('Tool Version Information'); | ||
cy.get('[data-cy=workflowTitle]').contains('github.com/C/test-github-app-tools/md5sum:invalidTool'); | ||
goToTab('Versions'); | ||
cy.contains('main').click(); | ||
cy.get('[data-cy=workflowTitle]').contains('github.com/C/test-github-app-tools/md5sum:main'); | ||
cy.get('#starringButton').click(); | ||
cy.get('#starCountButton').should('contain', '1'); | ||
goToTab('Info'); | ||
cy.get('[data-cy=trs-link]').contains('TRS: github.com/C/test-github-app-tools/md5sum'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.