Skip to content

Commit

Permalink
added e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Romuald Caplier committed Aug 29, 2024
1 parent f11b783 commit 6ea11fb
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
29 changes: 28 additions & 1 deletion apps/metadata-editor-e2e/src/e2e/edit.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,39 @@ describe('editor form', () => {
cy.get('md-editor-publish-button').click()
})

describe('New record', () => {
beforeEach(() => {
cy.login('barbie', 'p4ssworD_', false)

cy.visit('/create')

cy.get('@accessAndContactPageSelectorButton').click()
})

it('should have the connected user information prefilled in the contacts for resource of the dataset', () => {
cy.get('[data-test=displayedRoles]').children().should('have.length', 1)

cy.get('[data-test=displayedRoles]')
.children()
.find('gn-ui-contact-card')
.get('[data-test=contactCardName]')
.invoke('text')
.should('contain', 'Barbara Roberts')

cy.get('[data-test=displayedRoles]')
.children()
.find('gn-ui-contact-card')
.get('[data-test=contactCardEmail]')
.invoke('text')
.should('contain', '[email protected]')
})
})

describe('record fields', () => {
describe('contacts for resources', () => {
beforeEach(() => {
cy.login('admin', 'admin', false)

// Alpine convention record
cy.visit('/edit/accroche_velos')

cy.get('@accessAndContactPageSelectorButton').click()
Expand Down
2 changes: 1 addition & 1 deletion libs/common/fixtures/src/lib/organisations.fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const REGION_HAUT_DE_FRANCE_ORG_FIXTURE = (): Organization => ({
email: '[email protected]',
website: new URL('https://region-haut-de-france.com/'),
logoUrl: new URL('https://region-haut-de-france.com/logo.png'),
recordCount: 27,
recordCount: 4,
})

export const ORGANISATIONS_FIXTURE: Organization[] = deepFreeze([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
></gn-ui-thumbnail>
<div class="flex flex-col w-full">
<div class="flex flex-row justify-between">
<span class="flex flex-wrap font-bold w-full"
<span
class="flex flex-wrap font-bold w-full"
data-test="contactCardName"
>{{ contact.firstName }} {{ contact.lastName }}</span
>
</div>
<div>{{ contact.email }}</div>
<div data-test="contactCardEmail">{{ contact.email }}</div>
</div>
</div>
<gn-ui-button
Expand Down

0 comments on commit 6ea11fb

Please sign in to comment.