Skip to content

Commit

Permalink
Add step definition when I wait the page until is loaded #176
Browse files Browse the repository at this point in the history
  • Loading branch information
TasneemNatshah committed Dec 28, 2024
1 parent 6c79899 commit 153a944
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 0 deletions.
47 changes: 47 additions & 0 deletions examples/test--when-i-wait-page-until-is-loaded.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!DOCTYPE html>
<html>

<head>
<meta charset='utf-8'>
<title>I wait page until is loaded</title>
<style>
.container,
.container input,
.container button {
font-size: 26px;
}

.style {
font-size: 22px;
line-height: 30px;
}

#complete{
font-size: 32px;
line-height: 30px;
}

</style>

</head>

<body>
<h1>Waiting for the page to load</h1>
<div id="complete">

</div>

<div id="container">

</div>
</body>

<script>

for(var i=0; i<2000; i++){
document.getElementById("container").innerHTML += '<p class="style">' + i + '</p>';
}
document.getElementById("complete").innerHTML += "The waiting process was completed successfully.";

</script>
</html>
9 changes: 9 additions & 0 deletions tests/features/test--when--i-wait-page-is-loaded.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Feature: An example test to wait until the page is loaded.

As a tester,
I want to make sure that I can wait until a page is loaded.

Scenario: Check waiting for the page to load.
Given I am on "/test--when-i-wait-page-until-is-loaded.html"
And I wait until the page loaded
Then I should see "The waiting process was completed successfully."
8 changes: 8 additions & 0 deletions tests/step-definitions/webship.js
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,14 @@ When(/^(I|we)* wait max of (\d*) minute(s)*$/, function (pronoundCase, number, w
return browser.waitForElementPresent('body', waitTime);
});

/**
* Wait until the page is loaded.
* Example: When I wait until the page is loaded
*
*/
When(/^(I|we)* wait until the page( is)* loaded*$/, function (pronoundCase, withIs) {
return browser.waitForElementPresent('body', 10000);
});
/**
* Checks, that the current page response status is equal the specified code
* Example: Then the response status code should be 200
Expand Down

0 comments on commit 153a944

Please sign in to comment.