-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
45 changed files
with
1,108 additions
and
280 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import { FIXTURES_THUMBNAILS_FOLDER } from '../support/constants'; | ||
|
||
export const SIGNED_OUT_MEMBER = {}; | ||
|
||
export const MEMBERS = { | ||
|
@@ -16,12 +18,16 @@ export const MEMBERS = { | |
email: '[email protected]', | ||
createdAt: '2021-04-13 14:56:34.749946', | ||
extra: { lang: 'en' }, | ||
// this only exists for test | ||
thumbnails: FIXTURES_THUMBNAILS_FOLDER, | ||
}, | ||
CEDRIC: { | ||
id: 'ecafbd2a-5642-31fb-ae93-0242ac130006', | ||
name: 'cedric', | ||
email: '[email protected]', | ||
createdAt: '2021-04-13 14:56:34.749946', | ||
// this only exists for test | ||
thumbnails: FIXTURES_THUMBNAILS_FOLDER, | ||
}, | ||
DAVID: { | ||
id: 'ecafbd2a-5642-31fb-ae93-0242ac130062', | ||
|
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,71 @@ | ||
import { PERMISSION_LEVELS } from '../../src/enums'; | ||
import { FIXTURES_THUMBNAILS_FOLDER } from '../support/constants'; | ||
import { DEFAULT_FOLDER_ITEM } from './items'; | ||
import { MEMBERS } from './members'; | ||
|
||
// eslint-disable-next-line import/prefer-default-export | ||
export const SAMPLE_ITEMS_WITH_THUMBNAILS = { | ||
items: [ | ||
{ | ||
...DEFAULT_FOLDER_ITEM, | ||
id: 'bfafbd2a-5688-11eb-ae93-0242ac130002', | ||
name: 'own_item_name1', | ||
path: 'bfafbd2a_5688_11eb_ae93_0242ac130002', | ||
extra: { | ||
image: 'someimageurl', | ||
}, | ||
memberships: [ | ||
{ | ||
itemPath: 'bfa09f5a_5688_11eb_ae93_0242ac130002', | ||
permission: PERMISSION_LEVELS.ADMIN, | ||
memberId: MEMBERS.ANNA.id, | ||
}, | ||
], | ||
}, | ||
{ | ||
...DEFAULT_FOLDER_ITEM, | ||
id: 'bfa09f5a-5688-11eb-ae93-0242ac130002', | ||
name: 'own_item_name2', | ||
path: 'bfa09f5a_5688_11eb_ae93_0242ac130002', | ||
extra: { | ||
image: 'someimageurl', | ||
}, | ||
memberships: [ | ||
{ | ||
itemPath: 'fdf09f5a-5688-11eb-ae93-0242ac130002', | ||
permission: PERMISSION_LEVELS.ADMIN, | ||
memberId: MEMBERS.CEDRIC.id, | ||
}, | ||
{ | ||
itemPath: 'bfa09f5a_5688_11eb_ae93_0242ac130002', | ||
permission: PERMISSION_LEVELS.ADMIN, | ||
memberId: MEMBERS.BOB.id, | ||
}, | ||
], | ||
thumbnails: FIXTURES_THUMBNAILS_FOLDER, | ||
}, | ||
{ | ||
...DEFAULT_FOLDER_ITEM, | ||
id: 'bfa09f5a-5688-11eb-ae93-0242ac130002', | ||
name: 'own_item_name3', | ||
path: 'bfa09f5a_5688_11eb_ae93_0242ac130002', | ||
extra: { | ||
image: 'someimageurl', | ||
}, | ||
creator: MEMBERS.CEDRIC.id, | ||
memberships: [ | ||
{ | ||
itemPath: 'fdf09f5a-5688-11eb-ae93-0242ac130002', | ||
permission: PERMISSION_LEVELS.ADMIN, | ||
memberId: MEMBERS.CEDRIC.id, | ||
}, | ||
{ | ||
itemPath: 'bfa09f5a_5688_11eb_ae93_0242ac130002', | ||
permission: PERMISSION_LEVELS.ADMIN, | ||
memberId: MEMBERS.BOB.id, | ||
}, | ||
], | ||
}, | ||
], | ||
memberships: [], | ||
}; |
Binary file not shown.
Binary file not shown.
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
54 changes: 54 additions & 0 deletions
54
cypress/integration/item/thumbnails/uploadThumbnail.spec.js
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,54 @@ | ||
import { | ||
buildItemPath, | ||
MEMBER_PROFILE_PATH, | ||
} from '../../../../src/config/paths'; | ||
import { | ||
ITEM_SETTINGS_BUTTON_CLASS, | ||
THUMBNAIL_SETTING_UPLOAD_BUTTON_CLASSNAME, | ||
CROP_MODAL_CONFIRM_BUTTON_CLASSNAME, | ||
MEMBER_PROFILE_AVATAR_UPLOAD_BUTTON_CLASSNAME, | ||
} from '../../../../src/config/selectors'; | ||
import { SAMPLE_ITEMS_WITH_THUMBNAILS } from '../../../fixtures/thumbnails'; | ||
import { FILE_LOADING_PAUSE } from '../../../support/constants'; | ||
|
||
describe('Upload Thumbnails', () => { | ||
beforeEach(() => { | ||
cy.setUpApi(SAMPLE_ITEMS_WITH_THUMBNAILS); | ||
}); | ||
|
||
it(`upload item thumbnail`, () => { | ||
const { items } = SAMPLE_ITEMS_WITH_THUMBNAILS; | ||
cy.visit(buildItemPath(items[0].id)); | ||
cy.get(`.${ITEM_SETTINGS_BUTTON_CLASS}`).click(); | ||
|
||
// change item thumbnail | ||
cy.fixture('thumbnails/medium', 'binary') | ||
.then(Cypress.Blob.binaryStringToBlob) | ||
.then((fileContent) => { | ||
cy.get(`.${THUMBNAIL_SETTING_UPLOAD_BUTTON_CLASSNAME}`).attachFile({ | ||
fileContent, | ||
fileName: 'testPicture', | ||
}); | ||
cy.wait(FILE_LOADING_PAUSE); | ||
cy.get(`.${CROP_MODAL_CONFIRM_BUTTON_CLASSNAME}`).click(); | ||
cy.wait(`@uploadItemThumbnail`); | ||
}); | ||
}); | ||
|
||
it(`upload member avatar`, () => { | ||
cy.visit(MEMBER_PROFILE_PATH); | ||
|
||
// change item thumbnail | ||
cy.fixture('thumbnails/medium', 'binary') | ||
.then(Cypress.Blob.binaryStringToBlob) | ||
.then((fileContent) => { | ||
cy.get(`.${MEMBER_PROFILE_AVATAR_UPLOAD_BUTTON_CLASSNAME}`).attachFile({ | ||
fileContent, | ||
fileName: 'testPicture', | ||
}); | ||
cy.wait(FILE_LOADING_PAUSE); | ||
cy.get(`.${CROP_MODAL_CONFIRM_BUTTON_CLASSNAME}`).click(); | ||
cy.wait(`@uploadAvatar`); | ||
}); | ||
}); | ||
}); |
63 changes: 63 additions & 0 deletions
63
cypress/integration/item/thumbnails/viewThumbnails.spec.js
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,63 @@ | ||
import { DEFAULT_IMAGE_SRC } from '../../../../src/config/constants'; | ||
import { HOME_PATH, SHARED_ITEMS_PATH } from '../../../../src/config/paths'; | ||
import { | ||
buildItemCard, | ||
buildNameCellRendererId, | ||
HEADER_USER_ID, | ||
} from '../../../../src/config/selectors'; | ||
import { ITEM_LAYOUT_MODES } from '../../../../src/enums'; | ||
import { MEMBERS } from '../../../fixtures/members'; | ||
import { SAMPLE_ITEMS_WITH_THUMBNAILS } from '../../../fixtures/thumbnails'; | ||
|
||
describe('View Thumbnails', () => { | ||
beforeEach(() => {}); | ||
|
||
it(`display thumbnail icons`, () => { | ||
cy.setUpApi(SAMPLE_ITEMS_WITH_THUMBNAILS); | ||
|
||
cy.visit(HOME_PATH); | ||
|
||
const { items } = SAMPLE_ITEMS_WITH_THUMBNAILS; | ||
|
||
// check default material icon | ||
// first item doesn't have a thumbnail so it displays the material icon | ||
cy.get(`#${buildNameCellRendererId(items[0].id)} svg path`).should('exist'); | ||
|
||
// the second item has a defined thumbnail | ||
cy.get(`#${buildNameCellRendererId(items[1].id)} img`).should('exist'); | ||
|
||
// GRID | ||
cy.switchMode(ITEM_LAYOUT_MODES.GRID); | ||
cy.get(`#${buildItemCard(items[0].id)} img`) | ||
.should('have.attr', 'src') | ||
.and('contain', DEFAULT_IMAGE_SRC); | ||
|
||
cy.get(`#${buildItemCard(items[1].id)} img`) | ||
.should('have.attr', 'src') | ||
.and('contain', 'blob:'); | ||
}); | ||
|
||
it(`display member avatar`, () => { | ||
cy.setUpApi({ | ||
...SAMPLE_ITEMS_WITH_THUMBNAILS, | ||
currentMember: MEMBERS.BOB, | ||
}); | ||
|
||
cy.visit(HOME_PATH); | ||
|
||
const { items } = SAMPLE_ITEMS_WITH_THUMBNAILS; | ||
|
||
// display member avatar in header | ||
cy.get(`#${HEADER_USER_ID} img`) | ||
.should('have.attr', 'src') | ||
.and('contain', 'blob:'); | ||
|
||
cy.visit(SHARED_ITEMS_PATH); | ||
|
||
// check bob avatar in shared items, grid mode | ||
cy.switchMode(ITEM_LAYOUT_MODES.GRID); | ||
cy.get(`#${buildItemCard(items[2].id)} img`) | ||
.should('have.attr', 'src') | ||
.and('contain', 'blob:'); | ||
}); | ||
}); |
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
Oops, something went wrong.