Skip to content

Commit

Permalink
Fix E2E tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack-Dane committed Aug 18, 2024
1 parent 8206b85 commit 8f62fb4
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions tests/end_to_end_tests/tests/selenium_tests/Error_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,27 @@ public function test_broken_connection_alert()
$test_button->click();
sleep(2);

$expected_error_message = "{\"success\":false,\"error_string\":\"Username or API Key is incorrect\",\"error_code\":0}";
$elements = $this->wait_for_elements(
$this->wait_for_elements(
WebDriverBy::xpath(
"//p[contains(text(), '$expected_error_message')]"
"//h1[contains(text(), 'Test Result: Failure')]"
)
);
$this->assertCount(1, $elements);
$this->driver->findElement(
WebDriverBy::xpath("//b[contains(text(), 'Error Message: ')]")
);
$this->driver->findElement(
WebDriverBy::xpath("//span[contains(text(), 'Username or API Key is incorrect')]")
);
$this->driver->findElement(
WebDriverBy::xpath("//b[contains(text(), 'Error Code: ')]")
);
$this->driver->findElement(
WebDriverBy::xpath("//span[contains(text(), '0')]")
);

// to make the test not appear to be 'risky' as it hasn't made any assertions.
// findElement will raise an exception if the test fails.
$this->assertTrue(true);
}

public function test_broken_send_data()
Expand Down

0 comments on commit 8f62fb4

Please sign in to comment.