Skip to content
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 test for internal presentation links #951

Merged
merged 4 commits into from
Mar 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion test/integration/document/PresentationViewer.e2e.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@
describe('Presentation Viewer', () => {
const token = Cypress.env('ACCESS_TOKEN');
const fileId = Cypress.env('FILE_ID_PRESENTATION');
const fileWithLinksId = Cypress.env('FILE_ID_PRESENTATION_WITH_LINKS');


beforeEach(() => {
cy.visit('/');
cy.showPreview(token, fileId);
});

it('Should initialize preview on the same page it was closed on', () => {
cy.showPreview(token, fileId);

// Assert document content is present
cy.contains('For Teaching Economics');

Expand All @@ -25,4 +27,17 @@ describe('Presentation Viewer', () => {

});

it('Should navigate to a specified page when an internal link is clicked', () => {
cy.showPreview(token, fileWithLinksId);

// Assert document content is present and clickable
cy.contains('LINK TO PAGE 3');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you may be able to do cy.contains('LINK TO PAGE 3').click(); as a single statement.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For links to work in preview with PPTs, you have to add a shape, so the text isn't actually clickable.


// Internal links should be rendered with <a> tags by PDF.js
cy.getByTestId('bp-content').find('a').click();

cy.getPreviewPage(3).should('be.visible');

});

});
3 changes: 2 additions & 1 deletion test/support/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ Cypress.env({
ACCESS_TOKEN: 'S8wjvjOL9GEK5VtXsQNVMOwSrx1g55oC',
FILE_ID_DOC: '415542803939',
FILE_ID_PRESENTATION: '415537552367',
FILE_ID_PRESENTATION_WITH_LINKS: '416052594867',
FILE_ID_MP3: '415542687401',
FILE_ID_VIDEO: '415535384156',
FILE_ID_VIDEO: '416047501580',
FILE_ID_VIDEO_SUBTITLES_TRACKS: '415542245854',
FILE_ID_VIDEO_SMALL: '415542846356'
});