-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(secrets): cypress tests for secrets (#161)
* wrapped secret in RemoteData, added resourceError helper class, added remotedata failure logic to secrets page * lint * adding test labels to Table.View * more generic cypress tests for rendering secrets * cypress tests. linting. * oof, forgot to update hooks * remove redundant case * updating grammar in add repos test
- Loading branch information
Showing
14 changed files
with
292 additions
and
64 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,62 @@ | ||
[ | ||
{ | ||
"id": 513, | ||
"org": "github", | ||
"repo": "*", | ||
"team": "", | ||
"name": "docker_username", | ||
"value": "[secure]", | ||
"type": "org", | ||
"images": [], | ||
"events": ["push"], | ||
"allow_command": true | ||
}, | ||
{ | ||
"id": 511, | ||
"org": "github", | ||
"repo": "*", | ||
"team": "", | ||
"name": "docker_password", | ||
"value": "[secure]", | ||
"type": "org", | ||
"images": [], | ||
"events": ["push"], | ||
"allow_command": true | ||
}, | ||
{ | ||
"id": 509, | ||
"org": "github", | ||
"repo": "*", | ||
"team": "", | ||
"name": "push", | ||
"value": "[secure]", | ||
"type": "org", | ||
"images": [], | ||
"events": ["push"], | ||
"allow_command": true | ||
}, | ||
{ | ||
"id": 511, | ||
"org": "github", | ||
"repo": "*", | ||
"team": "", | ||
"name": "pull_request", | ||
"value": "[secure]", | ||
"type": "org", | ||
"images": [], | ||
"events": ["push", "pull_request"], | ||
"allow_command": true | ||
}, | ||
{ | ||
"id": 509, | ||
"org": "github", | ||
"repo": "*", | ||
"team": "", | ||
"name": "deployment", | ||
"value": "[secure]", | ||
"type": "org", | ||
"images": [], | ||
"events": ["push", "pull_request", "comment", "deployment"], | ||
"allow_command": true | ||
} | ||
] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/* | ||
* Copyright (c) 2020 Target Brands, Inc. All rights reserved. | ||
* Use of this source code is governed by the LICENSE file in this repository. | ||
*/ | ||
|
||
context('Secrets', () => { | ||
context('server returning secrets error', () => { | ||
beforeEach(() => { | ||
cy.server(); | ||
cy.route({ | ||
method: 'GET', | ||
url: '*api/v1/secrets/native/org/github/**', | ||
status: 500, | ||
response: 'server error', | ||
}); | ||
cy.login('/-/secrets/native/org/github'); | ||
}); | ||
|
||
it('secrets table should not show', () => { | ||
cy.get('[data-test=secrets]').should('not.be.visible'); | ||
}); | ||
it('error should show', () => { | ||
cy.get('[data-test=alerts]') | ||
.should('exist') | ||
.contains('Error'); | ||
}); | ||
it('error banner should show', () => { | ||
cy.get('[data-test=secrets-error]') | ||
.should('exist') | ||
.contains('try again later'); | ||
}); | ||
}); | ||
context('server returning 5 secrets', () => { | ||
beforeEach(() => { | ||
cy.server(); | ||
cy.route( | ||
'GET', | ||
'*api/v1/secrets/native/org/github/**', | ||
'fixture:secrets_org_5.json', | ||
).as('secrets'); | ||
cy.login('/-/secrets/native/org/github'); | ||
}); | ||
|
||
it('secrets table should show', () => { | ||
cy.get('[data-test=secrets-table]').should('be.visible'); | ||
}); | ||
|
||
it('secrets table should show 5 secrets', () => { | ||
cy.get('[data-test=secrets-row]').should('have.length', 5); | ||
}); | ||
|
||
it('pagination controls should not show', () => { | ||
cy.get('[data-test=pager-previous]').should('not.be.visible'); | ||
}); | ||
|
||
context('secret', () => { | ||
beforeEach(() => { | ||
cy.get('[data-test=secrets-row]') | ||
.first() | ||
.as('firstSecret'); | ||
cy.get('[data-test=secrets-row]') | ||
.last() | ||
.as('lastSecret'); | ||
}); | ||
it('should show name', () => { | ||
cy.get('@firstSecret').within(() => { | ||
cy.get('[data-test=secrets-row-name]').contains('docker_username'); | ||
}); | ||
cy.get('@lastSecret').within(() => { | ||
cy.get('[data-test=secrets-row-name]').contains('deployment'); | ||
}); | ||
}); | ||
it('clicking name should route to edit secret page', () => { | ||
cy.get('@firstSecret').within(() => { | ||
cy.get('[data-test=secrets-row-name]').click({ force: true }); | ||
cy.location('pathname').should( | ||
'eq', | ||
'/-/secrets/native/org/github/docker_username', | ||
); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
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
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.