{"size": 1787, "ext": "js", "max_stars_repo_path": "frontend/cypress/integration/ProfilePage.spec.js", "max_stars_repo_name": "amosproj/amos2021ws07-nft-development", "max_stars_repo_stars_event_min_datetime": "2021-12-02T11:59:01.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-11T20:40:28.000Z", "max_issues_repo_path": "frontend/cypress/integration/ProfilePage.spec.js", "max_issues_repo_name": "amosproj/amos2021ws07-nft-development", "max_issues_repo_issues_event_min_datetime": "2021-11-01T10:09:49.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-09T18:23:02.000Z", "max_forks_repo_path": "frontend/cypress/integration/ProfilePage.spec.js", "max_forks_repo_name": "amosproj/amos2021ws07-nft-development", "max_forks_repo_forks_event_min_datetime": "2022-01-05T12:01:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-05T12:01:52.000Z"}
{"max_stars_count": 2, "max_issues_count": 203, "max_forks_count": 1, "avg_line_length": 28.3650793651, "max_line_length": 169, "alphanum_fraction": 0.6558477896}
// SPDX-License-Identifier: MIT
// SPDX-FileCopyrightText: 2022 Dominic Heil <d.heil@campus.tu-berlin.de>

import React from "react";
import { mount } from "@cypress/react";
import { BrowserRouter } from "react-router-dom";
import Profile from "../../src/pages/Profile";

function setupLoggedInUser() {
	mount(<div style={{ backgroundColor: "black" }}><BrowserRouter><Profile user={{ email: "test@mail.com", name: "testName" }} setUser={() => {}}/></BrowserRouter></div>);
}

Cypress.config("defaultCommandTimeout", 10000);

describe("non logged in user", () => {
	beforeEach(() => {
		cy.enableIntercepts();
		cy.setDesktopScreenSize();
		setupLoggedInUser();
	});

	context("redirect to announcements", () => {

		it("username, email and change password info texts are displayed", () => {
			cy.contains("Username").should("be.visible");
			cy.contains("Email").should("be.visible");
			cy.contains("Change password").should("be.visible");

		});

		it("username, email and change password inputs are displayed", () => {
			cy.get("input").get("#Username0");
			cy.get("input").get("#Email0");
			cy.get("input").get("#Change\\ password0");
		});

		it("should display connect MetaMask Wallet button", function () {
			cy.get("button").contains("Connect MetaMask Wallet");
		});

		it("should display connect logout button", function () {
			cy.get("button").contains("Logout");
		});

		it("should redirect to logout after logout was pressed", function () {
			cy.get("button").contains("Logout").click();
			cy.url().should("not.include", "/user/profile");
		});

		it("should redirect to nft collection after clicking nft collection button", function () {
			cy.get("a").contains("NFT collection").click();
			cy.url().should("include", "/user/myCollection");
		});

	});

});





