fix
This commit is contained in:
parent
d88fad5cb8
commit
237e693678
153
cypress/e2e/quizResultsPage.cy.ts
Normal file
153
cypress/e2e/quizResultsPage.cy.ts
Normal file
@ -0,0 +1,153 @@
|
||||
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"]').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="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");
|
||||
|
||||
cy.get('[data-cy="next-step"]').click();
|
||||
|
||||
//проверяем все поля на пустоту страницы результата
|
||||
|
||||
cy.get(`[data-cy="expand-question"]`).eq(0).click();
|
||||
cy.wait(200);
|
||||
cy.get("#after-the-contact-form").click();
|
||||
|
||||
cy.get("#heading-result").should("have.value", "");
|
||||
cy.get("#headline-is-bolder").should("have.value", "");
|
||||
cy.get("#heading-description").should("have.value", "");
|
||||
|
||||
cy.get(`[data-cy="add-button"]`).click();
|
||||
cy.wait(200);
|
||||
cy.get("#button-text-result").should("have.value", "");
|
||||
cy.get("#link-page-result").should("have.value", "");
|
||||
|
||||
//перемещаемся на странице тестового просмотра
|
||||
|
||||
cy.visit("http://localhost:3000/view");
|
||||
|
||||
cy.get(".MuiFormControlLabel-label").contains("1").click();
|
||||
cy.get("#buttonFurther").click();
|
||||
cy.wait(1000);
|
||||
|
||||
cy.get("#name-input").type("Name");
|
||||
cy.get("#email-input").type("valid_user@exammple.com");
|
||||
cy.get("#phone-input").type("+2682585");
|
||||
|
||||
cy.get('input[type="checkbox"]').click();
|
||||
cy.wait(200);
|
||||
cy.get("#get-results").click();
|
||||
|
||||
//проверяем что страница результатов не отобразилась
|
||||
|
||||
cy.wait(2000);
|
||||
cy.get("#find-out-more-button").should("not.exist");
|
||||
|
||||
//поселе чего заполняем все поля в результате
|
||||
|
||||
cy.visit("http://localhost:3000/edit");
|
||||
|
||||
cy.get("#heading-result").type("Результат");
|
||||
cy.get("#headline-is-bolder").type("Заголовок пожирнее");
|
||||
cy.get("#heading-description").type("Описание обычного заголовка");
|
||||
cy.get(`[data-cy="add-button"]`).click();
|
||||
cy.wait(200);
|
||||
cy.get("#button-text-result").type("Узнать подробнее");
|
||||
|
||||
//переходим на страницу тестового просмотра
|
||||
|
||||
cy.visit("http://localhost:3000/view");
|
||||
|
||||
cy.get(".MuiFormControlLabel-label").contains("1").click();
|
||||
cy.get("#buttonFurther").click();
|
||||
cy.wait(1000);
|
||||
|
||||
cy.get("#name-input").type("Name");
|
||||
cy.get("#email-input").type("valid_user@exammple.com");
|
||||
cy.get("#phone-input").type("+2682585");
|
||||
|
||||
cy.get('input[type="checkbox"]').click();
|
||||
cy.wait(200);
|
||||
cy.get("#get-results").click();
|
||||
cy.wait(2000);
|
||||
cy.contains("p", "Заголовок пожирнее").should("exist");
|
||||
|
||||
//Переключаем показывания результата до формы контактов
|
||||
cy.visit("http://localhost:3000/edit");
|
||||
|
||||
cy.get(`[data-cy="expand-question"]`).eq(0).click();
|
||||
cy.wait(200);
|
||||
cy.get("#before-contact-form").click();
|
||||
cy.wait(2000);
|
||||
|
||||
cy.visit("http://localhost:3000/view");
|
||||
cy.get(".MuiFormControlLabel-label").contains("1").click();
|
||||
cy.get("#buttonFurther").click();
|
||||
cy.wait(2000);
|
||||
cy.contains("p", "Заголовок пожирнее").should("exist");
|
||||
|
||||
//тоже самое тольок теперь очищаем поля формы результатов
|
||||
cy.visit("http://localhost:3000/edit");
|
||||
cy.get("#heading-result").clear();
|
||||
cy.get("#headline-is-bolder").clear();
|
||||
cy.get("#heading-description").clear();
|
||||
cy.get("#button-text-result").clear();
|
||||
|
||||
cy.visit("http://localhost:3000/view");
|
||||
|
||||
cy.get(".MuiFormControlLabel-label").contains("1").click();
|
||||
cy.get("#buttonFurther").click();
|
||||
cy.wait(2000);
|
||||
cy.get("#find-out-more-button").should("not.exist");
|
||||
|
||||
// let linkText;
|
||||
|
||||
// cy.get('[data-cy="link-test"]')
|
||||
// .invoke("text")
|
||||
// .then((text) => {
|
||||
// linkText = text;
|
||||
// });
|
||||
|
||||
// cy.wait(2000).then(() => {
|
||||
// cy.visit(linkText);
|
||||
// });
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user