<commit_before>package org.jtalks.tests.jcommune.tests.post;

import org.jtalks.tests.jcommune.pages.PostPage;
import org.openqa.selenium.By;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
import utils.StringHelp;

import static org.jtalks.tests.jcommune.common.JCommuneSeleniumTest.*;
import static org.testng.Assert.assertEquals;

/**
 * @autor masyan
 * @autor erik
 */
public class JC18CancelButtonOnDeleteAnswerWindow {

	String answer = StringHelp.getRandomString(20);

	PostPage postPage;

	@BeforeMethod
	@Parameters({"app-url", "uUsername", "uPassword"})
	public void setupCase(String appUrl, String username, String password) {
		driver.get(appUrl);
		signIn(username, password);
		clickOnRandomBranch();
		createTopicForTest();
		createAnswerForTest(this.answer);
		postPage = new PostPage();
		postPage.init(driver);
	}

	@AfterMethod
	@Parameters({"app-url"})
	public void destroy(String appUrl) {
		logOut(appUrl);
	}

	@Test
	public void cancelButtonOnDeleteAnswerWindowTest() {
		//step 1
		postPage.getDeleteButtonNearLastPost().click();
		driver.findElement(By.id("jqi_state0_buttonCancel")).click();

		//step2
		String lastMessageText = postPage.getLastPostMessage().getText();

		assertEquals(lastMessageText, this.answer);

	}
}<commit_msg>#JC-354<commit_after>package org.jtalks.tests.jcommune.tests.post;

import org.jtalks.tests.jcommune.pages.PostPage;
import org.openqa.selenium.By;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
import utils.StringHelp;

import static org.jtalks.tests.jcommune.common.JCommuneSeleniumTest.*;
import static org.testng.Assert.assertEquals;

/**
 * @autor masyan
 * @autor erik
 */
public class JC18CancelButtonOnDeleteAnswerWindow {

	String answer = StringHelp.getRandomString(20);

	PostPage postPage;

	@BeforeMethod
	@Parameters({"app-url", "uUsername", "uPassword"})
	public void setupCase(String appUrl, String username, String password) {
		driver.get(appUrl);
		signIn(username, password);
		clickOnRandomBranch();
		createTopicForTest();
		createAnswerForTest(this.answer);
		postPage = new PostPage();
		postPage.init(driver);
	}

	@AfterMethod
	@Parameters({"app-url"})
	public void destroy(String appUrl) {
		logOut(appUrl);
	}

	@Test
	public void cancelButtonOnDeleteAnswerWindowTest() {
		//step 1
		postPage.getDeleteButtonNearLastPost().click();
		postPage.getDeleteConfirmCancelButton().click();

		//step2
		String lastMessageText = postPage.getLastPostMessage().getText();

		assertEquals(lastMessageText, this.answer);

	}
}
{'fraction_non_alphanumeric': 0.12294782925939438, 'fraction_numerical': 0.005837285662167092, 'mean_word_length': 5.803970223325062, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1470566', 'n_tokens_mistral': 942, 'n_tokens_neox': 880, 'n_words': 154}