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.By;
|
||||
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;
|
||||
|
||||
public class TestLogin {
|
||||
|
@ -16,10 +16,8 @@ public class TestLogin {
|
|||
private static final String EXPECTED_URL = "https://test.fusil.uk/wp-admin/";
|
||||
|
||||
@ParameterizedTest
|
||||
@CsvSource({
|
||||
"testuser, QUBsucks&UUisBetter",
|
||||
"subscriber, drewapicture(incrediblyfunnyjoke!)"
|
||||
})
|
||||
@CsvFileSource(resources = "/csv/all_login_credentials.csv", numLinesToSkip = 0)
|
||||
|
||||
void testLogin(String usernameText, String passwordText) {
|
||||
WebDriver driver = ConfigureDriver.configureDriver();
|
||||
driver.manage().window().maximize();
|
||||
|
@ -30,6 +28,7 @@ public class TestLogin {
|
|||
WebElement login = driver.findElement(By.id(LOGIN_BUTTON_ID));
|
||||
|
||||
username.sendKeys(usernameText);
|
||||
System.out.println("Testing "+usernameText);
|
||||
password.sendKeys(passwordText);
|
||||
login.click();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue