mirror of
https://dev.azure.com/Foster-X/CMP329%20CW2/_git/CMP329%20CW2
synced 2025-07-27 05:53:32 +00:00
Upgraded to work with CSV file source
This commit is contained in:
parent
d855f06446
commit
197081a55e
2 changed files with 6 additions and 5 deletions
2
src/csv/all_login_credentials.csv
Normal file
2
src/csv/all_login_credentials.csv
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
testuser,QUBsucks&UUisBetter
|
||||||
|
subscriber,drewapicture(incrediblyfunnyjoke!)
|
|
|
@ -5,7 +5,7 @@ import org.openqa.selenium.WebDriver;
|
||||||
import org.openqa.selenium.WebElement;
|
import org.openqa.selenium.WebElement;
|
||||||
import org.openqa.selenium.By;
|
import org.openqa.selenium.By;
|
||||||
import org.junit.jupiter.params.ParameterizedTest;
|
import org.junit.jupiter.params.ParameterizedTest;
|
||||||
import org.junit.jupiter.params.provider.CsvSource;
|
import org.junit.jupiter.params.provider.CsvFileSource;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
public class TestLogin {
|
public class TestLogin {
|
||||||
|
@ -16,10 +16,8 @@ public class TestLogin {
|
||||||
private static final String EXPECTED_URL = "https://test.fusil.uk/wp-admin/";
|
private static final String EXPECTED_URL = "https://test.fusil.uk/wp-admin/";
|
||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
@CsvSource({
|
@CsvFileSource(resources = "/csv/all_login_credentials.csv", numLinesToSkip = 0)
|
||||||
"testuser, QUBsucks&UUisBetter",
|
|
||||||
"subscriber, drewapicture(incrediblyfunnyjoke!)"
|
|
||||||
})
|
|
||||||
void testLogin(String usernameText, String passwordText) {
|
void testLogin(String usernameText, String passwordText) {
|
||||||
WebDriver driver = ConfigureDriver.configureDriver();
|
WebDriver driver = ConfigureDriver.configureDriver();
|
||||||
driver.manage().window().maximize();
|
driver.manage().window().maximize();
|
||||||
|
@ -30,6 +28,7 @@ public class TestLogin {
|
||||||
WebElement login = driver.findElement(By.id(LOGIN_BUTTON_ID));
|
WebElement login = driver.findElement(By.id(LOGIN_BUTTON_ID));
|
||||||
|
|
||||||
username.sendKeys(usernameText);
|
username.sendKeys(usernameText);
|
||||||
|
System.out.println("Testing "+usernameText);
|
||||||
password.sendKeys(passwordText);
|
password.sendKeys(passwordText);
|
||||||
login.click();
|
login.click();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue