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

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-darsow committed Nov 27, 2023
1 parent 90b53f1 commit a951b50
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 33 deletions.
56 changes: 28 additions & 28 deletions page-objects/pages/NWSAddEditNewsPage.js
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
/*[url/news/[newsId]/edit] | [url/news/[newsId]/new]*/
'use strict';
const elementHelpers = require('../../runtime/helpers/elementHelpers');
const newsListPage = require('./NWSNewsListPage');
const newsListPage= require('./NWSNewsListPage');
const waitHelpers = require('../../runtime/helpers/waitHelpers');
const submitNewsBtn = '[data-testid="btn_news_submit"]';
const addNewsBtn = "[data-testid='create-news-btn']";
const titleField = 'input.h1';
const contentField = '.ck-editor [contenteditable="true"]';
const dateTimeSelector = '[data-testid="news_date"] input';
const dateTimeSelector = '[data-testid="news_date"] input'

async function goToNewNews() {
await newsListPage.goToNews();
await clickCreateNewsButton();
async function goToNewNews () {
await newsListPage.goToNews();
await clickCreateNewsButton();
}

async function setNewsTitle(newsTitle) {
await waitHelpers.waitAndSetValue(titleField, newsTitle);
async function setNewsTitle (newsTitle) {
await waitHelpers.waitAndSetValue(titleField, newsTitle);
}

async function setNewsContent(newsContent) {
await elementHelpers.click(contentField);
await waitHelpers.waitAndSetValue(contentField, newsContent, 1000);
async function setNewsContent (newsContent) {
await elementHelpers.click(contentField);
await waitHelpers.waitAndSetValue(contentField, newsContent, 1000);
}

async function setNewsPublishDate(newsDate) {
await waitHelpers.waitAndSetValue(dateTimeSelector, newsDate);
async function setNewsPublishDate (newsDate) {
await waitHelpers.waitAndSetValue(dateTimeSelector, newsDate);
}

async function setNewsPublishTime(newsTime) {
await waitHelpers.waitAndSetValue(dateTimeSelector, newsTime);
async function setNewsPublishTime (newsTime) {
await waitHelpers.waitAndSetValue(dateTimeSelector, newsTime);
}

async function clickCreateNewsButton() {
await elementHelpers.clickAndWait(addNewsBtn);
async function clickCreateNewsButton () {
await elementHelpers.clickAndWait(addNewsBtn);
}

async function clickCreateNewsConfirmationButton() {
await elementHelpers.clickAndWait(submitNewsBtn);
async function clickCreateNewsConfirmationButton () {
await elementHelpers.clickAndWait(submitNewsBtn);
}

async function createNews({ newsTitle, newsContent, date, time }) {
await goToNewNews();
if (newsTitle) await setNewsTitle(newsTitle);
if (newsContent) await setNewsContent(newsContent);
if (date) await setNewsPublishDate(date);
if (time) await setNewsPublishTime(time);
await clickCreateNewsConfirmationButton();
async function createNews ({ newsTitle, newsContent, date, time}) {
await goToNewNews();
if (newsTitle) await setNewsTitle(newsTitle);
if (newsContent) await setNewsContent(newsContent);
if (date) await setNewsPublishDate(date);
if (time) await setNewsPublishTime(time);
await clickCreateNewsConfirmationButton();
}

module.exports = {
goToNewNews,
createNews,
};
goToNewNews,
createNews,
}
10 changes: 5 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

0 comments on commit a951b50

Please sign in to comment.