Skip to content
This repository has been archived by the owner on Sep 3, 2024. It is now read-only.

Commit

Permalink
Add wait function
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-darsow committed Nov 27, 2023
1 parent 25cfd41 commit fc9a100
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions page-objects/pages/NWSAddEditNewsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ async function setNewsTitle(newsTitle) {
async function setNewsContent(newsContent) {
await elementHelpers.click(contentField);
await waitHelpers.waitAndSetValue(contentField, newsContent);
await waitHelpers.wait(1000);
}

async function setNewsPublishDate(newsDate) {
Expand Down
15 changes: 10 additions & 5 deletions runtime/helpers/waitHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ const titleTimeout = 30000;
const shortInterval = 50;
const mediumInterval = 100;
const pageLoadLegacy = "//dl[@role='navigation']";
const pageLoaded = "div.topbar";
const pageNotLoaded = "div#nuxt-loading";
const pageLoaded = 'div.topbar';
const pageNotLoaded = 'div#nuxt-loading';

async function waitUntilElementIsPresent(selectorOrElement, timeout = elementIsPresentTimeout) {
let element = await sharedHelpers.getElement(selectorOrElement);
Expand Down Expand Up @@ -203,11 +203,11 @@ async function waitUntilNuxtClientLoads(timeout = pageLoadingTimeout) {
await waitUntilPageLoads();
while (!nuxtPageLoad) {
await waitUntilElementIsNotPresent(pageNotLoaded);
if (await waitUntilElementIsPresent(pageLoaded)){
if (await waitUntilElementIsPresent(pageLoaded)) {
nuxtPageLoad = true;
}else {
} else {
await driver.refresh();
if(await waitUntilElementIsPresent(pageLoaded)){
if (await waitUntilElementIsPresent(pageLoaded)) {
nuxtPageLoad = true;
}
}
Expand Down Expand Up @@ -333,6 +333,10 @@ async function waitUntilPageTitleEquals(expectedTitle, timeout = titleTimeout) {
}
}

async function wait(timeout = setValueTimeout) {
await driver.pause(timeout);
}

module.exports = {
waitUntilElementIsPresent,
waitUntilElementIsNotPresent,
Expand All @@ -354,4 +358,5 @@ module.exports = {
waitUntilPageTitleContains,
waitUntilPageTitleEquals,
waitUntilNuxtClientLoads,
wait,
};

0 comments on commit fc9a100

Please sign in to comment.