-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
9 changed files
with
92 additions
and
86 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
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
28 changes: 28 additions & 0 deletions
28
test/e2e/integration/component-library/utils/fillAddressAndVerify.ts
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,28 @@ | ||
export const fillInAddressAndVerify = (address: string, co: string, zip: string, houseNumber: string) => { | ||
cy.gotoNavPage('Adresse'); | ||
cy.get('#address_address_AddressPage-Address').type(address); | ||
cy.get('#address_care_of_AddressPage-Address').type(co); | ||
cy.get('#address_zip_code_AddressPage-Address').type(zip); | ||
cy.get('#address_house_number_AddressPage-Address').type(houseNumber); | ||
|
||
// Verify Gateadresse (Street address) | ||
cy.get('[data-testid="summary-single-value-component"]') | ||
.eq(0) | ||
.find('span.fds-paragraph') | ||
.should('have.text', address); | ||
|
||
// Verify C/O eller annan tilleggsadresse (C/O or additional address) | ||
cy.get('[data-testid="summary-single-value-component"]').eq(1).find('span.fds-paragraph').should('have.text', co); | ||
|
||
// Verify Postnr (Postal code) | ||
cy.get('[data-testid="summary-single-value-component"]').eq(2).find('span.fds-paragraph').should('have.text', zip); | ||
|
||
// Verify Poststad (City) | ||
cy.get('[data-testid="summary-single-value-component"]').eq(3).find('span.fds-paragraph').should('have.text', 'OSLO'); | ||
|
||
// Verify Bustadnummer (House number) | ||
cy.get('[data-testid="summary-single-value-component"]') | ||
.eq(4) | ||
.find('span.fds-paragraph') | ||
.should('have.text', houseNumber); | ||
}; |
5 changes: 5 additions & 0 deletions
5
test/e2e/integration/component-library/utils/inputAndVerify.ts
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,5 @@ | ||
export const fillInInputAndVerify = (text: string) => { | ||
cy.gotoNavPage('Kort svar'); | ||
cy.get('#InputPage-Input').type(text); | ||
cy.get('[data-testid="summary-single-value-component"]').eq(0).find('span.fds-paragraph').should('have.text', text); | ||
}; |
44 changes: 44 additions & 0 deletions
44
test/e2e/integration/component-library/utils/uploadFileAndVerify.ts
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,44 @@ | ||
export const makeTestFile = (fileName: string) => ({ | ||
fileName, | ||
mimeType: 'application/pdf', | ||
lastModified: Date.now(), | ||
contents: Cypress.Buffer.from('hello world'), | ||
}); | ||
|
||
export const uploadFileAndVerify = (fileName: string) => { | ||
cy.gotoNavPage('Filopplasting'); | ||
cy.get('[data-componenttype="FileUpload"]').first().should('be.visible'); | ||
|
||
cy.get('[data-componenttype="FileUpload"]') | ||
.first() | ||
.find('input[type="file"]') | ||
.selectFile(makeTestFile(fileName), { force: true }); | ||
|
||
cy.get('[data-testid="file-upload-table-summary"]').first().should('be.visible'); | ||
cy.get('[data-testid="file-upload-table-summary"]') | ||
.first() | ||
.find('tr') | ||
.find('td') | ||
.contains('td', 'uploadThis.pdf') | ||
.should('exist'); | ||
}; | ||
|
||
export const uploadFileWithTagAndVerify = (fileName: string, fileType: string) => { | ||
cy.gotoNavPage('Filopplasting'); | ||
cy.get('[data-componenttype="FileUploadWithTag"]').first().should('be.visible'); | ||
cy.get('[data-componenttype="FileUploadWithTag"]') | ||
.first() | ||
.find('input[type="file"]') | ||
.selectFile(makeTestFile(fileName), { force: true }); | ||
cy.contains('label', 'Filtype').click(); | ||
cy.get('div[role="listbox"]').contains('span', fileType).click(); | ||
cy.get('input[id^="attachment-tag-dropdown-"]').should(($input) => { | ||
expect($input.val()).to.eq(fileType); | ||
}); | ||
cy.get('button[id^=attachment-save-tag-button]').click(); | ||
|
||
cy.get('[data-testid="tagFile-summary"]').first().should('be.visible'); | ||
cy.get('[data-testid="tagFile-summary"]').first().find('tr').find('td').contains('td', fileName).should('exist'); | ||
|
||
cy.get('[data-testid="tagFile-summary"]').first().find('tr').find('td').contains('td', fileType).should('exist'); | ||
}; |