Added text check

This commit is contained in:
2024-10-03 14:04:49 -07:00
parent 10ffc73fcf
commit 323b6ea094

View File

@@ -13,16 +13,24 @@ const ExACT_landingPage = (req, res) => {
let worksheet;
const startTime = new Date().toISOString();
//Text to be verified
const expectedText = 'Empowering publishers with the ability to correlate their unique content to standards.';
const steps = [
{ description: 'Navigate to ExACT Landing Page', action: async () => await driver.navigate().to('https://stage.edgate.com/exact/login.php') }, //PROD - https://correlation.edgate.com/exact/login.php
{ description: 'Expand browser', action: async () => await driver.manage().window().maximize() },
//Descriptive text 1
{ description: 'Wait for descriptive text 1 to be present', action: async () => await driver.wait(until.elementLocated(By.css('h2:nth-child(1)')), 5000) },
//{ description: 'Validate descriptive text 1', action: async () => await until.elementTextIs(By.css('h2:nth-child(1)', "WTF Let's start with the basics.")) },
//{ description: 'Validate descriptive text 1', action: elementTextIs(By.css('h2:nth-child(1)', "Empowering publishers with the ability to correlate their unique content to standards."))},
//{ String actualText = driver.findElement(By.css('h2:nth-child(1)')).getAttribute("value")},
//{ description: 'Validate descriptive text 1', action: async () => await driver.findElement(By.css('h2:nth-child(1)'), "wtf") },
{ description: 'Validate descriptive text 1', action: async () =>
{ const elementTitle = await driver.findElement(By.css('h2:nth-child(1)')).getText();
if (elementTitle === expectedText)
{console.log('Title matched as expected, Passed');}
else
{console.log(`Title text match FAILED, Expected: "${expectedText}", but found "${elementTitle}"`);}
}
},
/*
{ description: 'Enter username', action: async () => await driver.findElement(By.id('txtU')).sendKeys('gnight147', Key.RETURN) },
@@ -94,6 +102,15 @@ const ExACT_landingPage = (req, res) => {
console.log('Login button not found');
}
const freeTialButton = await driver.wait(until.elementLocated(By.css('.btn > span')), 5000).catch(() => false);
if (freeTialButton) {
console.log('Free Trial button present');
testStatus = 'Passed';
} else {
console.log('Free Trial button not found');
}
// Log test end time
const endTime = new Date().toISOString();
worksheet = logStep(worksheet, 'Test End', 'Ended', '', endTime, '');