diff --git a/cypress/e2e/pages/load_safe.pages.js b/cypress/e2e/pages/load_safe.pages.js
index 488b343bc6..55992282e8 100644
--- a/cypress/e2e/pages/load_safe.pages.js
+++ b/cypress/e2e/pages/load_safe.pages.js
@@ -3,12 +3,15 @@ import * as constants from '../../support/constants'
const addExistingAccountBtnStr = 'Add existing one'
const contactStr = 'Name, address & network'
const invalidAddressFormatErrorMsg = 'Invalid address format'
+const invalidAddressNameLengthErrorMsg = 'Maximum 50 symbols'
const safeDataForm = '[data-testid=load-safe-form]'
const nameInput = 'input[name="name"]'
const addressInput = 'input[name="address"]'
-const sideBarIcon = '[data-testid=ChevronRightIcon]'
-const sidebarCheckIcon = '[data-testid=CheckIcon]'
+const sideBarIcon = '[data-testid="ChevronRightIcon"]'
+const sidebarCheckIcon = '[data-testid="CheckIcon"]'
+const addressStepNextBtn = '[data-testid="load-safe-next-btn"]'
+const qrCodeBtn = '[data-testid="address-qr-scan"]'
const nextBtnStr = 'Next'
const addBtnStr = 'Add'
const settingsBtnStr = 'Settings'
@@ -52,13 +55,23 @@ export function verifyIncorrectAddressErrorMessage() {
cy.get(addressInput).parent().prev('label').contains(invalidAddressFormatErrorMsg)
}
+export function verifyNameLengthErrorMessage() {
+ cy.get(nameInput).parent().prev('label').contains(invalidAddressNameLengthErrorMsg)
+}
+
+export function ScanQRCode(image) {
+ cy.get('[data-testid="address-qr-scan"]').click()
+ cy.contains('Upload an image').click()
+ cy.get('[type="file"]').attachFile(image)
+}
+
export function inputAddress(address) {
cy.get(addressInput).clear().type(address)
}
-export function verifyAddressInputValue() {
+export function verifyAddressInputValue(safeAddress) {
// The address field should be filled with the "bare" QR code's address
- const [, address] = constants.SEPOLIA_TEST_SAFE_1.split(':')
+ const [, address] = safeAddress.split(':')
cy.get('input[name="address"]').should('have.value', address)
}
@@ -119,3 +132,7 @@ export function verifyTransactionSectionIsVisible() {
export function verifyNumberOfTransactions(startNumber, endNumber) {
cy.get(`span:contains("${startNumber} out of ${endNumber}")`).should('have.length', 1)
}
+
+export function verifyNextButtonStatus(param) {
+ cy.get(addressStepNextBtn).should(param)
+}
diff --git a/cypress/e2e/smoke/load_safe.cy.js b/cypress/e2e/smoke/load_safe.cy.js
index edce4b7f8b..f209abffea 100644
--- a/cypress/e2e/smoke/load_safe.cy.js
+++ b/cypress/e2e/smoke/load_safe.cy.js
@@ -42,26 +42,35 @@ describe('Load Safe tests', () => {
safe.verifyIncorrectAddressErrorMessage()
safe.inputNameAndAddress(testSafeName, constants.SEPOLIA_TEST_SAFE_1)
- // Type an invalid address
- // cy.get('input[name="address"]').clear().type(EOA_ADDRESS)
- // cy.get('@addressLabel').contains(INVALID_ADDRESS_ERROR_MSG)
-
- // Type a ENS name
- // TODO: register a goerli ENS name for the test Safe
- // cy.get('input[name="address"]').clear().type(SAFE_ENS_NAME)
- // giving time to the ENS name to be translated
- // cy.get('input[name="address"]', { timeout: 10000 }).should('have.value', `rin:${SAFE_ENS_NAME_TRANSLATED}`)
-
- // Uploading a QR code
- // TODO: fix this
- // cy.findByTestId('QrCodeIcon').click()
- // cy.contains('Upload an image').click()
- // cy.get('[type="file"]').attachFile('../fixtures/goerli_safe_QR.png')
-
- safe.verifyAddressInputValue()
+ safe.verifyAddressInputValue(constants.SEPOLIA_TEST_SAFE_1)
+ safe.verifyNextButtonStatus('be.enabled')
safe.clickOnNextBtn()
})
+ it('Verify names cannot have more than 50 chars', () => {
+ safe.inputName(main.generateRandomString(51))
+ safe.verifyNameLengthErrorMessage()
+ })
+
+ it('Verify ENS name is translated to a valid address', () => {
+ safe.inputAddress(constants.ENS_TEST_ETH)
+ safe.verifyAddressInputValue(constants.ETH_ENS_SAFE_ADDRESS_7)
+ safe.verifyNextButtonStatus('be.enabled')
+ safe.clickOnNextBtn()
+ })
+
+ it('Verify a valid QR code is accepted', () => {
+ safe.ScanQRCode(constants.VALID_QR_CODE_PATH)
+ // safe.verifyAddressInputValue(constants.ETH_ENS_SAFE_ADDRESS_6)
+ // safe.verifyNextButtonStatus('be.enabled')
+ // safe.clickOnNextBtn()
+ })
+
+ it.only('Verify a non QR code is not accepted', () => {
+ safe.ScanQRCode(constants.INVALID_QR_CODE_PATH)
+ cy.contains('The QR could not be read')
+ })
+
it('Verify custom name in the first owner an be set', () => {
safe.inputNameAndAddress(testSafeName, constants.SEPOLIA_TEST_SAFE_1)
safe.clickOnNextBtn()
diff --git a/cypress/fixtures/goerli_safe_QR.png b/cypress/fixtures/goerli_safe_QR.png
deleted file mode 100644
index 8db09e5771..0000000000
Binary files a/cypress/fixtures/goerli_safe_QR.png and /dev/null differ
diff --git a/cypress/fixtures/invalid_image_QR_test.png b/cypress/fixtures/invalid_image_QR_test.png
new file mode 100644
index 0000000000..e001d86a40
Binary files /dev/null and b/cypress/fixtures/invalid_image_QR_test.png differ
diff --git a/cypress/fixtures/sepolia_test_safe_QR.png b/cypress/fixtures/sepolia_test_safe_QR.png
new file mode 100644
index 0000000000..122768d0d0
Binary files /dev/null and b/cypress/fixtures/sepolia_test_safe_QR.png differ
diff --git a/cypress/support/constants.js b/cypress/support/constants.js
index e9dce33964..8c7b8cc05b 100644
--- a/cypress/support/constants.js
+++ b/cypress/support/constants.js
@@ -10,6 +10,7 @@ export const SEPOLIA_TEST_SAFE_3 = 'sep:0x6E834E9D04ad6b26e1525dE1a37BFd9b215f40
export const SEPOLIA_TEST_SAFE_4 = 'sep:0x03042B890b99552b60A073F808100517fb148F60'
export const SEPOLIA_TEST_SAFE_5 = 'sep:0xBd69b0a9DC90eB6F9bAc3E4a5875f437348b6415'
export const SEPOLIA_TEST_SAFE_6 = 'sep:0x6d0b6F96f665Bb4490f9ddb2e450Da2f7e546dC1'
+export const ETH_ENS_SAFE_ADDRESS_7 = 'eth:0x8675B754342754A30A2AeF474D114d8460bca19b'
export const GNO_TEST_SAFE = 'gno:0xB8d760a90a5ed54D3c2b3EFC231277e99188642A'
export const PAGINATION_TEST_SAFE = 'gor:0x850493a15914aAC05a821A3FAb973b4598889A7b'
export const TEST_SAFE = 'gor:0x04f8b1EA3cBB315b87ced0E32deb5a43cC151a91'
@@ -25,6 +26,9 @@ export const SIDEBAR_ADDRESS = '0x04f8...1a91'
export const ENS_TEST_SEPOLIA = 'testenssepolia.eth'
export const ENS_TEST_GOERLI = 'goerli-safe-test.eth'
export const ENS_TEST_SEPOLIA_INVALID = 'ivladitestenssepolia.eth'
+export const ENS_TEST_ETH = 'mainnetsafe.eth'
+export const VALID_QR_CODE_PATH = '../fixtures/sepolia_test_safe_QR.png' //converts to SEPOLIA_TEST_SAFE_6 address
+export const INVALID_QR_CODE_PATH = '../fixtures/invalid_image_QR_test.png' //A blank square
export const BROWSER_PERMISSIONS_KEY = `${LS_NAMESPACE}SafeApps__browserPermissions`
export const SAFE_PERMISSIONS_KEY = `${LS_NAMESPACE}SafeApps__safePermissions`
@@ -152,3 +156,7 @@ export const localStorageKeys = {
export const connectWalletNames = {
e2e: 'E2E Wallet',
}
+
+export const longNames = {
+ safeName: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit',
+}
diff --git a/src/components/common/ScanQRModal/ScanQRButton.tsx b/src/components/common/ScanQRModal/ScanQRButton.tsx
index e960ae5691..97101607c9 100644
--- a/src/components/common/ScanQRModal/ScanQRButton.tsx
+++ b/src/components/common/ScanQRModal/ScanQRButton.tsx
@@ -29,7 +29,7 @@ const ScanQRButton = ({ onScan }: Props): ReactElement => {
return (
<>
diff --git a/src/components/new-safe/load/steps/SetAddressStep/index.tsx b/src/components/new-safe/load/steps/SetAddressStep/index.tsx
index 89bfb3b9b6..cb91c1aead 100644
--- a/src/components/new-safe/load/steps/SetAddressStep/index.tsx
+++ b/src/components/new-safe/load/steps/SetAddressStep/index.tsx
@@ -157,7 +157,13 @@ const SetAddressStep = ({ data, onSubmit, onBack }: StepRenderProps}>
Back
-