From 6b8b6dcf893c486bb173aab9dedf45732a86d57b Mon Sep 17 00:00:00 2001 From: Pelayori <31128562+Pelayori@users.noreply.github.com> Date: Fri, 26 Apr 2024 17:06:32 +0200 Subject: [PATCH] Question management integration tests --- src/test/java/com/uniovi/steps/AdminTasksStep.java | 7 +++++++ src/test/resources/features/Admin.feature | 13 ++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/test/java/com/uniovi/steps/AdminTasksStep.java b/src/test/java/com/uniovi/steps/AdminTasksStep.java index 128f70ad..3a678162 100644 --- a/src/test/java/com/uniovi/steps/AdminTasksStep.java +++ b/src/test/java/com/uniovi/steps/AdminTasksStep.java @@ -5,6 +5,7 @@ import com.uniovi.util.SeleniumUtils; import io.cucumber.java.en.And; import io.cucumber.java.en.Then; +import io.cucumber.java.en.When; import org.junit.jupiter.api.Assertions; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -83,4 +84,10 @@ public void iClickButtonForUser(String btn, String user) { public void iShouldNotSeeTheText(String text) { SeleniumUtils.waitInvisibleElement(driver, By.xpath("//*[contains(text(),'" + text + "')]"), 5); } + + @When("I click question management button") + public void iClickQuestionManagementButton() { + List elems = SeleniumUtils.waitLoadElements(driver, By.id("tab2-tab"), 5); + elems.get(0).click(); + } } diff --git a/src/test/resources/features/Admin.feature b/src/test/resources/features/Admin.feature index 4a52685c..e83ed0b8 100644 --- a/src/test/resources/features/Admin.feature +++ b/src/test/resources/features/Admin.feature @@ -56,4 +56,15 @@ Feature: I do admin tasks And I click "admin.user.delete" button for user "user1" And I should see the modal dialog "admin.user.delete.title" And I click "deleteModalConfirm" button - Then I should not see the text "user1" \ No newline at end of file + Then I should not see the text "user1" + + Scenario: I save question JSON + Given I am in the home page + When I click the login button + And I fill in the form with valid data email: "test" password: "test" + And I press the login button + Then I should see the admin zone button + And I enter the admin zone + And I should see the message "navbar.section.admin" + When I click question management button + Then I click "saveButton" button \ No newline at end of file