import { TEST_USER_EMPTY_ID } from "../../consts"; import { login } from "../helpers"; describe("personalProfile.cy.js", () => { beforeEach(() => { cy.manageCommand("cypress_reset"); login("empty@example.com", "test"); cy.visit("/profile"); }); it("can edit all profile fields", () => { cy.get('[data-cy="editProfileButton"]').click(); cy.get("#phone").type("079 201 85 86"); cy.get('[data-test="dp-input"]').type("09.06.1982{enter}"); cy.get("#street-address").type("Hafen"); cy.get("#street-number").type("123"); cy.get("#postal-code").type("DE-20095"); cy.get("#city").type("Hamburg"); cy.get("#country").select("DE"); // andere broker cy.get("#organisation").select("1"); cy.get("#org-detail-name").type("Judihui GmbH"); cy.get("#org-street-address").type("Auf der Alm"); cy.get("#org-street-number").type("17"); cy.get("#org-postal-code").type("AT-6020"); cy.get("#org-city").type("Innsbruck"); cy.get("#org-country").select("AT"); cy.get("#invoice-address-organisation").click(); cy.get('[data-cy="saveButton"]').click(); // check displayed data cy.get('[data-cy="firstName"]').should("contain", "Flasche"); cy.get('[data-cy="lastName"]').should("contain", "Leer"); cy.get('[data-cy="email"]').should("contain", "empty@example.com"); cy.get('[data-cy="phone"]').should("contain", "079 201 85 86"); cy.get('[data-cy="birthDate"]').should("contain", "09.06.1982"); cy.get('[data-cy="privateAddress"]').should("contain", "Hafen 123"); cy.get('[data-cy="privateAddress"]').should("contain", "DE-20095 Hamburg"); cy.get('[data-cy="privateAddress"]').should("contain", "Deutschland"); cy.get('[data-cy="organisationDetailName"]').should( "contain", "andere Broker", ); cy.get('[data-cy="organisationAddress"]').should("contain", "Judihui GmbH"); cy.get('[data-cy="organisationAddress"]').should( "contain", "Auf der Alm 17", ); cy.get('[data-cy="organisationAddress"]').should( "contain", "AT-6020 Innsbruck", ); cy.get('[data-cy="organisationAddress"]').should("contain", "Österreich"); // check stored data cy.loadUser("id", TEST_USER_EMPTY_ID).then((u) => { expect(u.first_name).to.equal("Flasche"); expect(u.last_name).to.equal("Leer"); expect(u.street).to.equal("Hafen"); expect(u.street_number).to.equal("123"); expect(u.postal_code).to.equal("DE-20095"); expect(u.city).to.equal("Hamburg"); expect(u.country).to.equal("DE"); expect(u.invoice_address).to.equal("org"); expect(u.organisation_detail_name).to.equal("Judihui GmbH"); expect(u.organisation_street).to.equal("Auf der Alm"); expect(u.organisation_street_number).to.equal("17"); expect(u.organisation_postal_code).to.equal("AT-6020"); expect(u.organisation_city).to.equal("Innsbruck"); // 1 -> andere Broker expect(u.organisation).to.equal(1); }); }); });