-
Notifications
You must be signed in to change notification settings - Fork 46
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
test: added e2e tests for get credentials #1585
Merged
Merged
Changes from all commits
Commits
Show all changes
88 commits
Select commit
Hold shift + click to select a range
552e964
build : Initial commit for get credential phase 2
BaskarMitrah ba795ea
build : --Added the separated components and moved into folder
BaskarMitrah d135190
build : --Updated the get crdential external page
BaskarMitrah bf902ee
feat: wired up get template by id and install template endpoints (#1577)
deepessh 098278a
fix: added request access
BaskarMitrah c5871a7
integrated request access
deepessh 07d5c60
build : Fixed design issues & Removed unwanted code
BaskarMitrah aa23c65
fix: code improvements
deepessh 07751e0
build : fixed the design issues and removed the unwanted code
BaskarMitrah bb416e8
Revert "build : fixed the design issues and removed the unwanted code"
BaskarMitrah de3ae10
build:added some design issue (#1580)
BaskarMitrah b5a6e12
fix: incorrect import
deepessh 943d83b
build: update change organization
BaskarMitrah 33e3d03
fix: build issue
BaskarMitrah 452fc1c
Add back in yarn.lock
timkim cf0b0b9
Increase cypress timeout
timkim 60b42b9
Increase cypress timeout again
timkim e0aaf36
added hardcoded wiring for generating access token
deepessh 0bf2dea
build : showed access token and secret key in the card
BaskarMitrah e00d2ff
Added optional chaining to the response
BaskarMitrah b06bfc8
fix: oauths2s and api key get credential components
deepessh e22e257
--Fixed bugs
BaskarMitrah bb41a59
fix : reduced code & added tooltip for card
BaskarMitrah 8d663a3
fix : removed unwanted code
BaskarMitrah ec2bad6
feat: bug fix, integrate with TR on stage
deepessh 579f960
fix: fixes
deepessh 9c3447f
Bugs/api integration (#1581)
deepessh 80209ca
Merge remote-tracking branch 'origin/main' into get_credential_phase2
deepessh 6d5784c
fix: increase cypress timeout
timkim 6a25dee
fix : Added Scopes & fixed design issues (#1583)
deepessh 6625fbb
feat: integrated the new accounts API, bug fixes
deepessh 96a6a68
fix: code improvements and bug fixes
deepessh 3bcc5b5
Merge remote-tracking branch 'origin/main' into get_credential_phase2
deepessh 6f18f83
removed unnecessary console.log
deepessh 4922ec4
feat: use window.adobeIMS instead of ims from context
deepessh a0341da
Bugs/remaned components (#1584)
deepessh 0dc303a
test: added e2e tests for get credentials
deepessh 3a0c9ca
test: added console logs
deepessh 6ccd72f
test: run get credentials along with smoke tests
deepessh b4603fe
test: try running tests on https
deepessh d4c220b
test: try running tests on https
deepessh 072ddf2
test: added basic login test for get credentials component
deepessh 9fe266c
test: added get_credential_phase2 to pr test branches
deepessh 74120aa
test: try pass env vars to the start command
deepessh ee04dff
test: force trigger tests
deepessh 170e900
test: revert force trigger
deepessh 58f80d8
fix: env vars
deepessh ef6709c
test: create env file in git
deepessh 805426a
test: enable running tests for PRs to get_credential_phase2
deepessh 50556f7
--Added the test for the credential for oAuth & APIKey
BaskarMitrah 2a44ade
Migrated the functionalities from commands to get-credentials.cy
BaskarMitrah fe9759c
--Migrated to commands to functions
BaskarMitrah de643af
removed unnecessary wait and reorganized code
deepessh d83ff72
disable videos, increase command timeout
deepessh dbad584
test improvements
deepessh 0f55ba8
added form submission test
deepessh 0cede9b
comment out get credentials e2e test
deepessh 327163f
do not run e2e tests for get_credential_phase2
deepessh 1c43510
Merge remote-tracking branch 'origin/main' into get_credential_phase2…
deepessh 70c03cb
fix: test
deepessh 9ef90f2
test: enable get creds test, run on self-hosted runner
deepessh 1bc911d
fix: added step to install yarn
deepessh 0285e8d
test: try installing yarn as root
deepessh 627d3a7
fix: run test commands as root
deepessh 231b629
fix: try using npx to run yarn commands
deepessh ec4458c
fix: run install command as root, upgrade to cypress gh action v6
deepessh 0c2be7b
feat: added step to install latest lts version of node
deepessh cb16fd0
try print node version
deepessh 55e985e
try adding cache and cache-dependency-path
deepessh aadec7e
fix: format
deepessh 61e8599
remove caching
deepessh 5a3038e
print node version
deepessh a09706c
print non-sudo node version
deepessh 19a0653
try installing yarn without sudo
deepessh 01a2399
do not use sudo, enable caching of yarn packages
deepessh 4cd549a
revert to use cypress github action v5
deepessh a8247a2
try running in docker
deepessh b23f776
use checkout v4
deepessh 5f1ab0b
debug missing checkout step files
deepessh 6814bcd
add sudo to ls
deepessh 2f5b25e
run id
deepessh 009ea0c
try using user root
deepessh 8403f19
remove sudo
deepessh 4c25c90
remove id
deepessh c903d03
added custom certs for e2e tests
deepessh 53d2061
remove build step, increase wait timeout
deepessh 4561b50
remove unnecessary code
deepessh 0516699
remove extra file
deepessh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
@@ -1,16 +1,21 @@ | ||
const { defineConfig } = require('cypress') | ||
|
||
module.exports = defineConfig({ | ||
viewportHeight: 900, | ||
viewportWidth: 1440, | ||
e2e: { | ||
// We've imported your old cypress plugins here. | ||
// You may want to clean this up later by importing these. | ||
setupNodeEvents(on, config) { | ||
return require('./cypress/plugins/index.js')(on, config) | ||
}, | ||
baseUrl: 'http://localhost:9000', | ||
specPattern: 'cypress/e2e/**/*.cy.{js,jsx,ts,tsx}', | ||
}, | ||
pageLoadTimeout: 500000, | ||
}) | ||
const { defineConfig } = require('cypress') | ||
|
||
module.exports = defineConfig({ | ||
viewportHeight: 900, | ||
viewportWidth: 1440, | ||
e2e: { | ||
// We've imported your old cypress plugins here. | ||
// You may want to clean this up later by importing these. | ||
setupNodeEvents(on, config) { | ||
return require('./cypress/plugins/index.js')(on, config) | ||
}, | ||
baseUrl: 'https://localhost.corp.adobe.com:9000', | ||
specPattern: 'cypress/e2e/**/*.cy.{js,jsx,ts,tsx}', | ||
}, | ||
pageLoadTimeout: 500000, | ||
userEmail: 'cypress1@adobe.com', | ||
userPassword: 'ScotchB33r&1234567', | ||
defaultCommandTimeout: 60000, | ||
video: false, | ||
chromeWebSecurity: false | ||
}) |
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,162 @@ | ||
const API_KEY = 'apikey'; | ||
const OAUTH_S2S = 'oauths2s'; | ||
|
||
function init(route) { | ||
cy.visit(route).assertRoute(route); | ||
cy.expect('button[data-cy="sign-in-btn"]').to.exist; | ||
cy.get('button[data-cy="sign-in-btn"]').should('be.visible'); | ||
cy.get('button[data-cy="sign-in-btn"]').should('be.enabled'); | ||
cy.get('button[data-cy="sign-in-btn"]').click(); | ||
cy.login(); | ||
cy.get('button[data-cy="sign-in-btn"]').should('not.exist'); | ||
cy.assertRoute(route + '#'); | ||
} | ||
|
||
function checkRequestAccessEdgeCase() { | ||
cy.get('button[data-cy="accessDetails-edgeCase-btn"]').should('be.visible').should('be.enabled'); | ||
}; | ||
|
||
function getIframeBody() { | ||
return cy.get('iframe[data-cy="request-access-iframe"]') | ||
.its('0.contentDocument.body').should('not.be.empty') | ||
.then(cy.wrap); | ||
} | ||
|
||
function checkRequestAccess() { | ||
cy.get('body').then(($body) => { | ||
// if the request is not already sent, send the request | ||
if ($body.find('[data-cy="request-access-button"]').length > 0) { | ||
cy.get('[data-cy="request-access-button"]').click(); | ||
getIframeBody().find('button[data-testid="send-request-button"]').should('exist').click(); | ||
getIframeBody().find('button[data-testid="close-button"]').should('exist').click(); | ||
} | ||
}); | ||
cy.get('button[data-cy="request-info"]').should('be.visible').should('be.enabled').click(); | ||
cy.get('body', { timeout: 1000 }).click(); | ||
}; | ||
|
||
function checkReturnFlow(credentialType) { | ||
// verify return flow is visible | ||
cy.get('[data-cy="return-flow"]').should('be.visible'); | ||
|
||
// verify clicking on create new credential button opens the form | ||
returnToForm(); | ||
|
||
// verify clicking on cancel button closes the form | ||
cy.get('[data-cy="cancel-new-credential"]').click(); | ||
cy.get('[data-cy="return-flow"]').should('be.visible'); | ||
|
||
// verify clicking on manage projects console button exists | ||
cy.get('[data-cy="manage-projects-console"]').should('exist'); | ||
|
||
// ensure project picker is visible | ||
cy.get('button[data-cy="projects-picker"]').should('be.visible').should('be.enabled'); | ||
|
||
// verify all the information is visible based on credential type | ||
checkCredential(credentialType); | ||
}; | ||
|
||
function checkAPIKey() { | ||
// verify API key is visible | ||
cy.contains('API Key').should('be.visible'); | ||
|
||
// verify API key copy button is clickable | ||
cy.get('[data-cy="API Key-copyIcon"]').should('be.visible'); | ||
|
||
// verify allowed domains copy button is clickable | ||
cy.get('[data-cy="Allowed domains-copyIcon"]').should('be.visible'); | ||
} | ||
|
||
function checkOAuthS2S() { | ||
cy.get('button[data-cy="generate-token"]').should('be.visible').should('be.enabled'); | ||
// cy.get('button[data-cy="copy-token"]').should('exist'); | ||
cy.get('[data-cy="credentialName-link"]').should('exist'); | ||
cy.get('button[data-cy="ClientId-copyIcon"]').should('exist'); | ||
cy.get('button[data-cy="retrieve-client-secret"]').should('be.visible').should('be.enabled'); | ||
// cy.get('button[data-cy="copy-client-secret"]').should('exist'); | ||
cy.get('button[data-cy="Scopes-copyIcon"]').should('exist'); | ||
cy.contains('openid, AdobeID, read_organizations, firefly_api, ff_apis').should('exist'); | ||
} | ||
|
||
function checkCredential(credentialType) { | ||
switch(credentialType) { | ||
case API_KEY: | ||
checkAPIKey(); | ||
break; | ||
case OAUTH_S2S: | ||
checkOAuthS2S(); | ||
break; | ||
} | ||
|
||
cy.get('[data-cy="next-step-button"]').should('exist'); | ||
if (credentialType !== API_KEY) { | ||
cy.get('[data-cy="Manage-Dev-Console-link"]').should('exist'); | ||
} | ||
}; | ||
|
||
function addCredential(credentialType) { | ||
const credentialName = `CypressTest${credentialType}${Math.floor(Math.random() * 1000)}`; | ||
cy.get('[data-cy="add-credential-name"]').click().should('have.focus'); | ||
cy.get('[data-cy="add-credential-name"]').type(credentialName).should('have.value', credentialName); | ||
if (credentialType === API_KEY) { | ||
cy.get('[data-cy="add-allowed-origins"]').click().should('have.focus'); | ||
cy.get('[data-cy="add-allowed-origins"]').type('localhost:9000').should('have.value', 'localhost:9000'); | ||
cy.get('[data-cy="download-checkBox"]').check().should('be.checked'); | ||
cy.get('[data-cy="select-download-language"]').click(); | ||
cy.get('ul li').contains('JavaScript').click(); | ||
} | ||
cy.get('[data-cy="terms-condition-link"]').should('be.visible'); | ||
cy.get('[data-cy="update-terms-condition"]').check().should('be.checked'); | ||
cy.get('[data-cy="create-credential-btn"]').should('be.visible'); | ||
cy.get('[data-cy="create-credential-btn"]').should('be.enabled'); | ||
cy.get('[data-cy="create-credential-btn"]').click(); | ||
if (credentialType === API_KEY) { | ||
cy.get('button[data-cy="restart-download"]').should('be.visible').should('be.enabled').click(); | ||
} | ||
checkCredential(credentialType); | ||
cy.get('[data-cy="Restart-new-credential"]').click(); | ||
}; | ||
|
||
function waitForLoader() { | ||
cy.get('div[data-cy="loader"]').should('exist'); | ||
cy.get('div[data-cy="loader"]').should('not.exist'); | ||
|
||
} | ||
|
||
function selectOrganization(orgName) { | ||
cy.get('button[data-cy="change-organization-btn"]').should('be.visible').should('be.enabled').click(); | ||
cy.get('button[data-cy="organization-picker"]').should('be.visible').should('be.enabled').click(); | ||
cy.contains(orgName).should('exist').click(); | ||
cy.get('button[data-cy="submit-change-organization"]').should('be.visible').should('be.enabled').click(); | ||
waitForLoader(); | ||
}; | ||
|
||
function returnToForm() { | ||
cy.get('[data-cy="create-new-credential"]').should('be.visible'); | ||
cy.get('[data-cy="create-new-credential"]').click(); | ||
cy.get('[data-cy="credential-form"]').should('be.visible'); | ||
} | ||
|
||
describe('Get Credentials Test', () => { | ||
it('API Key page loads', () => { | ||
init('/getCredential/'); | ||
checkReturnFlow(API_KEY); | ||
selectOrganization('AdobeIOTestingOrg'); | ||
checkReturnFlow(API_KEY); | ||
// return to the form | ||
returnToForm(); | ||
addCredential(API_KEY); | ||
}); | ||
|
||
it('OAuth s2s page loads', () => { | ||
init('/get-credential-oauth/'); | ||
checkRequestAccessEdgeCase(); | ||
selectOrganization('Romans entp org'); | ||
checkRequestAccess(); | ||
selectOrganization('MAC New Feature Testing'); | ||
checkReturnFlow(OAUTH_S2S); | ||
// return to the form | ||
returnToForm(); | ||
addCredential(OAUTH_S2S); | ||
}); | ||
}); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: For future reference, once IOXTD-2520 (more specifically IOXTD-2789) is completed, we'll have self-hosted runners on Ethos Corp-Connected Clusters so that we can replace use of this "temporary" self-hosted runner (see IOXTD-2788).