diff --git a/cypress/e2e/quizHomePageFields.cy.ts b/cypress/e2e/quizHomePageFields.cy.ts new file mode 100644 index 00000000..744565cf --- /dev/null +++ b/cypress/e2e/quizHomePageFields.cy.ts @@ -0,0 +1,140 @@ +import "cypress-file-upload"; + +describe("Тестирование полей главной страницы", () => { + beforeEach(() => { + cy.visit("http://localhost:3000"); + cy.wait(1000); + cy.contains("Регистрация / Войти").click(); + const login = "valid_user@exammple.com"; + const password = "valid_password"; + + cy.get("#email").type(login); + cy.get("#password").type(password); + cy.get('button[type="submit"]').click(); + }); + + it("Тест на создание нового квиза, заполнение полей главной странички,в превью тестовом просмотре и публикации", () => { + cy.get('[data-cy="create-quiz"]').click(); + cy.wait(1000); + cy.get('button[data-cy="create-quiz-card"]').click(); + cy.wait(1000); + cy.get('button[data-cy="select-quiz-layout-standard"]').click(); + + cy.get("#contentButton").click(); + + cy.get("#headingInput").type("Заголовок заголовка"); + cy.get("#textInput").type("У нас тут какой-то текст"); + cy.get("#buttonTextInput").type("Нажми на кнопку"); + cy.get("#phoneInput").type("8-800-000-00-00"); + cy.get("#companyInput").type("Наш слоган - слоган наш"); + cy.get("#websiteInput").type("http://vk:3000/edit"); + cy.get("#legalInformationInput").type("У наших документов есть данные"); + + cy.get(`button[data-cy="button-preview"]`).click(); + cy.wait(2000); + + // проверка введёных значений + cy.get(`[data-cy="heading"]`) + .should("exist") + .and("have.text", "Заголовок заголовка"); + cy.get(`[data-cy="text"]`) + .should("exist") + .and("have.text", "У нас тут какой-то текст"); + cy.get(`[data-cy="phonenumber"`) + .should("exist") + .and("have.text", "8-800-000-00-00"); + cy.get(`[data-cy="startpage-button"]`) + .should("exist") + .and("have.text", "Нажми на кнопку"); + cy.get(`[data-cy="company"]`) + .should("exist") + .and("have.text", "Наш слоган - слоган наш"); + cy.get(`[data-cy="legalInformation"]`) + .should("exist") + .and("have.text", "У наших документов есть данные"); + + cy.get(`button[data-cy="button-preview"]`).click(); + + //создаём вопрос для тестового просмотра + + cy.get('[data-cy="setup-questions"]').click(); + + cy.wait(500); + + // cy.get('[data-cy="create-question"]').click(); + + cy.get(`[data-cy="select-questiontype-images"]`).click(); + cy.get( + '[data-cy="checkbox-optional-question"] > .PrivateSwitchBase-input', + ).click(); + cy.get('[data-cy="quiz-variant-question-answer"]') + .eq(0) + .type("1") + .type("{enter}"); + + cy.get('button[data-cy="back-button"]').scrollIntoView().wait(500).click(); + cy.wait(1000); + cy.visit("http://localhost:3000/view"); + cy.wait(2000); + + //проверка введёных значений + cy.get(`[data-cy="heading"]`) + .should("exist") + .and("have.text", "Заголовок заголовка"); + cy.get(`[data-cy="text"]`) + .should("exist") + .and("have.text", "У нас тут какой-то текст"); + cy.get(`[data-cy="phonenumber"`) + .should("exist") + .and("have.text", "8-800-000-00-00"); + cy.get(`[data-cy="startpage-button"]`) + .should("exist") + .and("have.text", "Нажми на кнопку"); + cy.get(`[data-cy="company"]`) + .should("exist") + .and("have.text", "Наш слоган - слоган наш"); + cy.get(`[data-cy="legalInformation"]`) + .should("exist") + .and("have.text", "У наших документов есть данные"); + + cy.visit("http://localhost:3000/edit"); + cy.wait(2000); + + cy.get(`[data-cy="publish-button"]`).click(); + cy.wait(500); + + let linkText; + + cy.get('[data-cy="link-test"]') + .invoke("text") + .then((text) => { + linkText = text; + }); + + cy.wait(2000).then(() => { + cy.visit(linkText); + }); + + cy.origin("https://hbpn.link", () => { + // <команды, направленные на https://hbpn.link, идут здесь> + cy.contains("p", "Заголовок заголовка").should("exist"); + cy.wait(100); + cy.contains("p", "У нас тут какой-то текст").should("exist"); + cy.wait(100); + cy.contains("p", "8-800-000-00-00").should("exist"); + cy.wait(100); + cy.contains("p", "Наш слоган - слоган наш").should("exist"); + cy.wait(100); + cy.contains("p", "У наших документов есть данные").should("exist"); + cy.wait(100); + cy.get(`button`).should("exist").and("have.text", "Нажми на кнопку"); + }); + + cy.visit("http://localhost:3000/list"); + cy.wait(2000); + + cy.get('[data-cy="quiz-card"] h5') + .should("exist") + .and("have.text", "Заголовок заголовка"); + }); +}); diff --git a/cypress/e2e/quizPublish.cy.ts b/cypress/e2e/quizPublish.cy.ts index 06203589..84f057b6 100644 --- a/cypress/e2e/quizPublish.cy.ts +++ b/cypress/e2e/quizPublish.cy.ts @@ -1,6 +1,6 @@ import "cypress-file-upload"; -describe("Форма Входа", () => { +describe("Тестирование публикации", () => { beforeEach(() => { cy.visit("http://localhost:3000"); cy.wait(1000); @@ -19,27 +19,47 @@ describe("Форма Входа", () => { cy.get('button[data-cy="create-quiz-card"]').eq(0).click(); cy.wait(1000); cy.get('button[data-cy="select-quiz-layout-standard"]').click(); - cy.get('input[type="checkbox"]').click(); cy.get('[data-cy="setup-questions"]').click(); - cy.contains("button", "Варианты с картинками").click(); - cy.contains("label", "Необязательный вопрос").click(); + cy.wait(500); + cy.get('[data-cy="create-question"]').click(); - cy.get('[data-cy="quiz-variant-question-answer"]').eq(0).type("1").type("{enter}"); - cy.get('[data-cy="quiz-variant-question-answer"]').eq(1).should("have.value", "").type("2").type("{enter}"); - cy.get('[data-cy="quiz-variant-question-answer"]').eq(2).should("have.value", "").type("3").type("{enter}"); - cy.get('[data-cy="quiz-variant-question-answer"]').eq(3).should("have.value", "").type("4").type("{enter}"); + cy.get(`[data-cy="select-questiontype-images"]`).click(); + + cy.get( + '[data-cy="checkbox-optional-question"] > .PrivateSwitchBase-input', + ).click(); + + cy.get('[data-cy="quiz-variant-question-answer"]') + .eq(0) + .type("1") + .type("{enter}"); + cy.get('[data-cy="quiz-variant-question-answer"]') + .eq(1) + .should("have.value", "") + .type("2") + .type("{enter}"); + cy.get('[data-cy="quiz-variant-question-answer"]') + .eq(2) + .should("have.value", "") + .type("3") + .type("{enter}"); + cy.get('[data-cy="quiz-variant-question-answer"]') + .eq(3) + .should("have.value", "") + .type("4") + .type("{enter}"); cy.visit("http://localhost:3000/view"); cy.wait(500); - cy.contains("Далее →").should("be.disabled"); + cy.get("#buttonFurther").should("be.disabled"); cy.contains("div", "1").click(); cy.wait(500); - cy.contains("Далее →").should("not.be.disabled"); + cy.get("#buttonFurther").should("not.be.disabled"); cy.visit("http://localhost:3000/view"); cy.visit("http://localhost:3000/edit"); @@ -51,22 +71,39 @@ describe("Форма Входа", () => { //Варианты ответов + - cy.contains("button", "Варианты ответов").click(); - cy.contains("label", "Необязательный вопрос").click(); + cy.get(`[data-cy="select-questiontype-variant"]`).click(); + cy.get( + '[data-cy="checkbox-optional-question"] > .PrivateSwitchBase-input', + ).click(); - cy.get('[data-cy="quiz-variant-question-answer"]').eq(0).type("1").type("{enter}"); - cy.get('[data-cy="quiz-variant-question-answer"]').eq(1).should("have.value", "").type("2").type("{enter}"); - cy.get('[data-cy="quiz-variant-question-answer"]').eq(2).should("have.value", "").type("3").type("{enter}"); - cy.get('[data-cy="quiz-variant-question-answer"]').eq(3).should("have.value", "").type("4").type("{enter}"); + cy.get('[data-cy="quiz-variant-question-answer"]') + .eq(0) + .type("1") + .type("{enter}"); + cy.get('[data-cy="quiz-variant-question-answer"]') + .eq(1) + .should("have.value", "") + .type("2") + .type("{enter}"); + cy.get('[data-cy="quiz-variant-question-answer"]') + .eq(2) + .should("have.value", "") + .type("3") + .type("{enter}"); + cy.get('[data-cy="quiz-variant-question-answer"]') + .eq(3) + .should("have.value", "") + .type("4") + .type("{enter}"); cy.visit("http://localhost:3000/view"); cy.wait(500); - cy.contains("Далее →").should("be.disabled"); + cy.get("#buttonFurther").should("be.disabled"); cy.contains("label", "1").click(); cy.wait(500); - cy.contains("Далее →").should("not.be.disabled"); + cy.get("#buttonFurther").should("not.be.disabled"); cy.visit("http://localhost:3000/view"); cy.visit("http://localhost:3000/edit"); @@ -80,22 +117,39 @@ describe("Форма Входа", () => { // Варианты и картинка + - cy.contains("button", "Варианты и картинка").click(); - cy.contains("label", "Необязательный вопрос").click(); + cy.get(`[data-cy="select-questiontype-varimg"]`).click(); + cy.get( + '[data-cy="checkbox-optional-question"] > .PrivateSwitchBase-input', + ).click(); - cy.get('[data-cy="quiz-variant-question-answer"]').eq(0).type("1").type("{enter}"); - cy.get('[data-cy="quiz-variant-question-answer"]').eq(1).should("have.value", "").type("2").type("{enter}"); - cy.get('[data-cy="quiz-variant-question-answer"]').eq(2).should("have.value", "").type("3").type("{enter}"); - cy.get('[data-cy="quiz-variant-question-answer"]').eq(3).should("have.value", "").type("4").type("{enter}"); + cy.get('[data-cy="quiz-variant-question-answer"]') + .eq(0) + .type("1") + .type("{enter}"); + cy.get('[data-cy="quiz-variant-question-answer"]') + .eq(1) + .should("have.value", "") + .type("2") + .type("{enter}"); + cy.get('[data-cy="quiz-variant-question-answer"]') + .eq(2) + .should("have.value", "") + .type("3") + .type("{enter}"); + cy.get('[data-cy="quiz-variant-question-answer"]') + .eq(3) + .should("have.value", "") + .type("4") + .type("{enter}"); cy.visit("http://localhost:3000/view"); cy.wait(500); - cy.contains("Далее →").should("be.disabled"); + cy.get("#buttonFurther").should("be.disabled"); cy.contains("div", "1").click(); cy.wait(500); - cy.contains("Далее →").should("not.be.disabled"); + cy.get("#buttonFurther").should("not.be.disabled"); cy.visit("http://localhost:3000/view"); cy.visit("http://localhost:3000/edit"); @@ -108,21 +162,39 @@ describe("Форма Входа", () => { //Эмоджи + - cy.contains("button", "Эмоджи").click(); - cy.contains("label", "Необязательный вопрос").click(); - cy.get('[data-cy="quiz-variant-question-answer"]').eq(0).type("1").type("{enter}"); - cy.get('[data-cy="quiz-variant-question-answer"]').eq(1).should("have.value", "").type("2").type("{enter}"); - cy.get('[data-cy="quiz-variant-question-answer"]').eq(2).should("have.value", "").type("3").type("{enter}"); - cy.get('[data-cy="quiz-variant-question-answer"]').eq(3).should("have.value", "").type("4").type("{enter}"); + cy.get(`[data-cy="select-questiontype-emoji"]`).click(); + cy.get( + '[data-cy="checkbox-optional-question"] > .PrivateSwitchBase-input', + ).click(); + + cy.get('[data-cy="quiz-variant-question-answer"]') + .eq(0) + .type("1") + .type("{enter}"); + cy.get('[data-cy="quiz-variant-question-answer"]') + .eq(1) + .should("have.value", "") + .type("2") + .type("{enter}"); + cy.get('[data-cy="quiz-variant-question-answer"]') + .eq(2) + .should("have.value", "") + .type("3") + .type("{enter}"); + cy.get('[data-cy="quiz-variant-question-answer"]') + .eq(3) + .should("have.value", "") + .type("4") + .type("{enter}"); cy.visit("http://localhost:3000/view"); cy.wait(500); - cy.contains("Далее →").should("be.disabled"); + cy.get("#buttonFurther").should("be.disabled"); cy.contains("div", "1").click(); cy.wait(500); - cy.contains("Далее →").should("not.be.disabled"); + cy.get("#buttonFurther").should("not.be.disabled"); cy.visit("http://localhost:3000/view"); cy.visit("http://localhost:3000/edit"); @@ -135,19 +207,24 @@ describe("Форма Входа", () => { //Своё поле для ввода + - cy.contains("button", "Своё поле для ввода").click(); - cy.contains("label", "Необязательный вопрос").click(); + cy.get(`[data-cy="select-questiontype-text"]`).click(); + cy.get( + '[data-cy="checkbox-optional-question"] > .PrivateSwitchBase-input', + ).click(); - cy.get('input[placeholder="Пример ответа"]').eq(0).type("1").type("{enter}"); + cy.get('input[placeholder="Пример ответа"]') + .eq(0) + .type("1") + .type("{enter}"); cy.visit("http://localhost:3000/view"); cy.wait(500); - cy.contains("Далее →").should("be.disabled"); + cy.get("#buttonFurther").should("be.disabled"); cy.get('input[type="text"]').type("email@invalid.com"); cy.wait(500); - cy.contains("Далее →").should("not.be.disabled"); + cy.get("#buttonFurther").should("not.be.disabled"); cy.visit("http://localhost:3000/view"); cy.visit("http://localhost:3000/edit"); @@ -160,23 +237,40 @@ describe("Форма Входа", () => { //Выпадающий список + - cy.contains("button", "Выпадающий список").click(); - cy.contains("label", "Необязательный вопрос").click(); + cy.get(`[data-cy="select-questiontype-select"]`).click(); + cy.get( + '[data-cy="checkbox-optional-question"] > .PrivateSwitchBase-input', + ).click(); - cy.get('[data-cy="quiz-variant-question-answer"]').eq(0).type("1").type("{enter}"); - cy.get('[data-cy="quiz-variant-question-answer"]').eq(1).should("have.value", "").type("2").type("{enter}"); - cy.get('[data-cy="quiz-variant-question-answer"]').eq(2).should("have.value", "").type("3").type("{enter}"); - cy.get('[data-cy="quiz-variant-question-answer"]').eq(3).should("have.value", "").type("4").type("{enter}"); + cy.get('[data-cy="quiz-variant-question-answer"]') + .eq(0) + .type("1") + .type("{enter}"); + cy.get('[data-cy="quiz-variant-question-answer"]') + .eq(1) + .should("have.value", "") + .type("2") + .type("{enter}"); + cy.get('[data-cy="quiz-variant-question-answer"]') + .eq(2) + .should("have.value", "") + .type("3") + .type("{enter}"); + cy.get('[data-cy="quiz-variant-question-answer"]') + .eq(3) + .should("have.value", "") + .type("4") + .type("{enter}"); cy.visit("http://localhost:3000/view"); cy.wait(500); - cy.contains("Далее →").should("be.disabled"); + cy.get("#buttonFurther").should("be.disabled"); cy.get("#display-select").click(); cy.get("li").eq(0).click(); cy.wait(500); - cy.contains("Далее →").should("not.be.disabled"); + cy.get("#buttonFurther").should("not.be.disabled"); cy.visit("http://localhost:3000/view"); cy.visit("http://localhost:3000/edit"); @@ -189,13 +283,15 @@ describe("Форма Входа", () => { //Дата + - cy.contains("button", "Дата").click(); - cy.contains("label", "Необязательный вопрос").click(); + cy.get(`[data-cy="select-questiontype-date"]`).click(); + cy.get( + '[data-cy="checkbox-optional-question"] > .PrivateSwitchBase-input', + ).click(); cy.visit("http://localhost:3000/view"); cy.wait(500); - cy.contains("Далее →").should("be.disabled"); + cy.get("#buttonFurther").should("be.disabled"); cy.get('button[data-cy="open-datepicker"]').click(); cy.wait(500); @@ -203,7 +299,7 @@ describe("Форма Входа", () => { cy.get('button[role="gridcell"]').eq(16).click(); cy.wait(500); - cy.contains("Далее →").should("not.be.disabled"); + cy.get("#buttonFurther").should("not.be.disabled"); cy.visit("http://localhost:3000/view"); cy.visit("http://localhost:3000/edit"); @@ -216,17 +312,22 @@ describe("Форма Входа", () => { //Ползунок + - cy.contains("button", "Ползунок").click(); - cy.contains("label", "Необязательный вопрос").click(); + cy.get(`[data-cy="select-questiontype-number"]`).click(); + cy.get( + '[data-cy="checkbox-optional-question"] > .PrivateSwitchBase-input', + ).click(); cy.visit("http://localhost:3000/view"); cy.wait(500); - cy.contains("Далее →").should("be.disabled"); - cy.get('input[aria-invalid="false"][id=":r0:"][placeholder="0"]').type("10"); + cy.get("#buttonFurther").should("be.disabled"); + + cy.get('div[data-cy="textfield"]').as("textFieldDiv"); + + cy.get("@textFieldDiv").find("input").type("10"); cy.wait(500); - cy.contains("Далее →").should("not.be.disabled"); + cy.get("#buttonFurther").should("not.be.disabled"); cy.visit("http://localhost:3000/view"); cy.visit("http://localhost:3000/edit"); @@ -237,19 +338,23 @@ describe("Форма Входа", () => { cy.wait(5000); cy.get('[data-cy="create-question"]').click(); - //Загрузка файла + + // Загрузка файла + - cy.contains("button", "Загрузка файла").click(); - cy.contains("label", "Необязательный вопрос").click(); + cy.get(`[data-cy="select-questiontype-file"]`).click(); + cy.get( + '[data-cy="checkbox-optional-question"] > .PrivateSwitchBase-input', + ).click(); cy.visit("http://localhost:3000/view"); cy.wait(500); - cy.contains("Далее →").should("be.disabled"); - cy.get('label.MuiButtonBase-root input[type="file"]').attachFile("./image/Bunner.png"); + cy.get("#buttonFurther").should("be.disabled"); + cy.get('label.MuiButtonBase-root input[type="file"]').attachFile( + "../e2e/image/Bunner.png", + ); cy.wait(500); - cy.contains("Далее →").should("not.be.disabled"); + cy.get("#buttonFurther").should("not.be.disabled"); cy.visit("http://localhost:3000/view"); cy.visit("http://localhost:3000/edit"); @@ -262,17 +367,19 @@ describe("Форма Входа", () => { // Рейтинг - cy.contains("button", "Рейтинг").click(); - cy.contains("label", "Необязательный вопрос").click(); + cy.get(`[data-cy="select-questiontype-rating"]`).click(); + cy.get( + '[data-cy="checkbox-optional-question"] > .PrivateSwitchBase-input', + ).click(); cy.visit("http://localhost:3000/view"); cy.wait(500); - cy.contains("Далее →").should("be.disabled"); + cy.get("#buttonFurther").should("be.disabled"); cy.contains("label", "4 Stars").click(); cy.wait(500); - cy.contains("Далее →").should("not.be.disabled"); + cy.get("#buttonFurther").should("not.be.disabled"); cy.visit("http://localhost:3000/view"); cy.visit("http://localhost:3000/edit"); @@ -290,7 +397,7 @@ describe("Форма Входа", () => { cy.get('[data-cy="delete-quiz"]').each(($button) => { cy.wrap($button).click(); cy.wait(500); - cy.contains("button", "Удалить").click(); + cy.get("#deleteButton").click(); }); }); }); diff --git a/cypress/e2e/quizQuestionsFields.cy.ts b/cypress/e2e/quizQuestionsFields.cy.ts new file mode 100644 index 00000000..03d3d2bb --- /dev/null +++ b/cypress/e2e/quizQuestionsFields.cy.ts @@ -0,0 +1,495 @@ +describe("Тестирование полей вопросов", () => { + beforeEach(() => { + cy.visit("http://localhost:3000"); + cy.wait(1000); + cy.contains("Регистрация / Войти").click(); + const login = "valid_user@exammple.com"; + const password = "valid_password"; + + cy.get("#email").type(login); + cy.get("#password").type(password); + cy.get('button[type="submit"]').click(); + }); + + it("Тест на правильность отображения вопросов в превью и тестовом просмотре ", () => { + cy.get('[data-cy="create-quiz"]').click(); + cy.wait(1000); + cy.get('button[data-cy="create-quiz-card"]').eq(0).click(); + cy.wait(1000); + cy.get('button[data-cy="select-quiz-layout-standard"]').click(); + cy.get('input[type="checkbox"]').click(); + + cy.get('[data-cy="setup-questions"]').click(); + + cy.wait(500); + // cy.get('[data-cy="create-question"]').click(); + + cy.get(`[data-cy="select-questiontype-images"]`).click(); + + cy.get( + '[data-cy="checkbox-optional-question"] > .PrivateSwitchBase-input', + ).click(); + + cy.get("#questionTitle").type("Заголовок вопроса"); + + cy.get('[data-cy="quiz-variant-question-answer"]') + .eq(0) + .type("1") + .type("{enter}"); + cy.get('[data-cy="quiz-variant-question-answer"]') + .eq(1) + .should("have.value", "") + .type("2") + .type("{enter}"); + + // превью + cy.get(`button[data-cy="button-preview"]`).click(); + cy.wait(2000); + + cy.get(".MuiTypography-h6") + .should("exist") + .and("have.text", "Заголовок вопроса"); + cy.get(":nth-child(1) > .MuiFormControlLabel-root") + .should("exist") + .and("have.text", "1"); + cy.get(":nth-child(2) > .MuiFormControlLabel-root") + .should("exist") + .and("have.text", "2"); + + cy.get(`button[data-cy="button-preview"]`).click(); + + cy.visit("http://localhost:3000/view"); + cy.wait(2000); + + // проверка введёных значений + cy.get(".MuiTypography-h5") + .should("exist") + .and("have.text", "Заголовок вопроса"); + + cy.get(":nth-child(1) > .MuiFormControlLabel-root") + .should("exist") + .and("have.text", "1"); + cy.get(":nth-child(2) > .MuiFormControlLabel-root") + .should("exist") + .and("have.text", "2"); + + cy.visit("http://localhost:3000/edit"); + + cy.wait(500); + cy.get('[data-cy="delete-question"]').click(); + cy.wait(5000); + cy.get('[data-cy="create-question"]').click(); + + //Варианты ответов + + cy.get(`[data-cy="select-questiontype-variant"]`).click(); + + cy.get( + '[data-cy="checkbox-optional-question"] > .PrivateSwitchBase-input', + ).click(); + + cy.get("#questionTitle").type("Заголовок вопроса"); + + cy.get('[data-cy="quiz-variant-question-answer"]') + .eq(0) + .type("1") + .type("{enter}"); + cy.get('[data-cy="quiz-variant-question-answer"]') + .eq(1) + .should("have.value", "") + .type("2") + .type("{enter}"); + + // превью + cy.get(`button[data-cy="button-preview"]`).click(); + cy.wait(2000); + + cy.get(".MuiTypography-h6") + .should("exist") + .and("have.text", "Заголовок вопроса"); + cy.get(".MuiFormControlLabel-label").contains("1").should("exist"); + cy.get(".MuiFormControlLabel-label").contains("2").should("exist"); + + cy.get(`button[data-cy="button-preview"]`).click(); + + cy.visit("http://localhost:3000/view"); + cy.wait(2000); + + // проверка введёных значений + cy.get(".MuiTypography-h5") + .should("exist") + .and("have.text", "Заголовок вопроса"); + + cy.get(".MuiFormControlLabel-label").contains("1").should("exist"); + cy.get(".MuiFormControlLabel-label").contains("2").should("exist"); + + cy.visit("http://localhost:3000/edit"); + + cy.wait(500); + cy.get('[data-cy="delete-question"]').click(); + cy.wait(5000); + cy.get('[data-cy="create-question"]').click(); + + // Варианты и картинка + + + cy.get(`[data-cy="select-questiontype-varimg"]`).click(); + + cy.get( + '[data-cy="checkbox-optional-question"] > .PrivateSwitchBase-input', + ).click(); + + cy.get("#questionTitle").type("Заголовок вопроса"); + + cy.get('[data-cy="quiz-variant-question-answer"]') + .eq(0) + .type("1") + .type("{enter}"); + cy.get('[data-cy="quiz-variant-question-answer"]') + .eq(1) + .should("have.value", "") + .type("2") + .type("{enter}"); + + // превью + cy.get(`button[data-cy="button-preview"]`).click(); + cy.wait(2000); + + cy.get(".MuiTypography-h6") + .should("exist") + .and("have.text", "Заголовок вопроса"); + cy.get(".MuiFormControlLabel-label").contains("1").should("exist"); + cy.get(".MuiFormControlLabel-label").contains("2").should("exist"); + + cy.get(`button[data-cy="button-preview"]`).click(); + + cy.visit("http://localhost:3000/view"); + cy.wait(2000); + + // проверка введёных значений + cy.get(".MuiTypography-h5") + .should("exist") + .and("have.text", "Заголовок вопроса"); + + cy.get(".MuiFormControlLabel-label").contains("1").should("exist"); + cy.get(".MuiFormControlLabel-label").contains("2").should("exist"); + + cy.visit("http://localhost:3000/edit"); + + cy.wait(500); + cy.get('[data-cy="delete-question"]').click(); + cy.wait(5000); + cy.get('[data-cy="create-question"]').click(); + + //Эмоджи + + + cy.get(`[data-cy="select-questiontype-emoji"]`).click(); + + cy.get( + '[data-cy="checkbox-optional-question"] > .PrivateSwitchBase-input', + ).click(); + + cy.get("#questionTitle").type("Заголовок вопроса"); + + cy.get('[data-cy="quiz-variant-question-answer"]') + .eq(0) + .type("1") + .type("{enter}"); + cy.get('[data-cy="quiz-variant-question-answer"]') + .eq(1) + .should("have.value", "") + .type("2") + .type("{enter}"); + + // превью + cy.get(`button[data-cy="button-preview"]`).click(); + cy.wait(2000); + + cy.get(".MuiTypography-h6") + .should("exist") + .and("have.text", "Заголовок вопроса"); + cy.get(".MuiFormControlLabel-label").contains("1").should("exist"); + cy.get(".MuiFormControlLabel-label").contains("2").should("exist"); + + cy.get(`button[data-cy="button-preview"]`).click(); + + cy.visit("http://localhost:3000/view"); + cy.wait(2000); + + // проверка введёных значений + cy.get(".MuiTypography-h5") + .should("exist") + .and("have.text", "Заголовок вопроса"); + + cy.get(".MuiFormControlLabel-label").contains("1").should("exist"); + cy.get(".MuiFormControlLabel-label").contains("2").should("exist"); + + cy.visit("http://localhost:3000/edit"); + + cy.wait(500); + cy.get('[data-cy="delete-question"]').click(); + cy.wait(5000); + cy.get('[data-cy="create-question"]').click(); + + //Своё поле для ввода + + cy.get(`[data-cy="select-questiontype-text"]`).click(); + + cy.get( + '[data-cy="checkbox-optional-question"] > .PrivateSwitchBase-input', + ).click(); + + cy.get("#questionTitle").type("Заголовок вопроса"); + + cy.get('input[placeholder="Пример ответа"]') + .eq(0) + .type("1") + .type("{enter}"); + + // превью + cy.get(`button[data-cy="button-preview"]`).click(); + cy.wait(2000); + + cy.get(".MuiTypography-h6") + .should("exist") + .and("have.text", "Заголовок вопроса"); + + cy.get('input[placeholder="1"]').should("exist"); + + cy.get(`button[data-cy="button-preview"]`).click(); + + cy.visit("http://localhost:3000/view"); + cy.wait(2000); + + // проверка введёных значений + cy.get(".MuiTypography-h5") + .should("exist") + .and("have.text", "Заголовок вопроса"); + + cy.get('input[placeholder="1"]').should("exist"); + + cy.visit("http://localhost:3000/edit"); + + cy.wait(500); + cy.get('[data-cy="delete-question"]').click(); + cy.wait(5000); + cy.get('[data-cy="create-question"]').click(); + + //Выпадающий список + + + cy.get(`[data-cy="select-questiontype-select"]`).click(); + + cy.get( + '[data-cy="checkbox-optional-question"] > .PrivateSwitchBase-input', + ).click(); + + cy.get("#questionTitle").type("Заголовок вопроса"); + + cy.get('[data-cy="quiz-variant-question-answer"]') + .eq(0) + .type("1") + .type("{enter}"); + cy.get('[data-cy="quiz-variant-question-answer"]') + .eq(1) + .should("have.value", "") + .type("2") + .type("{enter}"); + + // превью + cy.get(`button[data-cy="button-preview"]`).click(); + cy.wait(2000); + + cy.get(".MuiTypography-h6") + .should("exist") + .and("have.text", "Заголовок вопроса"); + + cy.get(".MuiFormControlLabel-label").contains("1").should("exist"); + cy.get(".MuiFormControlLabel-label").contains("2").should("exist"); + + cy.get(`button[data-cy="button-preview"]`).click(); + + cy.visit("http://localhost:3000/view"); + cy.wait(2000); + + // проверка введёных значений + cy.get(".MuiTypography-h5") + .should("exist") + .and("have.text", "Заголовок вопроса"); + + cy.get(".MuiFormControlLabel-label").contains("1").should("exist"); + cy.get(".MuiFormControlLabel-label").contains("2").should("exist"); + + cy.visit("http://localhost:3000/edit"); + + cy.wait(500); + cy.get('[data-cy="delete-question"]').click(); + cy.wait(5000); + cy.get('[data-cy="create-question"]').click(); + + //Дата + + cy.get(`[data-cy="select-questiontype-date"]`).click(); + cy.get( + '[data-cy="checkbox-optional-question"] > .PrivateSwitchBase-input', + ).click(); + + cy.get("#questionTitle").type("Заголовок вопроса"); + + // превью + cy.get(`button[data-cy="button-preview"]`).click(); + cy.wait(2000); + + cy.get(".MuiTypography-h6") + .should("exist") + .and("have.text", "Заголовок вопроса"); + + cy.get(`button[data-cy="button-preview"]`).click(); + + cy.visit("http://localhost:3000/view"); + cy.wait(2000); + + // проверка введёных значений + cy.get(".MuiTypography-h5") + .should("exist") + .and("have.text", "Заголовок вопроса"); + + cy.wait(500); + cy.get('[data-cy="delete-question"]').click(); + cy.wait(5000); + cy.get('[data-cy="create-question"]').click(); + + //Ползунок + + + cy.get(`[data-cy="select-questiontype-number"]`).click(); + cy.get( + '[data-cy="checkbox-optional-question"] > .PrivateSwitchBase-input', + ).click(); + + cy.get("#questionTitle").type("Заголовок вопроса"); + + // превью + cy.get(`button[data-cy="button-preview"]`).click(); + cy.wait(2000); + + cy.get(".MuiTypography-h6") + .should("exist") + .and("have.text", "Заголовок вопроса"); + cy.get(".MuiTypography-p") + .should("exist") + .and("have.text", "Заголовок вопроса"); + + cy.get(`button[data-cy="button-preview"]`).click(); + + cy.visit("http://localhost:3000/view"); + cy.wait(2000); + + // проверка введёных значений + cy.get(".MuiTypography-h5") + .should("exist") + .and("have.text", "Заголовок вопроса"); + + cy.wait(500); + cy.get('[data-cy="delete-question"]').click(); + cy.wait(5000); + cy.get('[data-cy="create-question"]').click(); + + // Загрузка файла + + + cy.get(`[data-cy="select-questiontype-file"]`).click(); + cy.get( + '[data-cy="checkbox-optional-question"] > .PrivateSwitchBase-input', + ).click(); + + cy.get("#questionTitle").type("Заголовок вопроса"); + + // превью + cy.get(`button[data-cy="button-preview"]`).click(); + cy.wait(2000); + + cy.get(".MuiTypography-h6") + .should("exist") + .and("have.text", "Заголовок вопроса"); + + cy.get(`button[data-cy="button-preview"]`).click(); + + cy.visit("http://localhost:3000/view"); + cy.wait(2000); + + // проверка введёных значений + cy.get(".MuiTypography-h5") + .should("exist") + .and("have.text", "Заголовок вопроса"); + + cy.wait(500); + cy.get('[data-cy="delete-question"]').click(); + cy.wait(5000); + cy.get('[data-cy="create-question"]').click(); + + // Страница + + cy.get(`[data-cy="select-questiontype-page"]`).click(); + cy.get( + '[data-cy="checkbox-optional-question"] > .PrivateSwitchBase-input', + ).click(); + + cy.get("#questionTitle").type("Заголовок вопроса"); + cy.get("#addText").type("Добавляю текст"); + + // превью + cy.get(`button[data-cy="button-preview"]`).click(); + cy.wait(2000); + + cy.get(".MuiTypography-h6") + .should("exist") + .and("have.text", "Заголовок вопроса"); + cy.get(".MuiTypography-p") + .should("exist") + .and("have.text", "Добавляю текст"); + + cy.get(`button[data-cy="button-preview"]`).click(); + + cy.visit("http://localhost:3000/view"); + cy.wait(2000); + + // проверка введёных значений + cy.get(".MuiTypography-h5") + .should("exist") + .and("have.text", "Заголовок вопроса"); + cy.get(".MuiTypography-p") + .should("exist") + .and("have.text", "Добавляю текст"); + + cy.wait(500); + cy.get('[data-cy="delete-question"]').click(); + cy.wait(5000); + cy.get('[data-cy="create-question"]').click(); + + // Рейтинг + + cy.get(`[data-cy="select-questiontype-rating"]`).click(); + cy.get( + '[data-cy="checkbox-optional-question"] > .PrivateSwitchBase-input', + ).click(); + + cy.get("#questionTitle").type("Заголовок вопроса"); + + // превью + cy.get(`button[data-cy="button-preview"]`).click(); + cy.wait(2000); + + cy.get(".MuiTypography-h6") + .should("exist") + .and("have.text", "Заголовок вопроса"); + + cy.get(`button[data-cy="button-preview"]`).click(); + + cy.visit("http://localhost:3000/view"); + cy.wait(2000); + + // проверка введёных значений + cy.get(".MuiTypography-h5") + .should("exist") + .and("have.text", "Заголовок вопроса"); + + cy.wait(500); + cy.get('[data-cy="delete-question"]').click(); + cy.wait(5000); + cy.get('[data-cy="create-question"]').click(); + }); +}); diff --git a/src/assets/icons/EcommerceIcon.tsx b/src/assets/icons/EcommerceIcon.tsx new file mode 100644 index 00000000..09827c84 --- /dev/null +++ b/src/assets/icons/EcommerceIcon.tsx @@ -0,0 +1,26 @@ +import { FC, SVGProps } from "react"; + +export const EcommerceIcon: FC> = (props) => ( + + + + +); diff --git a/src/assets/icons/PieСhartIcon.tsx b/src/assets/icons/PieСhartIcon.tsx new file mode 100644 index 00000000..ae1be76a --- /dev/null +++ b/src/assets/icons/PieСhartIcon.tsx @@ -0,0 +1,18 @@ +import { FC, SVGProps } from "react"; + +export const PieСhartIcon: FC> = (props) => ( + + + +); diff --git a/src/assets/icons/SegmentationIcon.tsx b/src/assets/icons/SegmentationIcon.tsx new file mode 100644 index 00000000..d4f69ff3 --- /dev/null +++ b/src/assets/icons/SegmentationIcon.tsx @@ -0,0 +1,45 @@ +import { FC, SVGProps } from "react"; + +export const SegmentationIcon: FC> = (props) => ( + + + + + + + +); diff --git a/src/assets/icons/TestingIcon.tsx b/src/assets/icons/TestingIcon.tsx new file mode 100644 index 00000000..96b18258 --- /dev/null +++ b/src/assets/icons/TestingIcon.tsx @@ -0,0 +1,47 @@ +import { FC, SVGProps } from "react"; + +export const TestingIcon: FC> = (props) => ( + + + + + + + +); diff --git a/src/pages/Landing/DesktopQuizCard.tsx b/src/pages/Landing/DesktopQuizCard.tsx new file mode 100644 index 00000000..1cee68bc --- /dev/null +++ b/src/pages/Landing/DesktopQuizCard.tsx @@ -0,0 +1,89 @@ +import { Box, Fade, Typography } from "@mui/material"; +import { FC } from "react"; + +interface Iprops { + isOpen: boolean; + header: string; + image: string; + text: string; +} + +export const DesktopQuizCard: FC = ({ + isOpen, + header, + image, + text, +}) => { + return ( + + + + + {header} + + + + {text} + + + + + + + + + ); +}; diff --git a/src/pages/Landing/HowToUse.tsx b/src/pages/Landing/HowToUse.tsx index cc7f53bc..4fd99ec1 100644 --- a/src/pages/Landing/HowToUse.tsx +++ b/src/pages/Landing/HowToUse.tsx @@ -1,11 +1,14 @@ -import React from "react"; +import React, { useState } from "react"; import Box from "@mui/material/Box"; -import { Typography, useMediaQuery, useTheme } from "@mui/material"; +import { Fade, Typography, Zoom, useMediaQuery, useTheme } from "@mui/material"; import SectionStyled from "./SectionStyled"; import Link from "@mui/material/Link"; import { styled } from "@mui/material/styles"; import Notebook from "../../assets/LandingPict/notebook"; import BigBlock from "./images/bigblock.png"; +import businessTasks2 from "./images/businessTasks2.png"; +import businessTasks3 from "./images/businessTasks3.png"; +import businessTasks4 from "./images/businessTasks4.png"; import Button from "@mui/material/Button"; // import Note from './image/note.png' import ArrowBackIcon from "@mui/icons-material/ArrowBack"; @@ -13,6 +16,12 @@ import ArrowForwardIcon from "@mui/icons-material/ArrowForward"; // import CalendarW from './image/calendar-W.svg' // import CalendarP from './image/calendar-P.svg' import CalendarIcon from "../../assets/LandingPict/calendarIcon"; +import { PieСhartIcon } from "@icons/PieСhartIcon"; +import { SegmentationIcon } from "@icons/SegmentationIcon"; +import { TestingIcon } from "@icons/TestingIcon"; +import { EcommerceIcon } from "@icons/EcommerceIcon"; +import { DesktopQuizCard } from "./DesktopQuizCard"; +import { MobileQuizCard } from "./MobileQuizCard"; // const BoxUse = styled('div')(({ theme }) => ({ // [theme.breakpoints.down('md')]: { @@ -35,6 +44,32 @@ const BoxQuiz = styled("div")(({ theme }) => ({ }, })); +const businessTasks = { + research: { + header: "Исследуйте аудиторию и проверяйте гипотезы", + text: "Опросник помогает проверять гипотезы и принимать грамотные решения основанные на данных. Создавайте опросы, собирайте обратную связь и анализируйте ответы в удобной аналитике в личном кабинете. ", + image: BigBlock, + }, + segmentation: { + header: + "Лучше узнайте свою аудиторию, сегментируйте и собирайте заявки с помощью квиза", + text: "Квиз легко создать самому за 10 минут: настроить логику вопросов, результаты и получить готовую ссылку.", + image: businessTasks2, + }, + testing: { + header: + "Создавайте интерактивные тесты, показывайте правильные и неправильные ответы", + text: "Тест в игровой форме увеличит вовлеченность пользователей. Создать его легко: задайте вопрос и отметьте правильные варианты ответов.", + image: businessTasks3, + }, + eсommerce: { + header: + "Консультируйте клиентов по ассортименту и помогите определиться с выбором", + text: "Тест в игровой форме увеличит вовлеченность пользователей. Создать его легко: задайте вопрос и отметьте правильные варианты ответов.", + image: businessTasks4, + }, +}; + function Quiz() { return ( ("research"); + const [open, setOpen] = useState(false); return ( - {/**/} - {/* */} - {/* */} - {/* Исследования*/} - {/* */} - {/* */} - {/* */} - {/* Сегментация*/} - {/* */} - {/* */} - {/* */} - {/* Тестирование*/} - {/* */} - {/* */} - {/* */} - {/* E-commerce*/} - {/* */} - {/**/} - + {!isTablet && ( + + + + + + + )} + + {isTablet ? ( - - Исследуйте аудиторию и проверяйте гипотезы - - - - Опросник помогает проверять гипотезы и принимать грамотные - решения основанные на данных. Создавайте опросы, собирайте - обратную связь и анализируйте ответы в удобной аналитике в - личном кабинете. - - - - - + } + /> + + + } + /> + + } + /> + + } /> - + ) : ( + <> + + + + + + + + + )} ); diff --git a/src/pages/Landing/MobileQuizCard.tsx b/src/pages/Landing/MobileQuizCard.tsx new file mode 100644 index 00000000..d72f0cfe --- /dev/null +++ b/src/pages/Landing/MobileQuizCard.tsx @@ -0,0 +1,131 @@ +import { + Box, + Slide, + Typography, + useMediaQuery, + useTheme, + Zoom, +} from "@mui/material"; +import { FC, ReactNode, useRef, useState } from "react"; + +interface Iprops { + header: string; + image: string; + text: string; + textIcon: string; + icon: ReactNode; +} + +export const MobileQuizCard: FC = ({ + header, + image, + text, + icon, + textIcon, +}) => { + const [isOpen, setIsOpen] = useState(false); + const containerRef = useRef(null); + const theme = useTheme(); + const isMobile = useMediaQuery(theme.breakpoints.down(600)); + + const handleChange = () => { + setIsOpen((prev) => !prev); + }; + + return ( + + + + {icon} + + {textIcon} + + {isOpen && ( + + + + {header} + + + + {text} + + + + + + + + )} + + ); +}; diff --git a/src/pages/Landing/WhatTheFeatures.tsx b/src/pages/Landing/WhatTheFeatures.tsx index 1476d47c..83906b75 100644 --- a/src/pages/Landing/WhatTheFeatures.tsx +++ b/src/pages/Landing/WhatTheFeatures.tsx @@ -11,10 +11,12 @@ import Desktop4 from "./images/Frame 1171274552-3.png"; import Desktop5 from "./images/Frame 1171274552-4.png"; import Desktop6 from "./images/Frame 1171274552-5.png"; import Desktop7 from "./images/Frame 1171274552-6.png"; +import LandingImg from "./images/LandingImg.png"; interface Props { children: React.ReactNode; image: string; + sx?: SxProps; } function BoxFich(props: Props) { @@ -33,6 +35,7 @@ function BoxFich(props: Props) { flexDirection: "column", justifyContent: isMobile ? "space-between" : undefined, height: isMobile ? "450px" : undefined, + ...props.sx, }} > @@ -129,6 +133,7 @@ export default function Component() { diff --git a/src/pages/Questions/DropDown/settingDropDown.tsx b/src/pages/Questions/DropDown/settingDropDown.tsx index 1f9c0f1f..0a9def0e 100644 --- a/src/pages/Questions/DropDown/settingDropDown.tsx +++ b/src/pages/Questions/DropDown/settingDropDown.tsx @@ -126,6 +126,7 @@ export default function SettingDropDown({ question }: SettingDropDownProps) { Настройки вопросов { diff --git a/src/pages/Questions/Emoji/settingEmoji.tsx b/src/pages/Questions/Emoji/settingEmoji.tsx index 3667175c..24de22c9 100644 --- a/src/pages/Questions/Emoji/settingEmoji.tsx +++ b/src/pages/Questions/Emoji/settingEmoji.tsx @@ -95,6 +95,7 @@ export default function SettingEmoji({ question }: SettingEmojiProps) { Настройки вопросов */} setText(target.value)} diff --git a/src/pages/Questions/RatingOptions/settingRating.tsx b/src/pages/Questions/RatingOptions/settingRating.tsx index 33a22238..19e3367b 100644 --- a/src/pages/Questions/RatingOptions/settingRating.tsx +++ b/src/pages/Questions/RatingOptions/settingRating.tsx @@ -167,6 +167,7 @@ export default function SettingSlider({ question }: SettingSliderProps) { Настройки вопросов */} { mb: "19px", }} > - + diff --git a/src/pages/ResultPage/cards/EmailSettingsCard.tsx b/src/pages/ResultPage/cards/EmailSettingsCard.tsx index caa4b61b..2840a16b 100644 --- a/src/pages/ResultPage/cards/EmailSettingsCard.tsx +++ b/src/pages/ResultPage/cards/EmailSettingsCard.tsx @@ -119,6 +119,7 @@ export const EmailSettingsCard = ({ quizExpand }: Props) => { Тема письма { diff --git a/src/pages/ViewPublicationPage/Footer.tsx b/src/pages/ViewPublicationPage/Footer.tsx index 5ab70fc3..cb6781cb 100644 --- a/src/pages/ViewPublicationPage/Footer.tsx +++ b/src/pages/ViewPublicationPage/Footer.tsx @@ -375,6 +375,7 @@ export const Footer = ({ {isMobileMini ? "←" : "← Назад"} -