-
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
30 changed files
with
534 additions
and
99 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,6 +1,20 @@ | ||
export const MEMBERS = { | ||
ANNA: { id: 'anna-id', name: 'anna', email: '[email protected]' }, | ||
BOB: { id: 'bob-id', name: 'bob', email: '[email protected]' }, | ||
ANNA: { | ||
id: 'ecafbd2a-5642-31fb-ae93-0242ac130002', | ||
name: 'anna', | ||
email: '[email protected]', | ||
createdAt: '2021-04-13 14:56:34.749946', | ||
extra: { | ||
lang: 'fr', | ||
}, | ||
}, | ||
BOB: { | ||
id: 'ecafbd2a-5688-11eb-fb52-3212ac130002', | ||
name: 'bob', | ||
email: '[email protected]', | ||
createdAt: '2021-04-13 14:56:34.749946', | ||
extra: { lang: 'en' }, | ||
}, | ||
}; | ||
|
||
export const CURRENT_USER = MEMBERS.ANNA; |
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,57 @@ | ||
import { MEMBER_PROFILE_PATH } from '../../src/config/paths'; | ||
import { langs } from '../../src/config/i18n'; | ||
import { | ||
MEMBER_PROFILE_MEMBER_ID_ID, | ||
MEMBER_PROFILE_MEMBER_NAME_ID, | ||
MEMBER_PROFILE_EMAIL_ID, | ||
MEMBER_PROFILE_LANGUAGE_SWITCH_ID, | ||
MEMBER_PROFILE_INSCRIPTION_DATE_ID, | ||
MEMBER_PROFILE_MEMBER_ID_COPY_BUTTON_ID, | ||
} from '../../src/config/selectors'; | ||
import { CURRENT_USER } from '../fixtures/members'; | ||
import { formatDate } from '../../src/utils/date'; | ||
|
||
describe('Member Profile', () => { | ||
beforeEach(() => { | ||
cy.setUpApi(); | ||
cy.visit(MEMBER_PROFILE_PATH); | ||
}); | ||
|
||
it('Layout', () => { | ||
const { id, name, email, extra, createdAt } = CURRENT_USER; | ||
cy.get(`#${MEMBER_PROFILE_MEMBER_ID_ID}`).should('contain', id); | ||
cy.get(`#${MEMBER_PROFILE_MEMBER_NAME_ID}`).should('contain', name); | ||
cy.get(`#${MEMBER_PROFILE_EMAIL_ID}`).should('contain', email); | ||
cy.get(`#${MEMBER_PROFILE_INSCRIPTION_DATE_ID}`).should( | ||
'contain', | ||
formatDate(createdAt), | ||
); | ||
cy.get(`#${MEMBER_PROFILE_LANGUAGE_SWITCH_ID}`).should( | ||
'contain', | ||
langs[extra.lang], | ||
); | ||
}); | ||
|
||
it('Changing Language edits user', () => { | ||
const { id } = CURRENT_USER; | ||
|
||
cy.get(`#${MEMBER_PROFILE_LANGUAGE_SWITCH_ID}`).select('en'); | ||
|
||
cy.wait('@editMember').then(({ request: { body, url } }) => { | ||
expect(url).to.contain(id); | ||
expect(body?.extra?.lang).to.equal('en'); | ||
}); | ||
}); | ||
|
||
it('Copy member ID to clipboard', () => { | ||
const { id } = CURRENT_USER; | ||
|
||
cy.get(`#${MEMBER_PROFILE_MEMBER_ID_COPY_BUTTON_ID}`).click(); | ||
|
||
cy.window().then((win) => { | ||
win.navigator.clipboard.readText().then((text) => { | ||
expect(text).to.equal(id); | ||
}); | ||
}); | ||
}); | ||
}); |
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
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.