Skip to content

Commit

Permalink
feat(archive): Add e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
Mingze Xiao committed Jan 4, 2020
1 parent 0250432 commit f09b826
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
42 changes: 42 additions & 0 deletions test/integration/archive/ArchiveViewer.e2e.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// <reference types="Cypress" />
describe('Archive Viewer', () => {
const token = Cypress.env('ACCESS_TOKEN');
const fileId = Cypress.env('FILE_ID_ARCHIVE');

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

it('Should render correct item list', () => {
cy.contains('Preview SDK Sample Excel.xlsx');
// clicking folder
cy.contains('Level 1 Folder').click();
cy.contains('XSS.txt');
cy.contains('Level 2 Folder').click();
cy.contains('Video (Normal).mp4');
// clicking breadcrumb
cy.contains('Preview SDK Sample Archive').click();
cy.contains('JS-Small.js');
});

it('Should sort items when column header is clicked', () => {
cy.getByTitle('Filename').click();

cy.get('.ReactVirtualized__Table__row')
.first()
.contains('Audio.mp3');
});

it.only('Should show matched item list based on search query', () => {
cy.get('.bp-SearchBar input').type('level');
cy.contains('Level 2 Folder');

cy.get('.bp-SearchBar input').clear();
cy.contains('Preview SDK Sample Excel.xlsx');

// fuzzy search
cy.get('.bp-SearchBar input').type('vido');
cy.contains('Video (Normal).mp4');
});
});
3 changes: 2 additions & 1 deletion test/support/constants.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Cypress.env({
// NOTE: The token used is a readonly token accessing public data in a demo enterprise.
ACCESS_TOKEN: 'S8wjvjOL9GEK5VtXsQNVMOwSrx1g55oC',
FILE_ID_ARCHIVE: '589625563707',
FILE_ID_BAD: '433514141824',
FILE_ID_DOC_LARGE: '420985736453',
FILE_ID_DOC: '415542803939',
Expand All @@ -16,5 +17,5 @@ Cypress.env({
FILE_ID_TXT: '420870357452',
FILE_ID_VIDEO_SMALL: '415542846356',
FILE_ID_VIDEO_SUBTITLES_TRACKS: '415542245854',
FILE_ID_VIDEO: '416047501580'
FILE_ID_VIDEO: '416047501580',
});

0 comments on commit f09b826

Please sign in to comment.