-
Notifications
You must be signed in to change notification settings - Fork 116
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
Chore: Add support for integration testing with Cypress #909
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2fca83a
Chore: Add support for integration testing with Cypress
52a1fd7
Merge branch 'master' into cypress
85f53a5
Chore: removing broken test
9033c0a
Chore: addressing PR comments
48c659c
Chore: PR comments
6201097
Chore: try timeout
bbe9367
Chore: add testid to preview-container
d179a65
Chore: remove timeout
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,13 +1,15 @@ | ||
node_modules | ||
*.swp | ||
*.iml | ||
.DS_Store | ||
.idea | ||
*.iml | ||
*.swp | ||
build/rsync.json | ||
.DS_Store | ||
dist | ||
functional-tests/output | ||
jsconfig.json | ||
node_modules | ||
npm-debug.log | ||
reports | ||
dist | ||
src/i18n/json | ||
jsconfig.json | ||
functional-tests/output | ||
test/screenshots | ||
test/videos | ||
yarn-error.log |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"baseUrl": "http://localhost:8000/#", | ||
"fileServerFolder": "test", | ||
"fixturesFolder": "test/fixtures", | ||
"integrationFolder": "test/integration", | ||
"pluginsFile": "test/plugins/index.js", | ||
"screenshotsFolder": "test/screenshots", | ||
"supportFile": "test/support/index.js", | ||
"video": false, | ||
"videosFolder": "test/videos", | ||
"viewportHeight": 1260, | ||
"viewportWidth": 1600 | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"env": { | ||
"cypress/globals": true | ||
}, | ||
"extends": ["plugin:cypress/recommended"], | ||
"plugins": ["cypress"] | ||
} |
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 @@ | ||
{} |
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,20 @@ | ||
// <reference types="Cypress" /> | ||
describe('Preview Sanity', () => { | ||
let token; | ||
|
||
beforeEach(() => { | ||
token = Cypress.env('ACCESS_TOKEN'); | ||
cy.visit('/'); | ||
}); | ||
|
||
it('Should load a document preview', () => { | ||
const fileId = Cypress.env('FILE_ID_DOC'); | ||
|
||
// Show the preview | ||
cy.showPreview(token, fileId); | ||
// Wait for .bp to load viewer | ||
cy.getByTestId('bp').should('have.class', 'bp-loaded') | ||
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. Should this live in the |
||
// Assert document content is present | ||
cy.contains('The Content Platform for Your Apps'); | ||
}); | ||
}); |
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,19 @@ | ||
// *********************************************************** | ||
// This example plugins/index.js can be used to load plugins | ||
// | ||
// You can change the location of this file or turn off loading | ||
// the plugins file with the 'pluginsFile' configuration option. | ||
// | ||
// You can read more here: | ||
// https://on.cypress.io/plugins-guide | ||
// *********************************************************** | ||
|
||
// This function is called when a project is opened or re-opened (e.g. due to | ||
// the project's config changing) | ||
|
||
/* eslint-disable */ | ||
module.exports = (on, config) => { | ||
// `on` is used to hook into various events Cypress emits | ||
// `config` is the resolved Cypress config | ||
} | ||
/* eslint-enable */ |
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,8 @@ | ||
Cypress.Commands.add('getByTestId', (testId) => cy.get(`[data-testid="${testId}"]`)); | ||
Cypress.Commands.add('getByTitle', (title) => cy.get(`[title="${title}"]`)); | ||
Cypress.Commands.add('showPreview', (token, fileId) => { | ||
cy.get('[data-testid="token"]').type(token); | ||
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. These should be able to use |
||
cy.get('[data-testid="token-set"]').click(); | ||
cy.get('[data-testid="fileid"]').type(fileId); | ||
cy.get('[data-testid="fileid-set"]').click(); | ||
}); |
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,7 @@ | ||
Cypress.env({ | ||
FILE_ID_DOC: '287707140303', | ||
FILE_ID_MP3: '286509191779', | ||
FILE_ID_VIDEO: '286114565199', | ||
FILE_ID_VIDEO_SUBTITLES_TRACKS: '286840567797', | ||
FILE_ID_VIDEO_SMALL: '286114192023' | ||
}); |
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,17 @@ | ||
// *********************************************************** | ||
// This example support/index.js is processed and | ||
// loaded automatically before your test files. | ||
// | ||
// This is a great place to put global configuration and | ||
// behavior that modifies Cypress. | ||
// | ||
// You can change the location of this file or turn off | ||
// automatically serving support files with the | ||
// 'supportFile' configuration option. | ||
// | ||
// You can read more here: | ||
// https://on.cypress.io/configuration | ||
// *********************************************************** | ||
|
||
import './commands' | ||
import './constants' |
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.
Seems like this could be made a const and done just inside
describe
above unless token is modified in tests.