-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
test: Cypress e2e setup #2552
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
Open
mehulmathur16
wants to merge
10
commits into
parse-community:alpha
Choose a base branch
from
mehulmathur16:feat/e2e-tests
base: alpha
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
test: Cypress e2e setup #2552
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
c0ff53d
test(e2e): cypress init
mehulmathur16 d3c2faf
chore: added sample e2e tests
mehulmathur16 6304643
fix: lint
mehulmathur16 7f4065d
ci: added cypress e2e job
mehulmathur16 3abf31e
optimize workflow
mtrezza 11df53e
Update .gitignore
mtrezza 6d1e44a
readme refactor
mtrezza 0eefe39
Update CONTRIBUTING.md
mtrezza 3e70f51
refactor: removed cypress support files
mehulmathur16 583f8e3
chore: added no supportFile to cy. config
mehulmathur16 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -17,3 +17,7 @@ test_logs | |
|
||
# visual studio code | ||
.vscode | ||
|
||
# cypress | ||
cypress/screenshots | ||
cypress/videos |
This file contains hidden or 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 hidden or 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,9 @@ | ||
const { defineConfig } = require('cypress') | ||
|
||
module.exports = defineConfig({ | ||
e2e: { | ||
baseUrl: 'http://localhost:4040', | ||
video: true, | ||
supportFile: false, | ||
}, | ||
}) |
This file contains hidden or 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,8 @@ | ||
{ | ||
"plugins": [ | ||
"cypress" | ||
], | ||
"env": { | ||
"cypress/globals": true | ||
} | ||
} |
This file contains hidden or 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,145 @@ | ||
import { getDashboardConfig } from '../utils/getDashboardConfig'; | ||
|
||
describe('Apps index', () => { | ||
it('Redirects to app lists from root path if there are 2 or more apps', () => { | ||
cy.intercept( | ||
{ | ||
method: 'GET', | ||
url: '/parse-dashboard-config.json', | ||
}, | ||
getDashboardConfig([ | ||
{ | ||
appName: 'test1', | ||
}, | ||
{ | ||
appName: 'test2', | ||
}, | ||
]), | ||
); | ||
|
||
cy.visit('/') | ||
cy.wait(3000) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it really necessary to wait here? Doesn't cypress handle the loading and continue once the page loading finished? |
||
|
||
cy | ||
.url() | ||
.should('match', /\/apps$/); | ||
}); | ||
|
||
it('Can filter apps with search input', () => { | ||
cy.intercept( | ||
{ | ||
method: 'GET', | ||
url: '/parse-dashboard-config.json', | ||
}, | ||
getDashboardConfig([ | ||
{ | ||
appName: 'test1', | ||
}, | ||
{ | ||
appName: 'test2', | ||
}, | ||
]), | ||
); | ||
|
||
cy.visit('/apps') | ||
cy.wait(3000) | ||
|
||
cy | ||
.get('[data-cy="apps-index-app"]') | ||
.should('have.length', 2) | ||
|
||
cy | ||
.get('[data-cy="apps-index-search-input"]') | ||
.type('test1') | ||
|
||
cy | ||
.get('[data-cy="apps-index-app"]') | ||
.should('have.length', 1) | ||
|
||
cy | ||
.get('[data-cy="apps-index-search-input"]') | ||
.type('qwerty') | ||
|
||
cy | ||
.get('[data-cy="apps-index-app"]') | ||
.should('have.length', 0) | ||
}) | ||
|
||
it('Can show error states in the list', () => { | ||
cy.intercept( | ||
{ | ||
method: 'GET', | ||
url: '/parse-dashboard-config.json', | ||
}, | ||
getDashboardConfig([ | ||
{ | ||
appName: 'test1', | ||
}, | ||
{ | ||
appName: 'test2', | ||
masterKey: 'cos', | ||
}, | ||
{ | ||
appName: 'test3', | ||
appId: 'cos', | ||
}, | ||
{ | ||
appName: 'test4', | ||
masterKey: 'cos', | ||
appId: 'cos', | ||
}, | ||
{ | ||
appName: 'test5', | ||
serverURL: 'http://unavailablehost:1234' | ||
}, | ||
{ | ||
appName: 'test6', | ||
serverURL: 'http://localhost:1337/parse2' | ||
}, | ||
]), | ||
); | ||
|
||
cy.visit('/apps') | ||
cy.wait(3000) | ||
|
||
cy | ||
.get('[data-cy="apps-index-app"]') | ||
.should('have.length', 6) | ||
|
||
cy | ||
.get('[data-cy="apps-index-app"]') | ||
.eq(0) | ||
.find('[data-cy="apps-index-app-details"]') | ||
.contains('Server URL: http://localhost:1337/parse') | ||
|
||
cy | ||
.get('[data-cy="apps-index-app"]') | ||
.eq(1) | ||
.find('[data-cy="apps-index-app-details"]') | ||
.contains('Server not reachable: unauthorized') | ||
|
||
cy | ||
.get('[data-cy="apps-index-app"]') | ||
.eq(2) | ||
.find('[data-cy="apps-index-app-details"]') | ||
.contains('Server not reachable: unauthorized') | ||
|
||
cy | ||
.get('[data-cy="apps-index-app"]') | ||
.eq(3) | ||
.find('[data-cy="apps-index-app-details"]') | ||
.contains('Server not reachable: unauthorized') | ||
|
||
cy | ||
.get('[data-cy="apps-index-app"]') | ||
.eq(4) | ||
.find('[data-cy="apps-index-app-details"]') | ||
.contains('Server not reachable: unable to connect to server') | ||
|
||
cy | ||
.get('[data-cy="apps-index-app"]') | ||
.eq(5) | ||
.find('[data-cy="apps-index-app-details"]') | ||
.contains('Server not reachable: unable to connect to server') | ||
}); | ||
}) |
This file contains hidden or 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,30 @@ | ||
|
||
import { getDashboardConfig } from '../utils/getDashboardConfig'; | ||
|
||
describe('Dashboard', () => { | ||
it('Shows loader during loading', () => { | ||
cy.intercept( | ||
{ | ||
method: 'GET', | ||
url: '/parse-dashboard-config.json', | ||
}, | ||
(req) => { | ||
req.reply({ | ||
statusCode: 200, | ||
delay: 250, | ||
body: getDashboardConfig([ | ||
{ | ||
appName: 'test', | ||
} | ||
]), | ||
}) | ||
} | ||
) | ||
|
||
cy.visit('/') | ||
|
||
cy.get('[data-cy="dashboard-loader"]', { | ||
timeout: 250 | ||
}); | ||
}) | ||
}) |
This file contains hidden or 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,14 @@ | ||
export function getDashboardConfig(apps) { | ||
return { | ||
newFeaturesInLatestVersion: [], | ||
apps: apps.map(app => ({ | ||
serverURL: app.serverURL || 'http://localhost:1337/parse', | ||
appId: app.appId || 'hello', | ||
masterKey: app.masterKey || 'world', | ||
appName: app.appName, | ||
iconName: app.iconName || '', | ||
primaryBackgroundColor: app.primaryBackgroundColor || '', | ||
secondaryBackgroundColor: app.secondaryBackgroundColor || '', | ||
})), | ||
}; | ||
} |
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.
Uh oh!
There was an error while loading. Please reload this page.