-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Chore: Add support for integration testing with Cypress (#909)
- Loading branch information
Conrad Chan
authored
Jan 31, 2019
1 parent
aaa1644
commit 68e962e
Showing
16 changed files
with
687 additions
and
38 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
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') | ||
// 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); | ||
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.