Files
EdGateAutomatedRegression/tests/ExACT_dashboardMyContent.js
2025-02-13 15:10:04 -08:00

2743 lines
114 KiB
JavaScript

import { Builder, By, Key, until } from 'selenium-webdriver';
import fs from 'fs';
import XLSX from 'xlsx';
import path from 'path';
const ExACT_dashboardMyContent = (req, res) => {
res.send('<h2>ExACT Automated Test Script - Dashboard - My Content widget: Initiated</h2>');
(async function example() {
let driver = await new Builder().forBrowser('chrome').build();
let testStatus = 'Failed';
let workbook;
let worksheet;
const startTime = new Date().toISOString();
//Constants
const createContentSetName = 'Automated - QA Content Set - To be deleted';
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() },
//LOGIN
{ description: 'Enter username', action: async () => await driver.findElement(By.css('.form-control:nth-child(2)')).sendKeys('exact_juan') },
{ description: 'Enter password', action: async () => await driver.findElement(By.css('.passfield')).sendKeys('Edgate1!') },
{ description: 'Click Login button', action: async () => await driver.findElement(By.css('.login')).click() },
{ description: 'Wait for login process to complete', action: async () => await driver.sleep(10000) },
//Wait for dashboard to load - Correlation Coverages View Details button
{
description: 'Wait for dashboard load to completely',
action: async () => {
return await driver.wait(until.elementLocated(By.linkText('View Details')), 10000).catch(() => false);
}
},
//Dashboard title
{
description: 'Validate dashboard title',
action: async () => {
const elementText = await driver.findElement(By.css('.e-heading')).getText();
if (elementText !== 'Correlation Dashboard') {
throw new Error(`Expected: "Correlation Dashboard"; Actual: "${elementText}"`);
}
console.log('Passed: Dashboard title matched as expected');
}
},
//Dashboard title text color -dark blue
{
description: 'Validate dashboard title text color',
action: async () => {
const elementStyle = await driver.findElement(By.css('.e-heading')).getCssValue('color');
if (elementStyle !== 'rgba(40, 39, 90, 1)') {
throw new Error(`Expected: Dashboard title text color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Dashboard title text color matched as expected');
}
},
//Dashboard title text font size
{
description: 'Validate dashboard title text font size',
action: async () => {
const elementStyle = await driver.findElement(By.css('.e-heading')).getCssValue('font-size');
if (elementStyle !== '32px') {
throw new Error(`Expected: Dashboard title text font-size did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Dashboard title text font-size matched as expected');
}
},
//MY CONTENT WIDGET
//Dashboard My Content Widget title
{
description: 'Validate dashboard My Content widget title',
action: async () => {
const elementText = await driver.findElement(By.css('.h-100 h2:nth-child(2)')).getText();
if (elementText !== 'My Content') {
throw new Error(`Expected: "My Content"; Actual: "${elementText}"`);
}
console.log('Passed: Dashboard - My Content Widget title matched as expected');
}
},
//Dashboard My Content Widget title text color -dark blue
{
description: 'Validate dashboard My Content widget title text color',
action: async () => {
const elementStyle = await driver.findElement(By.css('.h-100 h2:nth-child(2)')).getCssValue('color');
if (elementStyle !== 'rgba(40, 39, 90, 1)') {
throw new Error(`Expected: Dashboard - My Content Widget title text color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Dashboard - My Content Widget title text color matched as expected');
}
},
//Dashboard My Content Widget title text font size
{
description: 'Validate dashboard My Content widget title text font size',
action: async () => {
const elementStyle = await driver.findElement(By.css('.h-100 h2:nth-child(2)')).getCssValue('font-size');
if (elementStyle !== '18px') {
throw new Error(`Expected: Dashboard - My Content Widget title text font-size did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Dashboard - My Content Widget title text font-size matched as expected');
}
},
//Dashboard My Content Item Count
{
description: 'Validate Dashboard My Content Item Count',
action: async () => {
const elementText = await driver.findElement(By.css('#badge_content_total')).getText();
if (elementText !== '3527 items') {
throw new Error(`Expected: "3527 items"; Actual: "${elementText}"`);
}
console.log('Passed: Dashboard - My Content Item Count matched as expected');
}
},
//Dashboard My Content Item Count button color -dark blue
{
description: 'Validate Dashboard My Content Item Count button color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#badge_content_total')).getCssValue('background-color');
if (elementStyle !== 'rgba(40, 39, 90, 1)') {
throw new Error(`Expected: Dashboard - My Content Item Count button color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Dashboard - My Content Item Count button color matched as expected');
}
},
//Dashboard My Content Item Count text color -white
{
description: 'Validate Dashboard My Content Item Count font color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#badge_content_total')).getCssValue('color');
if (elementStyle !== 'rgba(255, 255, 255, 1)') {
throw new Error(`Expected: Dashboard - My Content Item Count font color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Dashboard - My Content Item Count font color matched as expected');
}
},
//Dashboard My Content Item Count text font size
{
description: 'Validate Dashboard My Content Item count text font size',
action: async () => {
const elementStyle = await driver.findElement(By.css('#badge_content_total')).getCssValue('font-size');
if (elementStyle !== '13.5px') {
throw new Error(`Expected: Dashboard - Dashboard My Content Item count text font-size did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Dashboard - Dashboard My Content Item count text font-size matched as expected');
}
},
//Ellipsis icon color -dark blue
{
description: 'Validate ellipsis icon color',
action: async () => {
const elementStyle = await driver.findElement(By.css('.fa-ellipsis-h')).getCssValue('color');
if (elementStyle !== 'rgba(40, 39, 90, 1)') {
throw new Error(`Expected: Ellipsis icon color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Ellipsis icon color matched as expected');
}
},
//Search icon color -dark blue
{
description: 'Validate search icon color',
action: async () => {
const elementStyle = await driver.findElement(By.css('.col-12 > .fa')).getCssValue('color');
if (elementStyle !== 'rgba(40, 39, 90, 1)') {
throw new Error(`Expected: Search icon color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Search icon color matched as expected');
}
},
//Filter textbox placeholder
{
description: 'Validate Filter placeholder text',
action: async () => {
const elementValue = await driver.findElement(By.css('#content-org-filter')).getAttribute('placeholder');
if (elementValue !== 'filter...') {
throw new Error(`Expected: "filter..."; Actual: "${elementValue}"`);
}
console.log('Passed: Filter placeholder text matched as expected');
}
},
//Sort label
{
description: 'Validate sort label',
action: async () => {
const elementText = await driver.findElement(By.css('.col-4')).getText();
if (elementText !== 'Sort:') {
throw new Error(`Expected: "Sort:"; Actual: "${elementText}"`);
}
console.log('Passed: Sort label matched as expected');
}
},
//Sort Dropdown [should be: "Count", option]
{
description: 'Validate sort dropdown option',
action: async () => {
const elementOption = await driver.findElement(By.css('#orgsort > option:nth-child(1)')).getAttribute('value');
if (elementOption !== 'count') {
throw new Error(`Expected: "count"; Actual: "${elementOption}"`);
}
console.log('Passed: Sort dropdown option matched as expected');
}
},
//Biology-QA
{
description: 'Validate Biology-QA title',
action: async () => {
const elementText = await driver.findElement(By.linkText('Biology - QA')).getText();
if (elementText !== 'Biology - QA') {
throw new Error(`Expected: "Biology - QA"; Actual: "${elementText}"`);
}
console.log('Passed: Biology-QA title matched as expected');
}
},
{
description: 'Validate Biology-QA edit icon color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#mycontentlist > #content-org-list > .content-org .fa')).getCssValue('color');
if (elementStyle !== 'rgba(73, 80, 87, 1)') {
throw new Error(`Expected: Biology-QA edit icon color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Biology-QA edit icon color matched as expected');
}
},
//Validate default sort order top6
//Biology - QA = 1046 (1st)
{
description: 'Validate default QA: Biology - QA 1046 count in 1st place',
action: async () => {
const elementText = await driver.findElement(By.xpath('//li/div/span')).getText();
if (elementText !== '1046') {
throw new Error(`Expected: Dashboard default content set order: Biology - QA count "1046" not listed in 1st place; Actual: "${elementText}"`);
}
console.log('Passed: Dashboard default content set order: Biology - QA count 1046 listed in 1st place');
}
},
//Biology - QA = 1046 count text font size
{
description: 'Validate Biology - QA = 1046 count text font size',
action: async () => {
const elementStyle = await driver.findElement(By.xpath('//li/div/span')).getCssValue('font-size');
if (elementStyle !== '12.87px') {
throw new Error(`Expected: Dashboard - Biology - QA = 1046 count text font-size did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Dashboard - Biology - QA = 1046 count text font-size matched as expected');
}
},
//Geometry - QA = 981 (2nd)
{
description: 'Validate default QA: Geometry - QA 981 count in 2nd place',
action: async () => {
const elementText = await driver.findElement(By.xpath('//ul/ul/li/div/span')).getText();
if (elementText !== '981') {
throw new Error(`Expected: Dashboard default content set order: Geometry - QA count "981" not listed in 2nd place; Actual: "${elementText}"`);
}
console.log('Passed: Dashboard default content set order: Geometry - QA count 981 listed in 2nd place');
}
},
//Geometry - QA = 981 count text font size
{
description: 'Validate Geometry - QA = 981 count text font size',
action: async () => {
const elementStyle = await driver.findElement(By.xpath('//ul/ul/li/div/span')).getCssValue('font-size');
if (elementStyle !== '12.87px') {
throw new Error(`Expected: Dashboard - Geometry - QA = 981 count text font-size did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Dashboard - Geometry - QA = 981 count text font-size matched as expected');
}
},
//Math Alignment Import Test = 730 (3rd)
{
description: 'Validate default QA: Math Alignment Import Test 730 count in 3rd place',
action: async () => {
const elementText = await driver.findElement(By.xpath('//ul/ul/ul/li/div/span')).getText();
if (elementText !== '730') {
throw new Error(`Expected: Dashboard default content set order: Math Alignment Import Testcount "730" not listed in 3rd place; Actual: "${elementText}"`);
}
console.log('Passed: Dashboard default content set order: Math Alignment Import Test count 730 listed in 3rd place');
}
},
//Math Alignment Import Test = 730 count text font size
{
description: 'Validate Math Alignment Import Test = 730 count text font size',
action: async () => {
const elementStyle = await driver.findElement(By.xpath('//ul/ul/ul/li/div/span')).getCssValue('font-size');
if (elementStyle !== '12.87px') {
throw new Error(`Expected: Dashboard - Math Alignment Import Test = 7301 count text font-size did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Dashboard - Math Alignment Import Test = 730 count text font-size matched as expected');
}
},
//English - QA = 409 (4th)
{
description: 'Validate default QA: English - QA 409 count in 4th place',
action: async () => {
const elementText = await driver.findElement(By.xpath('//ul/ul/ul/ul/li/div/span')).getText();
if (elementText !== '409') {
throw new Error(`Expected: Dashboard default content set order: English - QA count "409" not listed in 4th place; Actual: "${elementText}"`);
}
console.log('Passed: Dashboard default content set order: English - QA count 409 listed in 4th place');
}
},
//English - QA = 409 count text font size
{
description: 'Validate English - QA = 409 count text font size',
action: async () => {
const elementStyle = await driver.findElement(By.xpath('//ul/ul/ul/ul/li/div/span')).getCssValue('font-size');
if (elementStyle !== '12.87px') {
throw new Error(`Expected: Dashboard - English - QA = 409 count text font-size did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Dashboard - English - QA = 409 count text font-size matched as expected');
}
},
//Algebra - QA = 188 (5th)
{
description: 'Validate default QA: Algebra- QA 188 count in 5th place',
action: async () => {
const elementText = await driver.findElement(By.xpath('//ul/ul/ul/ul/ul/li/div/span')).getText();
if (elementText !== '188') {
throw new Error(`Expected: Dashboard default content set order: Algebra - QA count "1882" not listed in 5th place; Actual: "${elementText}"`);
}
console.log('Passed: Dashboard default content set order: Algebra - QA count 188 listed in 5th place');
}
},
//Algebra - QA = 188 count text font size
{
description: 'Validate Algebra - QA = 188 count text font size',
action: async () => {
const elementStyle = await driver.findElement(By.xpath('//ul/ul/ul/ul/ul/li/div/span')).getCssValue('font-size');
if (elementStyle !== '12.87px') {
throw new Error(`Expected: Dashboard - Algebra - QA = 188 count text font-size did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Dashboard - Algebra - QA = 188 count text font-size matched as expected');
}
},
//US History - QA = 62 (6th)
{
description: `Validate default QA: US History - QA 62 count in 6th place`,
action: async () => {
const elementText = await driver.findElement(By.xpath('//ul/ul/ul/ul/ul/ul/li/div/span')).getText();
if (elementText !== '62') {
throw new Error(`Expected: Dashboard default content set order: US History - QA count "62" not listed in 6th place; Actual: "${elementText}"`);
}
console.log(`Passed: Dashboard default content set order: US History - QA count 62 listed in 6th place`);
}
},
//US History - QA = 62 count text font size
{
description: 'Validate US History - QA = 62 count text font size',
action: async () => {
const elementStyle = await driver.findElement(By.xpath('//ul/ul/ul/ul/ul/ul/li/div/span')).getCssValue('font-size');
if (elementStyle !== '12.87px') {
throw new Error(`Expected: Dashboard - US History - QA = 62 count text font-size did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Dashboard - US History - QA = 62 count text font-size matched as expected');
}
},
//MY CONTENT ITEM COUNT
//NEXT ACTION -Click My Content Items Count button
{ description: 'Click My Content Items Count button', action: async () => await driver.findElement(By.css('#content_total')).click() },
{ description: 'Wait for My Content Totals DIV to open', action: async () => await driver.sleep(2000) },
//Wait for DIV
{
description: 'Wait for DIV to open',
action: async () => {
return await driver.wait(until.elementLocated(By.css('.content_modal_title')), 5000).catch(() => false);
}
},
//My Content Totals DIV title
{
description: 'Validate My Content Totals DIV title',
action: async () => {
const elementText = await driver.findElement(By.css('.content_modal_title')).getText();
if (elementText !== 'My Content Totals') {
throw new Error(`Expected: "My Content Totals"; Actual: "${elementText}"`);
}
console.log('Passed: My Content Totals DIV title matched as expected');
}
},
//My Content Totals DIV title text color -dark blue
{
description: 'Validate My Content Totals DIV title font color',
action: async () => {
const elementStyle = await driver.findElement(By.css('.content_modal_title')).getCssValue('color');
if (elementStyle !== 'rgba(40, 39, 90, 1)') {
throw new Error(`Expected: My Content Totals DIV title font color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: My Content Totals DIV title font color matched as expected');
}
},
//My Content Totals DIV title text font size
{
description: 'Validate My Content Totals DIV title text font size',
action: async () => {
const elementStyle = await driver.findElement(By.css('.content_modal_title')).getCssValue('font-size');
if (elementStyle !== '18px') {
throw new Error(`Expected: My Content Totals DIV title text font-size did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: My Content Totals DIV title text font-size matched as expected');
}
},
//My Content Totals DIV - Total Items label
{
description: 'Validate My Content Totals DIV - Total Items label',
action: async () => {
const elementText = await driver.findElement(By.css('#total > p')).getText();
if (elementText !== 'Total Items') {
throw new Error(`Expected: "My Content Totals"; Actual: "${elementText}"`);
}
console.log('Passed: My Content Totals DIV - Total Items label matched as expected');
}
},
//My Content Totals DIV - Total Items label text background color -gray
{
description: 'Validate My Content Totals DIV - Total Items label text background font color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#total > p')).getCssValue('background-color');
if (elementStyle !== 'rgba(238, 238, 242, 1)') {
throw new Error(`Expected: My Content Totals DIV - Total Items label text background font color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: My Content Totals DIV - Total Items label text background font color matched as expected');
}
},
//My Content Totals DIV - Total Items label text background text font size
{
description: 'Validate My Content Totals DIV - Total Items label text background text font size',
action: async () => {
const elementStyle = await driver.findElement(By.css('#total > p')).getCssValue('font-size');
if (elementStyle !== '14px') {
throw new Error(`Expected: My Content Totals DIV - Total Items label text background text font-size did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: My Content Totals DIV - Total Items label text background text font-size matched as expected');
}
},
//My Content Totals DIV - Total Items Count
{
description: 'Validate My Content Totals DIV - Total Items Count',
action: async () => {
const elementText = await driver.findElement(By.css('#total > b')).getText();
if (elementText !== '3527') {
throw new Error(`Expected: "3527"; Actual: "${elementText}"`);
}
console.log('Passed: My Content Totals DIV - Total Items Count matched as expected');
}
},
//My Content Totals DIV - Total Items Count text font size size
{
description: 'Validate My Content Totals DIV - Total Items Count text font size',
action: async () => {
const elementStyle = await driver.findElement(By.css('#total > b')).getCssValue('font-size');
if (elementStyle !== '36px') {
throw new Error(`Expected: My Content Totals DIV - Items Count text font-size did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: My Content Totals DIV - Items Count text font-size matched as expected');
}
},
//My Content Totals DIV - Unique Titles label
{
description: 'Validate My Content Totals DIV - Unique Titles label',
action: async () => {
const elementText = await driver.findElement(By.css('#total_titles > p')).getText();
if (elementText !== 'Unique Titles') {
throw new Error(`Expected: "Unique Titles"; Actual: "${elementText}"`);
}
console.log('Passed: My Content Totals DIV - Unique Titles label matched as expected');
}
},
//My Content Totals DIV - Unique Titles label text background color -gray
{
description: 'Validate My Content Totals DIV - Unique Titles label text background font color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#total_titles > p')).getCssValue('background-color');
if (elementStyle !== 'rgba(238, 238, 242, 1)') {
throw new Error(`Expected: My Content Totals DIV - Unique Titles label text background font color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: My Content Totals DIV - Unique Titles label text background font color matched as expected');
}
},
//My Content Totals DIV - Unique Titles label text background text font size
{
description: 'Validate My Content Totals DIV - Unique Titles label text background text font size',
action: async () => {
const elementStyle = await driver.findElement(By.css('#total_titles > p')).getCssValue('font-size');
if (elementStyle !== '14px') {
throw new Error(`Expected: My Content Totals DIV - Unique Titles label text background text font-size did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: My Content Totals DIV - Unique Titles label text background text font-size matched as expected');
}
},
//My Content Totals DIV - Unique Titles Count
{
description: 'Validate My Content Totals DIV - Unique Titles Count',
action: async () => {
const elementText = await driver.findElement(By.css('#total_titles > b')).getText();
if (elementText !== '6433') {
throw new Error(`Expected: "6433"; Actual: "${elementText}"`);
}
console.log('Passed: My Content Totals DIV - Unique Titles Count matched as expected');
}
},
//My Content Unique Titles Count text font size
{
description: 'Validate My Content Totals DIV - Unique Titles Count text font size',
action: async () => {
const elementStyle = await driver.findElement(By.css('#total_titles > b')).getCssValue('font-size');
if (elementStyle !== '36px') {
throw new Error(`Expected: My Content Totals DIV - Unique Titles Count text font-size did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: My Content Totals DIV - Unique Titles Count text font-size matched as expected');
}
},
//My Content Unique IDs label
{
description: 'Validate My Content Totals DIV - Unique IDs',
action: async () => {
const elementText = await driver.findElement(By.css('#total_pubtotalids > p')).getText();
if (elementText !== 'Unique IDs') {
throw new Error(`Expected: "Unique IDs"; Actual: "${elementText}"`);
}
console.log('Passed: My Content Totals DIV - Unique IDs label matched as expected');
}
},
//My Content Totals DIV - Unique IDs label text background color -gray
{
description: 'Validate My Content Totals DIV - Unique IDs label text background font color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#total_titles > p')).getCssValue('background-color');
if (elementStyle !== 'rgba(238, 238, 242, 1)') {
throw new Error(`Expected: My Content Totals DIV - Unique IDs label text background font color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: My Content Totals DIV - Unique IDs label text background font color matched as expected');
}
},
//My Content Totals DIV - Unique IDs label text background text font size
{
description: 'Validate My Content Totals DIV - Unique IDs label text background text font size',
action: async () => {
const elementStyle = await driver.findElement(By.css('#total_titles > p')).getCssValue('font-size');
if (elementStyle !== '14px') {
throw new Error(`Expected: My Content Totals DIV - Unique IDs label text background text font-size did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: My Content Totals DIV - Unique IDs label text background text font-size matched as expected');
}
},
//My Content Unique IDs Count
{
description: 'Validate My Content Totals DIV - Unique IDs Count',
action: async () => {
const elementText = await driver.findElement(By.css('#total_pubtotalids > b')).getText();
if (elementText !== '5531') {
throw new Error(`Expected: "5531"; Actual: "${elementText}"`);
}
console.log('Passed: My Content Totals DIV - Unique IDs Count matched as expected');
}
},
//My Content Unique IDs Count text font size
{
description: 'Validate My Content Totals DIV - Unique IDs Count text font size',
action: async () => {
const elementStyle = await driver.findElement(By.css('#total_pubtotalids > b')).getCssValue('font-size');
if (elementStyle !== '36px') {
throw new Error(`Expected: My Content Totals DIV - Unique IDs Count text font-size did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: My Content Totals DIV - Unique IDs Count text font-size matched as expected');
}
},
//My Content Totals DIV - Content Set column label
{
description: 'Validate My Content Totals DIV - Content Set column label',
action: async () => {
const elementText = await driver.findElement(By.css('.card-body > .table-sm th:nth-child(1)')).getText();
if (elementText !== 'Content Set') {
throw new Error(`Expected: My Content Totals DIV - "Content Set"; Actual: "${elementText}"`);
}
console.log('Passed: My Content Totals DIV - Content Set column label matched as expected');
}
},
//My Content Totals DIV - Content Set column label text font size
{
description: 'Validate My Content Totals DIV - Content Set column label text font size',
action: async () => {
const elementStyle = await driver.findElement(By.css('.card-body > .table-sm th:nth-child(1)')).getCssValue('font-size');
if (elementStyle !== '10px') {
throw new Error(`Expected: My Content Totals DIV - Content Set column label text font-size did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: My Content Totals DIV - Content Set column label text background text font-size matched as expected');
}
},
//My Content Total Items column label
{
description: 'Validate My Content Totals DIV - Total Items column label',
action: async () => {
const elementText = await driver.findElement(By.css('.card-body > .table-sm th:nth-child(2)')).getText();
if (elementText !== 'Total Items') {
throw new Error(`Expected: "Total Items"; Actual: "${elementText}"`);
}
console.log('Passed: My Content Totals DIV - Total Items column label matched as expected');
}
},
//My Content Totals DIV - Total Items column label text font size
{
description: 'Validate My Content Totals DIV - Total Items column label text font size',
action: async () => {
const elementStyle = await driver.findElement(By.css('.card-body > .table-sm th:nth-child(2)')).getCssValue('font-size');
if (elementStyle !== '10px') {
throw new Error(`Expected: My Content Totals DIV - Total Items column label text font-size did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: My Content Totals DIV - Total Items column label text background text font-size matched as expected');
}
},
//My Content Unique Titles column label
{
description: 'Validate My Content Totals DIV - Unique Titles column label',
action: async () => {
const elementText = await driver.findElement(By.css('.card-body > .table-sm th:nth-child(3)')).getText();
if (elementText !== 'Unique Titles') {
throw new Error(`Expected: "Unique Titles"; Actual: "${elementText}"`);
}
console.log('Passed: My Content Totals DIV - Unique Titles column label matched as expected');
}
},
//My Content Totals DIV - Unique Titles column label text font size
{
description: 'Validate My Content Totals DIV - Unique Titles column label text font size',
action: async () => {
const elementStyle = await driver.findElement(By.css('.card-body > .table-sm th:nth-child(3)')).getCssValue('font-size');
if (elementStyle !== '10px') {
throw new Error(`Expected: My Content Totals DIV - Unique Titles column label text font-size did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: My Content Totals DIV - Unique Titles column label text background text font-size matched as expected');
}
},
//My Content Unique IDs column label
{
description: 'Validate My Content Totals DIV - Unique IDs column label',
action: async () => {
const elementText = await driver.findElement(By.css('.card-body > .table-sm th:nth-child(4)')).getText();
if (elementText !== 'Unique IDs') {
throw new Error(`Expected: "Unique IDs"; Actual: "${elementText}"`);
}
console.log('Passed: My Content Totals DIV - Unique IDs column label matched as expected');
}
},
//My Content Totals DIV - Unique IDs column label text font size
{
description: 'Validate My Content Totals DIV - Unique IDs column label text font size',
action: async () => {
const elementStyle = await driver.findElement(By.css('.card-body > .table-sm th:nth-child(4)')).getCssValue('font-size');
if (elementStyle !== '10px') {
throw new Error(`Expected: My Content Totals DIV - Unique IDs column label text font-size did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: My Content Totals DIV - Unique IDs column label text background text font-size matched as expected');
}
},
//My Content; Biology - QA label
{
description: 'Validate My Content Totals DIV - Biology - QA label',
action: async () => {
const elementText = await driver.findElement(By.css('#content_tbody > tr:nth-child(1) > td:nth-child(1)')).getText();
if (elementText !== 'Biology - QA') {
throw new Error(`Expected: "Biology - QA"; Actual: "${elementText}"`);
}
console.log('Passed: My Content Totals DIV - Biology - QA label matched as expected');
}
},
//My Content; Biology - QA Total Items Count
{
description: 'Validate My Content Totals DIV - Biology - QA Total Items Count',
action: async () => {
const elementText = await driver.findElement(By.css('#content_tbody > tr:nth-child(1) > td:nth-child(2)')).getText();
if (elementText !== '1046') {
throw new Error(`Expected: "1046"; Actual: "${elementText}"`);
}
console.log('Passed: My Content Totals DIV - Biology - QA Total Items Count matched as expected');
}
},
//My Content; Biology - QA Unique Titles Count
{
description: 'Validate My Content Totals DIV - Biology - QA Unique Titles Count',
action: async () => {
const elementText = await driver.findElement(By.css('#content_tbody > tr:nth-child(1) > td:nth-child(3)')).getText();
if (elementText !== '1058') {
throw new Error(`Expected: "1058"; Actual: "${elementText}"`);
}
console.log('Passed: My Content Totals DIV - Biology - QA Unique Titles Count matched as expected');
}
},
//My Content; Biology - QA Unique IDs
{
description: 'Validate My Content Totals DIV - Biology - QA Unique IDs Count',
action: async () => {
const elementText = await driver.findElement(By.css('#content_tbody > tr:nth-child(1) > td:nth-child(4)')).getText();
if (elementText !== '1065') {
throw new Error(`Expected: "1065"; Actual: "${elementText}"`);
}
console.log('Passed: My Content Totals DIV - Biology - QA Unique IDs Count matched as expected');
}
},
//My Content; My Content Totals DIV - Close button
{
description: 'Validate My Content Totals DIV - Close button',
action: async () => {
const elementText = await driver.findElement(By.css('#all_content_modal .btn-secondary')).getText();
if (elementText !== 'Close') {
throw new Error(`Expected: "Close"; Actual: "${elementText}"`);
}
console.log('Passed: Close button text matched as expected');
}
},
//My Content Totals DIV - Close button color-white
{
description: 'Validate My Content Totals DIV - Export button background color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#all_content_modal .btn-secondary')).getCssValue('background-color');
if (elementStyle !== 'rgba(0, 0, 0, 0)') {
throw new Error(`Expected: Close button background color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Close button background color matched as expected');
}
},
//My Content Totals DIV - Export button
{
description: 'Validate My Content Totals DIV - Export button',
action: async () => {
const elementText = await driver.findElement(By.css('#export_btn')).getText();
if (elementText !== 'Export') {
throw new Error(`Expected: "Export"; Actual: "${elementText}"`);
}
console.log('Passed: Export button text matched as expected');
}
},
//My Content Totals DIV - Export button color-green
{
description: 'Validate My Content Totals DIV - Export button background color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#export_btn')).getCssValue('background-color');
if (elementStyle !== 'rgba(48, 200, 172, 1)') {
throw new Error(`Expected: Export button background color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Export button background color matched as expected');
}
},
//NEXT ACTION -Close DIV button
{ description: 'Click My Contents Count DIV Close button', action: async () => await driver.findElement(By.css('#all_content_modal .btn-secondary')).click() },
{ description: 'Wait for My Content Totals DIV to close', action: async () => await driver.sleep(2000) },
//NEXT ACTION -EDIT BIOLOGY - QA CONTENT SET
{ description: 'Click Biology-QA edit icon', action: async () => await driver.findElement(By.css('#mycontentlist > #content-org-list > .content-org .fa')).click() },
{ description: 'Wait for Edit Content DIV to open', action: async () => await driver.sleep(5000) },
//Wait for dashboard to load
{
description: 'Wait for DIV to open',
action: async () => {
return await driver.wait(until.elementLocated(By.css('.modal-lg .modal-title')), 10000).catch(() => false);
}
},
//Edit Content Set DIV
{
description: 'Validate Edit DIV title',
action: async () => {
const elementText = await driver.findElement(By.css('.modal-lg .modal-title')).getText();
if (elementText !== 'Edit Content Set') {
throw new Error(`Expected: Edit DIV title did not match; Actual: "${elementText}"`);
}
console.log('Passed: Edit DIV title matched as expected');
}
},
//Edit Content Set DIV title text font size
{
description: 'Validate Edit Content Set DIV title text font size',
action: async () => {
const elementStyle = await driver.findElement(By.css('.modal-lg .modal-title')).getCssValue('font-size');
if (elementStyle !== '18px') {
throw new Error(`Expected: Edit Content Set DIV title text font-size did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Edit Content Set DIV title text background text font-size matched as expected');
}
},
//Edit Content Set DIV - Content Set Name label
{
description: 'Validate Edit Content Set DIV - Content Set Name label',
action: async () => {
const elementText = await driver.findElement(By.css('.modal-lg .form-label')).getText();
if (elementText !== 'Content Set Name') {
throw new Error(`Expected: Edit Content Set DIV - "Content Set Name"; Actual: "${elementText}"`);
}
console.log('Passed: Edit Content Set DIV - Content Set Name label matched as expected');
}
},
//Content Set Name label text font size
{
description: 'Validate Content Set Name label text font size',
action: async () => {
const elementStyle = await driver.findElement(By.css('.modal-lg .form-label')).getCssValue('font-size');
if (elementStyle !== '15px') {
throw new Error(`Expected: Content Set Name label text font-size did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Content Set Name label text background text font-size matched as expected');
}
},
//Edit Content Set DIV - textbox
{
description: 'Validate Edit DIV textbox',
action: async () => {
const elementValue = await driver.findElement(By.css('#orgname')).getAttribute('value');
if (elementValue !== 'Biology - QA') {
throw new Error(`Expected: Edit DIV textbox Expected: "Biology - QA"; Actual: "${elementValue}"`);
}
console.log('Passed: Edit DIV textbox matched as expected');
}
},
//Edit Content Set DIV - Delete button
{
description: 'Validate Edit DIV delete text button',
action: async () => {
const elementText = await driver.findElement(By.css('.modal-lg #orgdelete')).getText();
if (elementText !== 'Delete') {
throw new Error(`Expected: "Delete"; Actual: "${elementText}"`);
}
console.log('Passed: Edit DIV delete text button matched as expected');
}
},
//Edit Content Set DIV - Delete button color -red
{
description: 'Validate Edit DIV delete button color',
action: async () => {
const elementStyle = await driver.findElement(By.css('.modal-lg #orgdelete')).getCssValue('background-color');
if (elementStyle !== 'rgba(220, 53, 69, 1)') {
throw new Error(`Expected: Edit DIV delete button color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Edit DIV delete button color matched as expected');
}
},
//Edit Content Set DIV - Delete button disabled
{
description: 'Validate Edit DIV delete button is disabled',
action: async () => {
const elementStyle = await driver.findElement(By.css('.modal-lg #orgdelete')).getAttribute('disabled');
if (elementStyle !== 'true') {
throw new Error(`Expected: Edit DIV delete button should be disabled; Actual: "${elementStyle}"`);
}
console.log('Passed: Edit DIV delete button disabled as expected');
}
},
//Edit Content Set DIV - Delete button tool-tip
{
description: 'Validate Edit DIV delete button tool-tip',
action: async () => {
const elementStyle = await driver.findElement(By.css('.modal-lg #orgdelete')).getAttribute('title');
if (elementStyle !== 'You cannot delete a Content Set that has content items') {
throw new Error(`Expected: "You cannot delete a Content Set that has content items"; Actual: "${elementStyle}"`);
}
console.log('Passed: Edit DIV delete button tool-tip matched as expected');
}
},
//Edit Content Set DIV - Save button
{
description: 'Validate Edit DIV save text button',
action: async () => {
const elementText = await driver.findElement(By.css('#modalop')).getAttribute('value');
if (elementText !== 'Save') {
throw new Error(`Expected: "Save"; Actual: "${elementText}"`);
}
console.log('Passed: Edit DIV save text button matched as expected');
}
},
//Edit Content Set DIV - Save button color -green
{
description: 'Validate Edit DIV save button color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#modalop')).getCssValue('background-color');
if (elementStyle !== 'rgba(48, 200, 172, 1)') {
throw new Error(`Expected: Edit DIV save button color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Edit DIV save button color matched as expected');
}
},
//Edit Content Set DIV - Close button
{
description: 'Validate Edit DIV close text button',
action: async () => {
const elementText = await driver.findElement(By.css('#modalclose')).getText();
if (elementText !== 'Close') {
throw new Error(`Expected: "Close"; Actual: "${elementText}"`);
}
console.log('Passed: Edit DIV close text button matched as expected');
}
},
//Edit Content Set DIV - Close button color -white
{
description: 'Validate Edit DIV close button color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#modalclose')).getCssValue('background-color');
if (elementStyle !== 'rgba(0, 0, 0, 0)') {
throw new Error(`Expected: Edit DIV close button color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Edit DIV close button color matched as expected');
}
},
//NEXT ACTION -Close edit DIV
{ description: 'Click X icon', action: async () => await driver.findElement(By.css('.modal-lg .modal-header span')).click() },
{ description: 'Driver sleep', action: async () => await driver.sleep(2000) },
//BIOLOGY - QA ITEM COUNT CHECK
//NEXT ACTION -Verify Biology - QA item Count
{ description: 'Click Biology-QA item Count link', action: async () => await driver.findElement(By.css('#mycontentlist > #content-org-list > .content-org .badge')).click() },
{ description: 'Wait for My Content Totals DIV to open', action: async () => await driver.sleep(5000) },
//Wait for dashboard to load
{
description: 'Wait for DIV to open',
action: async () => {
return await driver.wait(until.elementLocated(By.css('.modal-lg .modal-title')), 10000).catch(() => false);
}
},
//Biology - QA Totals DIV title
{
description: 'Validate Biology - QA Totals DIV title',
action: async () => {
const elementText = await driver.findElement(By.css('.content_modal_title')).getText();
if (elementText !== 'Biology - QA Totals') {
throw new Error(`Expected: "Biology - QA Totals"; Actual: "${elementText}"`);
}
console.log('Passed: Biology - QA Totals DIV title matched as expected');
}
},
//Biology - QA Totals DIV title text color -dark blue
{
description: 'Validate Biology - QA Totals DIV title font color',
action: async () => {
const elementStyle = await driver.findElement(By.css('.content_modal_title')).getCssValue('color');
if (elementStyle !== 'rgba(40, 39, 90, 1)') {
throw new Error(`Expected: My Content Totals DIV title font color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Biology - QA Totals DIV title font color matched as expected');
}
},
//Biology - QA Totals DIV title text font size
{
description: 'Validate Biology - QA Totals DIV title text font size',
action: async () => {
const elementStyle = await driver.findElement(By.css('.content_modal_title')).getCssValue('font-size');
if (elementStyle !== '18px') {
throw new Error(`Expected: Biology - QA Totals DIV title text font-size did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Biology - QA Totals DIV title background text font-size matched as expected');
}
},
//Biology - QA Total Items label
{
description: 'Validate Biology - QA Totals DIV - Total Items label',
action: async () => {
const elementText = await driver.findElement(By.css('#total')).getText();
if (elementText !== 'My Content Totals') {
throw new Error(`Expected: "My Content Totals"; Actual: "${elementText}"`);
}
console.log('Passed: Biology - QA Totals DIV - Total Items label matched as expected');
}
},
//Biology - QA Total Items Count "1046"?
{
description: 'Validate Biology - QA Totals DIV - Total Items Count',
action: async () => {
const elementText = await driver.findElement(By.css('#total > b')).getText();
if (elementText !== '1046') {
throw new Error(`Expected: "1046"; Actual: "${elementText}"`);
}
console.log('Passed: Biology - QA Totals DIV - Total Items Count matched as expected');
}
},
//Biology - QA Total Items Count text font size
{
description: 'Validate Biology - QA Totals DIV - Total Items Count text font size',
action: async () => {
const elementStyle = await driver.findElement(By.css('#total > b')).getCssValue('font-size');
if (elementStyle !== '36px') {
throw new Error(`Expected: Biology - QA Totals DIV - Items Count text font-size did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Biology - QA Totals DIV - Items Count text font-size matched as expected');
}
},
//Biology - QA Unique Titles label
{
description: 'Validate Biology - QA Totals DIV - Unique Titles label',
action: async () => {
const elementText = await driver.findElement(By.css('#total_titles')).getText();
if (elementText !== 'Unique Titles') {
throw new Error(`Expected: "Unique Titles"; Actual: "${elementText}"`);
}
console.log('Passed: Biology - QA Totals DIV - Unique Titles label matched as expected');
}
},
//Biology - QA Unique Titles Count
{
description: 'Validate Biology - QA Totals DIV - Unique Titles Count',
action: async () => {
const elementText = await driver.findElement(By.css('#total_titles > b')).getText();
if (elementText !== '1058') {
throw new Error(`Expected: "1058"; Actual: "${elementText}"`);
}
console.log('Passed: Biology - QA Totals DIV - Unique Titles Count matched as expected');
}
},
//Biology - QA Unique Titles Count text font size
{
description: 'Validate Biology - QA Totals DIV - Unique Titles Count text font size',
action: async () => {
const elementStyle = await driver.findElement(By.css('#total_titles > b')).getCssValue('font-size');
if (elementStyle !== '36px') {
throw new Error(`Expected: Biology - QA Total DIV - Unique Titles Count text font-size did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Biology - QA Totals DIV - Unique Titles Count text font-size matched as expected');
}
},
//Biology - QA Unique IDs label
{
description: 'Validate Biology - QA Totals DIV - Unique IDs',
action: async () => {
const elementText = await driver.findElement(By.css('#total_pubtotalids')).getText();
if (elementText !== 'Unique IDs') {
throw new Error(`Expected: "Unique IDs"; Actual: "${elementText}"`);
}
console.log('Passed: Biology - QA Totals DIV - Unique IDs label matched as expected');
}
},
//Biology - QA Unique IDs Count
{
description: 'Validate Biology - QA Totals DIV - Unique Titles Count',
action: async () => {
const elementText = await driver.findElement(By.css('#total_pubtotalids > b')).getText();
if (elementText !== '1065') {
throw new Error(`Expected: "1065"; Actual: "${elementText}"`);
}
console.log('Passed: Biology - QA Totals DIV - Unique IDs Count matched as expected');
}
},
//Biology - QA Unique IDs Count text font size
{
description: 'Validate Biology - QA Totals DIV - Unique IDs Count text font size',
action: async () => {
const elementStyle = await driver.findElement(By.css('#total_pubtotalids > b')).getCssValue('font-size');
if (elementStyle !== '36px') {
throw new Error(`Expected: Biology - QA Totals DIV - Unique IDs Count text font-size did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Biology - QA Totals DIV - Count text font-size matched as expected');
}
},
//My Content; My Content Totals DIV - Close button
{
description: 'Validate My Content Totals DIV - Close button',
action: async () => {
const elementText = await driver.findElement(By.css('#all_content_modal .btn-secondary')).getText();
if (elementText !== 'Close') {
throw new Error(`Expected: "Close"; Actual: "${elementText}"`);
}
console.log('Passed: Close button text matched as expected');
}
},
//My Content Totals DIV - Close button color-white
{
description: 'Validate My Content Totals DIV - Export button background color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#all_content_modal .btn-secondary')).getCssValue('background-color');
if (elementStyle !== 'rgba(0, 0, 0, 0)') {
throw new Error(`Expected: Close button background color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Close button background color matched as expected');
}
},
//My Content Totals DIV - Export button
{
description: 'Validate My Content Totals DIV - Export button',
action: async () => {
const elementText = await driver.findElement(By.css('#export_btn')).getText();
if (elementText !== 'Export') {
throw new Error(`Expected: "Export"; Actual: "${elementText}"`);
}
console.log('Passed: Export button text matched as expected');
}
},
//My Content Totals DIV - Export button color-green
{
description: 'Validate My Content Totals DIV - Export button background color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#export_btn')).getCssValue('background-color');
if (elementStyle !== 'rgba(48, 200, 172, 1)') {
throw new Error(`Expected: Export button background color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Export button background color matched as expected');
}
},
//NEXT ACTION -Click Close DIV button
{ description: 'Click My Contents Count DIV Close button', action: async () => await driver.findElement(By.css('#all_content_modal .btn-secondary')).click() },
{ description: 'Wait for My Content Totals DIV to close', action: async () => await driver.sleep(2000) },
//NEXT ACTION -Click My Content ellipsis icon
{ description: 'Click Ellipsis icon', action: async () => await driver.findElement(By.css('.fa-ellipsis-h')).click() },
{ description: 'Driver sleep', action: async () => await driver.sleep(2000) },
//Create Content Set icon color -dark blue
{
description: 'Validate create content set icon color',
action: async () => {
const elementStyle = await driver.findElement(By.css('.fa-plus')).getCssValue('color');
if (elementStyle !== 'rgba(33, 37, 41, 1)') {
throw new Error(`Expected: Create Content Set icon color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Create Content Set icon color matched as expected');
}
},
//Create Content Set link text
{
description: 'Validate create content set link text',
action: async () => {
const elementText = await driver.findElement(By.linkText('Create Content Set')).getText();
if (elementText !== 'Create Content Set') {
throw new Error(`Expected: "Create Content Set"; Actual: "${elementText}"`);
}
console.log('Passed: Create Content Set link text matched as expected');
}
},
//Create Content Set link text color -dark blue
{
description: 'Validate create content set link text color',
action: async () => {
const elementStyle = await driver.findElement(By.linkText('Create Content Set')).getCssValue('color');
if (elementStyle !== 'rgba(33, 37, 41, 1)') {
throw new Error(`Expected: Create Content Set link text color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Create Content Set link text color matched as expected');
}
},
//Export Content Set icon color -dark blue
{
description: 'Validate export content set icon color',
action: async () => {
const elementStyle = await driver.findElement(By.css('.fa-download')).getCssValue('color');
if (elementStyle !== 'rgba(33, 37, 41, 1)') {
throw new Error(`Expected: Export Content icon color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Export Content icon color matched as expected');
}
},
//Export Content Set link text
{
description: 'Validate export content set link text',
action: async () => {
const elementText = await driver.findElement(By.linkText('Export Content Set')).getText();
if (elementText !== 'Export Content Set') {
throw new Error(`Expected: "Export Content Set"; Actual: "${elementText}"`);
}
console.log('Passed: Export Content Set link text matched as expected');
}
},
//Export Content Set link text color -dark blue
{
description: 'Validate export content set link text color',
action: async () => {
const elementStyle = await driver.findElement(By.linkText('Export Content Set')).getCssValue('color');
if (elementStyle !== 'rgba(33, 37, 41, 1)') {
throw new Error(`Expected: Export Content Set icon color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Export Content Set icon color matched as expected');
}
},
//NEXT ACTION -CREATE CONTENT SET
{ description: 'Click Create Content Set link', action: async () => await driver.findElement(By.linkText('Create Content Set')).click() },
{ description: 'Driver sleep', action: async () => await driver.sleep(5000) },
//Wait for DIV to open
{
description: 'Wait for DIV to open',
action: async () => {
return await driver.wait(until.elementLocated(By.css('.modal-lg .modal-title')), 10000).catch(() => false);
}
},
//Create Content Set DIV
{
description: 'Validate create content set DIV title',
action: async () => {
const elementText = await driver.findElement(By.css('.modal-lg .modal-title')).getText();
if (elementText !== 'Create Content Set') {
throw new Error(`Expected: Content set DIV title did not match; Actual: "${elementText}"`);
}
console.log('Passed: Create Content Set DIV title matched as expected');
}
},
//Create Content Set DIV title text font size
{
description: 'Validate Create Content Set DIV title text font size',
action: async () => {
const elementStyle = await driver.findElement(By.css('.modal-lg .modal-title')).getCssValue('font-size');
if (elementStyle !== '18px') {
throw new Error(`Expected: Create Content Set DIV title text font-size did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Create Content Set DIV title text background text font-size matched as expected');
}
},
//Create Content Set DIV - Content Set Name label
{
description: 'Validate create DIV label',
action: async () => {
const elementText = await driver.findElement(By.css('.form-row:nth-child(2) .form-label')).getText();
if (elementText !== 'Content Set Name') {
throw new Error(`Expected: "Content Set Name"; Actual: "${elementText}"`);
}
console.log('Passed: Create DIV label matched as expected');
}
},
//Create Content Set DIV - Content Set Name label text font size
{
description: 'Validate Create Content Set DIV - Content Set Name label text font size',
action: async () => {
const elementStyle = await driver.findElement(By.css('.form-row:nth-child(2) .form-label')).getCssValue('font-size');
if (elementStyle !== '15px') {
throw new Error(`Expected: Create Content Set DIV - Content Set Name label text font-size did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Create Content Set DIV - Content Set Name label text background text font-size matched as expected');
}
},
//Create Content Set DIV - Create button text
{
description: 'Validate create DIV - Create button text',
action: async () => {
const elementText = await driver.findElement(By.css('.modal-lg #modalop')).getAttribute('value');
if (elementText !== 'Create') {
throw new Error(`Expected: "Create"; Actual: "${elementText}"`);
}
console.log('Passed: Create button text matched as expected');
}
},
//Create Content Set DIV - Create button color -green
{
description: 'Validate create DIV - Create button color',
action: async () => {
const elementStyle = await driver.findElement(By.css('.modal-lg #modalop')).getCssValue('background-color');
if (elementStyle !== 'rgba(48, 200, 172, 1)') {
throw new Error(`Expected: Create button color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Create button color matched as expected');
}
},
//Create Content Set DIV - Close button text
{
description: 'Validate create DIV - Close button text',
action: async () => {
const elementText = await driver.findElement(By.css('#modalclose')).getText();
if (elementText !== 'Close') {
throw new Error(`Expected: "Close"; Actual: "${elementText}"`);
}
console.log('Passed: Close DIV label matched as expected');
}
},
//Create Content Set DIV - Close button color -white
{
description: 'Validate create DIV - Close button color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#modalclose')).getCssValue('background-color');
if (elementStyle !== 'rgba(0, 0, 0, 0)') {
throw new Error(`Expected: Close button color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Close button color matched as expected');
}
},
//NEXT ACTION -Create Content Set Validation - No Name
{ description: 'Click create button without content set name', action: async () => await driver.findElement(By.css('.modal-lg #modalop')).click() },
{ description: 'Driver sleep', action: async () => await driver.sleep(2000) },
//Validation
{
description: 'Validate text',
action: async () => {
const elementText = await driver.findElement(By.css('#metawarn > b')).getText();
if (elementText !== 'You must enter a Content Set name.') {
throw new Error(`Expected: "You must enter a Content Set name."; Actual: "${elementText}"`);
}
console.log('Passed: Create DIV label matched as expected');
}
},
//Validation text color -red
{
description: 'Validate Create Content Set validation text color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#metawarn > b')).getCssValue('color');
if (elementStyle !== 'rgba(220, 53, 69, 1)') {
throw new Error(`Expected: Create Content Set validation text color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Create Content Set validation text color matched as expected');
}
},
//NEXT ACTION -Create Content Set Validation - Existing Name
{ description: 'Enter existing content set name', action: async () => await driver.findElement(By.css('#orgname')).sendKeys('Biology - QA') },
{ description: 'Click create button', action: async () => await driver.findElement(By.css('.modal-lg #modalop')).click() },
{ description: 'Driver sleep', action: async () => await driver.sleep(2000) },
//Validation
{
description: 'Validate text',
action: async () => {
const elementText = await driver.findElement(By.css('#namewarn')).getText();
if (elementText !== 'That name is already in use. Please enter a different name.') {
throw new Error(`Expected: "That name is already in use. Please enter a different name."; Actual: "${elementText}"`);
}
console.log('Passed: Create DIV label matched as expected');
}
},
//Validation text color -red
{
description: 'Validate Create Content Set validation text color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#namewarn')).getCssValue('color');
if (elementStyle !== 'rgba(220, 53, 69, 1)') {
throw new Error(`Expected: Create Content Set validation text color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Create Content Set validation text color matched as expected');
}
},
//NEXT ACTION -Enter Content Set name: "Automated Content Set - To be deleted"
{ description: 'Clear content set name', action: async () => await driver.findElement(By.css('.form-row:nth-child(2) #orgname')).clear() },
{ description: 'Driver sleep', action: async () => await driver.sleep(1000) },
{ description: 'Enter content set name', action: async () => await driver.findElement(By.css('.form-row:nth-child(2) #orgname')).sendKeys(createContentSetName) },
{ description: 'Click create button', action: async () => await driver.findElement(By.css('.modal-lg #modalop')).click() },
{ description: 'Driver sleep', action: async () => await driver.sleep(2000) },
//Validate confirmation message
{
description: 'Validate confirmation message',
action: async () => {
const elementText = await driver.findElement(By.css('strong')).getText();
if (elementText !== 'The content set was successfuly created') {
throw new Error(`Expected: Alert banner created confirmation message did not match; Actual: "${elementText}"`);
}
console.log('Passed: Alert banner created confirmation message displayed as expected');
}
},
//Validate confirmation message background color -green
{
description: 'Validate confirmation message background color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#statalert')).getCssValue('background-color');
if (elementStyle !== 'rgba(40, 167, 69, 1)') {
throw new Error(`Expected: Alert banner background color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Alert banner background color matched as expected');
}
},
//Wait for dashboard to load
{
description: 'Wait for dashboard load to completely',
action: async () => {
return await driver.wait(until.elementLocated(By.linkText('View Details')), 10000).catch(() => false);
}
},
//Validate created content item count
{
description: 'Validate created content count',
action: async () => {
const elementText = await driver.findElement(By.css('#content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list .badge')).getText();
if (elementText !== '0') {
throw new Error(`Expected: created content item count did not match; Actual: "${elementText}"`);
}
console.log('Passed: Created content item count matched as expected');
}
},
//ITEMS PAGE
//NEXT ACTION -Click created content set link
{ description: 'Click created content set title link', action: async () => await driver.findElement(By.linkText(createContentSetName)).click() },
//Wait for DIV
{
description: 'Wait for contente page to load',
action: async () => {
return await driver.wait(until.elementLocated(By.css('b:nth-child(2)')), 5000).catch(() => false);
}
},
//Validate content item page - Filter Results label
{
description: 'Validate Filter Results label',
action: async () => {
const elementText = await driver.findElement(By.css('.well > b')).getText();
if (elementText !== 'Filter Results') {
throw new Error(`Expected: Filter Results label did not match; Actual: "${elementText}"`);
}
console.log('Passed: Filter Results label matched as expected');
}
},
//Validate content item page - Filter Results label text font size
{
description: 'Validate Validate content item page - Filter Results label text font size',
action: async () => {
const elementStyle = await driver.findElement(By.css('.well > b')).getCssValue('font-size');
if (elementStyle !== '13px') {
throw new Error(`Expected: Content item page - Filter Results label text font-size did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Content item page - Filter Results label text background text font-size matched as expected');
}
},
//Validate content item page - Grade label
{
description: 'Validate filter - Grade label',
action: async () => {
const elementText = await driver.findElement(By.css('.form-group:nth-child(1) > b')).getText();
if (elementText !== 'Grade') {
throw new Error(`Expected: Filter - Grade label did not match; Actual: "${elementText}"`);
}
console.log('Passed: Filter - Grade label matched as expected');
}
},
//Validate content item page - Grade label text font size
{
description: 'Validate Validate content item page - Grade label text font size',
action: async () => {
const elementStyle = await driver.findElement(By.css('.form-group:nth-child(1) > b')).getCssValue('font-size');
if (elementStyle !== '13px') {
throw new Error(`Expected: Content item page - Grade label text font-size did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Content item page - Grade label text background text font-size matched as expected');
}
},
//Validate content item page - Subject label
{
description: 'Validate filter - Subject label',
action: async () => {
const elementText = await driver.findElement(By.css('.form-group:nth-child(3) > b')).getText();
if (elementText !== 'Subject') {
throw new Error(`Expected: Filter - Subject label did not match; Actual: "${elementText}"`);
}
console.log('Passed: Filter - Subject label matched as expected');
}
},
//Validate content item page - Subject label text font size
{
description: 'Validate Validate content item page - Subject label text font size',
action: async () => {
const elementStyle = await driver.findElement(By.css('.form-group:nth-child(3) > b')).getCssValue('font-size');
if (elementStyle !== '13px') {
throw new Error(`Expected: Content item page - Subject label text font-size did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Content item page - Subject label text background text font-size matched as expected');
}
},
//Validate content item page - Reset All link
{
description: 'Validate filter - Reset All link',
action: async () => {
const elementText = await driver.findElement(By.linkText('Reset All')).getText();
if (elementText !== 'Reset All') {
throw new Error(`Expected: Filter - Reset All link did not match; Actual: "${elementText}"`);
}
console.log('Passed: Filter - Reset All link matched as expected');
}
},
//Validate content item page - Search Results text
{
description: 'Validate Item - Search Results text',
action: async () => {
const elementText = await driver.findElement(By.css('b:nth-child(2)')).getText();
if (elementText !== 'There are no items that match your search criteria.') {
throw new Error(`Expected: "There are no items that match your search criteria." text did not match; Actual: "${elementText}"`);
}
console.log('Passed: Item - Search Results text matched as expected');
}
},
//Validate content item page - Search Results text font size
{
description: 'Validate content item page - Search Results text font size',
action: async () => {
const elementStyle = await driver.findElement(By.css('b:nth-child(2)')).getCssValue('font-size');
if (elementStyle !== '13px') {
throw new Error(`Expected: Content item page - Search Results text font-size did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Content item page - Search Results text background text font-size matched as expected');
}
},
//NEXT ACTION -NAVIGATE BACK TO DASHBOARD
{ description: 'Click Dashboard navigation link', action: async () => await driver.findElement(By.linkText('Dashboard')).click() },
{ description: 'Browser sleep', action: async () => await driver.sleep(10000) },
//Wait for dashboard to load - Correlation Coverages View Details button
{
description: 'Wait for dashboard load to completely',
action: async () => {
return await driver.wait(until.elementLocated(By.linkText('View Details')), 10000).catch(() => false);
}
},
//NEXT ACTION -EXPORT CONTENT
{ description: 'Click Ellipsis icon', action: async () => await driver.findElement(By.css('.fa-ellipsis-h')).click() },
{ description: 'Driver sleep', action: async () => await driver.sleep(2000) },
//Create Content Set icon color -dark blue
{
description: 'Validate create content set icon color',
action: async () => {
const elementStyle = await driver.findElement(By.css('.fa-plus')).getCssValue('color');
if (elementStyle !== 'rgba(33, 37, 41, 1)') {
throw new Error(`Expected: Create Content Set icon color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Create Content Set icon color matched as expected');
}
},
//Create Content Set link text
{
description: 'Validate create content set link text',
action: async () => {
const elementText = await driver.findElement(By.linkText('Create Content Set')).getText();
if (elementText !== 'Create Content Set') {
throw new Error(`Expected: "Create Content Set"; Actual: "${elementText}"`);
}
console.log('Passed: Create Content Set link text matched as expected');
}
},
//Create Content Set link text color -dark blue
{
description: 'Validate create content set link text color',
action: async () => {
const elementStyle = await driver.findElement(By.linkText('Create Content Set')).getCssValue('color');
if (elementStyle !== 'rgba(33, 37, 41, 1)') {
throw new Error(`Expected: Create Content Set link text color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Create Content Set link text color matched as expected');
}
},
//Export Content Set icon color -dark blue
{
description: 'Validate export content set icon color',
action: async () => {
const elementStyle = await driver.findElement(By.css('.fa-download')).getCssValue('color');
if (elementStyle !== 'rgba(33, 37, 41, 1)') {
throw new Error(`Expected: Export Content icon color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Export Content icon color matched as expected');
}
},
//Export Content Set link text
{
description: 'Validate export content set link text',
action: async () => {
const elementText = await driver.findElement(By.linkText('Export Content Set')).getText();
if (elementText !== 'Export Content Set') {
throw new Error(`Expected: "Export Content Set"; Actual: "${elementText}"`);
}
console.log('Passed: Export Content Set link text matched as expected');
}
},
//Export Content Set link text color -dark blue
{
description: 'Validate export content set link text color',
action: async () => {
const elementStyle = await driver.findElement(By.linkText('Export Content Set')).getCssValue('color');
if (elementStyle !== 'rgba(33, 37, 41, 1)') {
throw new Error(`Expected: Export Content Set icon color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Export Content Set icon color matched as expected');
}
},
//NEXT ACTION -Click Export Content Set link
{ description: 'Click Export Content Set link', action: async () => await driver.findElement(By.linkText('Export Content Set')).click() },
{ description: 'Driver sleep', action: async () => await driver.sleep(2000) },
//Wait for dashboard to load
{
description: 'Wait for DIV to open',
action: async () => {
return await driver.wait(until.elementLocated(By.css('.modal-header:nth-child(4) > .modal-title')), 10000).catch(() => false);
}
},
//Export Content Set DIV
{
description: 'Validate export content set DIV title',
action: async () => {
const elementText = await driver.findElement(By.css('.modal-header:nth-child(4) > .modal-title')).getText();
if (elementText !== 'Export Content') {
throw new Error(`Expected: Export set DIV title did not match; Actual: "${elementText}"`);
}
console.log('Passed: Export Content DIV title matched as expected');
}
},
//Export Content Set DIV Title text font size
{
description: 'Validate Export Content Set DIV Title text font size',
action: async () => {
const elementStyle = await driver.findElement(By.css('.modal-header:nth-child(4) > .modal-title')).getCssValue('font-size');
if (elementStyle !== '18px') {
throw new Error(`Expected: Export Content Set DIV Title text font-size did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Export Content Set DIV Title text background text font-size matched as expected');
}
},
//Export Content Set DIV - label
{
description: 'Validate export DIV label text',
action: async () => {
const elementText = await driver.findElement(By.css('#content-export-container > h5')).getText();
if (elementText !== 'Please select one or more content sets to export:') {
throw new Error(`Expected: "Please select one or more content sets to export:" label; Actual: "${elementText}"`);
}
console.log('Passed: Export Content DIV label matched as expected');
}
},
//Export Content Set DIV - label text font size
{
description: 'Validate export DIV label text font size',
action: async () => {
const elementStyle = await driver.findElement(By.css('#content-export-container > h5')).getCssValue('font-size');
if (elementStyle !== '20px') {
throw new Error(`Expected: Export Content label text font-size did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Export Content label text font-size matched as expected');
}
},
//Export Content Set DIV - label
{
description: 'Validate export DIV label',
action: async () => {
const elementText = await driver.findElement(By.css('#content_export .form-label')).getText();
if (elementText !== 'Content Set') {
throw new Error(`Expected: "Content Set"; Actual: "${elementText}"`);
}
console.log('Passed: Export Content DIV label matched as expected');
}
},
//Export Content Set Dropdown
{
description: 'Validate export content set dropdown option',
action: async () => {
const elementOption = await driver.findElement(By.css('.form-group:nth-child(1) .multiselect-selected-text')).getText();
if (elementOption !== 'Please select a Content Set') {
throw new Error(`Expected: "Please select a Content Set"; Actual: "${elementOption}"`);
}
console.log('Passed: Export Content Set dropdown option matched as expected');
}
},
//Export Content Set DIV - Export button text
{
description: 'Validate export DIV - Export button text',
action: async () => {
const elementText = await driver.findElement(By.css('.modal-footer:nth-child(6) > .btn-primary')).getAttribute('value');
if (elementText !== 'Export') {
throw new Error(`Expected: "Export"; Actual: "${elementText}"`);
}
console.log('Passed: Export button text matched as expected');
}
},
//Export Content Set DIV - Export button color -green
{
description: 'Validate export DIV - Export button color',
action: async () => {
const elementStyle = await driver.findElement(By.css('.modal-footer:nth-child(6) > .btn-primary')).getCssValue('background-color');
if (elementStyle !== 'rgba(48, 200, 172, 1)') {
throw new Error(`Expected: Export button color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Export button color matched as expected');
}
},
//Export Content Set DIV - Close button text
{
description: 'Validate export DIV - Close button text',
action: async () => {
const elementText = await driver.findElement(By.css('.btn:nth-child(3)')).getText();
if (elementText !== 'Close') {
throw new Error(`Expected: "Close"; Actual: "${elementText}"`);
}
console.log('Passed: Close DIV label matched as expected');
}
},
//Export Content Set DIV - Close button color -white
{
description: 'Validate export DIV - Close button color',
action: async () => {
const elementStyle = await driver.findElement(By.css('.btn:nth-child(3)')).getCssValue('background-color');
if (elementStyle !== 'rgba(0, 0, 0, 0)') {
throw new Error(`Expected: Close button color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Close button color matched as expected');
}
},
//NEXT ACTION -Click dropdown
{ description: 'Click Export Content dropdown', action: async () => await driver.findElement(By.css('.form-group:nth-child(1) .multiselect-selected-text')).click() },
{ description: 'Driver sleep', action: async () => await driver.sleep(2000) },
//Export search icon
{
description: 'Verify export search icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.show .input-group-prepend img')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Expected: Export search icon not found');
}
console.log('Passed: Export search icon present');
}
},
//Export Content set dropdown placeholder
{
description: 'Validate dropdown placeholder text',
action: async () => {
const elementValue = await driver.findElement(By.css('.show > .multiselect-item .form-control')).getAttribute('placeholder');
if (elementValue !== 'Search') {
throw new Error(`Expected: "Search"; Actual: "${elementValue}"`);
}
console.log('Passed: Export dropdown placeholder text matched as expected');
}
},
//Export X icon
{
description: 'Verify export search X icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.form-group:nth-child(1) .input-group-append img')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Expected: Export search X icon not found');
}
console.log('Passed: Export search X icon present');
}
},
//SEARCH OPTIONS
//Select All checkbox
{
description: 'Verify Select all checkbox icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.show .multiselect-all input')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Expected: Export selectd all checkbox icon not found');
}
console.log('Passed: Export select all checkbox icon present');
}
},
//Select all search text
{
description: 'Validate export Select all text',
action: async () => {
const elementText = await driver.findElement(By.css('.show > .multiselect-item .checkbox')).getText();
if (elementText !== 'Select all') {
throw new Error(`Expected: "Select all"; Actual: "${elementText}"`);
}
console.log('Passed: Select all matched as expected');
}
},
//Select all search text font size
{
description: 'Validate Select all search text font size',
action: async () => {
const elementStyle = await driver.findElement(By.css('.show > .multiselect-item .checkbox')).getCssValue('font-size');
if (elementStyle !== '13.2px') {
throw new Error(`Expected: Select all search text font-size did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Select all search text font-size matched as expected');
}
},
//NEXT ACTION -Filter content list by QA
{ description: 'Filter Content Set Search list by QA', action: async () => await driver.findElement(By.css('.show > .multiselect-item .form-control')).sendKeys('QA') },
{ description: 'Driver sleep', action: async () => await driver.sleep(2000) },
//FILTERED RESULTS
//Select All checkbox
{
description: 'Verify Select all checkbox icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.show .multiselect-all input')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Expected: Export selectd all checkbox icon not found');
}
console.log('Passed: Export select all checkbox icon present');
}
},
//Select all search handle text
{
description: 'Validate export Select all handle text',
action: async () => {
const elementText = await driver.findElement(By.css('.show > .multiselect-item .checkbox')).getText();
if (elementText !== 'Select all') {
throw new Error(`Expected: "Select all"; Actual: "${elementText}"`);
}
console.log('Passed: Select all handle text matched as expected');
}
},
//Algebra - QA checkbox
{
description: 'Verify Algebra checkbox icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.show > li:nth-child(8) input')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Expected: Export Algebra - QA checkbox icon not found');
}
console.log('Passed: Export Algebra - QA checkbox icon present');
}
},
//Algebra - QA search handle text
{
description: 'Validate export Algebra handle text',
action: async () => {
const elementText = await driver.findElement(By.css('.show > li:nth-child(8) .checkbox')).getText();
if (elementText !== 'Algebra - QA') {
throw new Error(`Expected: "Algebra - QA"; Actual: "${elementText}"`);
}
console.log('Passed: Algebra - QA handle text matched as expected');
}
},
//Biology - QA checkbox
{
description: 'Verify Biology checkbox icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.show > li:nth-child(9) input')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Expected: Export Biology - QA checkbox icon not found');
}
console.log('Passed: Export Biology - QA checkbox icon present');
}
},
//Biology - QA search handle text
{
description: 'Validate export Biology handle text',
action: async () => {
const elementText = await driver.findElement(By.css('.show > li:nth-child(9) .checkbox')).getText();
if (elementText !== 'Biology - QA') {
throw new Error(`Expected: "Biology - QA"; Actual: "${elementText}"`);
}
console.log('Passed: Biology - QA handle text matched as expected');
}
},
//English II - QA checkbox
{
description: 'Verify English II checkbox icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.show > li:nth-child(10) input')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Expected: Export English II - QA checkbox icon not found');
}
console.log('Passed: Export English II - QA checkbox icon present');
}
},
//English II - QA search handle text
{
description: 'Validate export English II handle text',
action: async () => {
const elementText = await driver.findElement(By.css('.show > li:nth-child(10) .checkbox')).getText();
if (elementText !== 'English II - QA') {
throw new Error(`Expected: "English II - QA"; Actual: "${elementText}"`);
}
console.log('Passed: English II - QA handle text matched as expected');
}
},
//Geometry - QA checkbox
{
description: 'Verify Geometry checkbox icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.show > li:nth-child(11) input')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Expected: Export Geometry - QA checkbox icon not found');
}
console.log('Passed: Export Geometry - QA checkbox icon present');
}
},
//Geometry - QA search handle text
{
description: 'Validate export Geometry handle text',
action: async () => {
const elementText = await driver.findElement(By.css('.show > li:nth-child(11) .checkbox')).getText();
if (elementText !== 'Geometry - QA') {
throw new Error(`Expected: "Geometry - QA"; Actual: "${elementText}"`);
}
console.log('Passed: Geometry - QA handle text matched as expected');
}
},
//US History - QA checkbox
{
description: 'Verify US History checkbox icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.show > li:nth-child(12) input')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Expected: Export US History - QA checkbox icon not found');
}
console.log('Passed: Export US History - QA checkbox icon present');
}
},
//US History - QA search handle text
{
description: 'Validate export US History handle text',
action: async () => {
const elementText = await driver.findElement(By.css('.show > li:nth-child(12) .checkbox')).getText();
if (elementText !== 'US History - QA') {
throw new Error(`Expected: "US History - QA"; Actual: "${elementText}"`);
}
console.log('Passed: US History - QA handle text matched as expected');
}
},
//Created Content Set Name checkbox
{
description: `Verify ${createContentSetName} checkbox icon is present`,
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.show > li:nth-child(19) input')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error(`Expected: Export "${createContentSetName}" checkbox icon not found`);
}
console.log(`Passed: Export "${createContentSetName}" checkbox icon present`);
}
},
//Created Content Set Name search handle text
{
description: `Validate export ${createContentSetName} handle text`,
action: async () => {
const elementText = await driver.findElement(By.css('.show > li:nth-child(19) .checkbox')).getText();
if (elementText !== createContentSetName) {
throw new Error(`Expected: "${createContentSetName}"; Actual: "${elementText}"`);
}
console.log(`Passed: "${createContentSetName}" handle text matched as expected`);
}
},
//NEXT ACTION -Select created content set to export
{ description: 'Click Automated QA checkbox', action: async () => await driver.findElement(By.css('.show > li:nth-child(19) input')).click() },
{ description: 'Browser sleep', action: async () => await driver.sleep(2000) },
{ description: 'Click Export button', action: async () => await driver.findElement(By.css('.modal-footer:nth-child(6) > .btn-primary')).click() },
{ description: 'Wait for export page to load', action: async () => await driver.sleep(5000) },
//Export page title
{
description: 'Validate Export page title',
action: async () => {
const elementText = await driver.findElement(By.css('h2')).getText();
if (elementText !== 'Export') {
throw new Error(`Expected: "Export"; Actual: "${elementText}"`);
}
console.log('Passed: Export page title matched as expected');
}
},
//Export page title text color -dark blue
{
description: 'Validate Export page title text font color',
action: async () => {
const elementStyle = await driver.findElement(By.css('h2')).getCssValue('color');
if (elementStyle !== 'rgba(40, 39, 90, 1)') {
throw new Error(`Export page title text font color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Export page title text font color matched as expected');
}
},
//Export page title text font size
{
description: 'Validate Export page title text font size',
action: async () => {
const elementStyle = await driver.findElement(By.css('h2')).getCssValue('font-size');
if (elementStyle !== '32px') {
throw new Error(`Expected: Export page title text font-size did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Export page title text font-size matched as expected');
}
},
//Export complete label
{
description: 'Validate Export complete label',
action: async () => {
const elementText = await driver.findElement(By.css('b')).getText();
if (elementText !== 'Export complete!') {
throw new Error(`Expected: "Export complete!"; Actual: "${elementText}"`);
}
console.log('Passed: Export complete! label matched as expected');
}
},
//Export complete label text font size
{
description: 'Validate Export complete label text font size',
action: async () => {
const elementStyle = await driver.findElement(By.css('b')).getCssValue('font-size');
if (elementStyle !== '13px') {
throw new Error(`Expected:Export complete label text font-size did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Export complete label text font-size matched as expected');
}
},
//Download Export button icon
{
description: 'Verify Download Export button icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.fa-download')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Expected: Download Export button icon not found');
}
console.log('Passed: Download Export button icon present');
}
},
//Download Export button text
{
description: 'Validate Download Export button text',
action: async () => {
const elementText = await driver.findElement(By.linkText('Download Export')).getText();
if (elementText !== 'Download Export') {
throw new Error(`Expected: "Download Export"; Actual: "${elementText}"`);
}
console.log('Passed: Download Export button text matched as expected');
}
},
//Download Export button color -dark blue
{
description: 'Validate Download Export button color',
action: async () => {
const elementStyle = await driver.findElement(By.linkText('Download Export')).getCssValue('background-color');
if (elementStyle !== 'rgba(40, 39, 90, 1)') {
throw new Error(`Expected: Download Export button color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Download Export button color matched as expected');
}
},
//NEXT ACTION -NAVIGATE BACK TO DASHBOARD
{ description: 'Click Dashboard navigation link', action: async () => await driver.findElement(By.linkText('Dashboard')).click() },
{ description: 'Browser sleep', action: async () => await driver.sleep(10000) },
//Wait for dashboard to load - Correlation Coverages View Details button
{
description: 'Wait for dashboard load to completely',
action: async () => {
return await driver.wait(until.elementLocated(By.linkText('View Details')), 10000).catch(() => false);
}
},
//NEXT ACTION -Filter content list by - QA
{ description: 'Enter content set name', action: async () => await driver.findElement(By.css('#content-org-filter')).sendKeys('QA') },
{ description: 'Wait for content list to filter', action: async () => await driver.sleep(2000) },
//Validate sort order by applying filter QA
//Biology - QA = 1046 (1st)
{
description: 'Validate by filter QA: Biology - QA 1046 count in 1st place',
action: async () => {
const elementText = await driver.findElement(By.xpath('//li/div/span')).getText();
if (elementText !== '1046') {
throw new Error(`Expected: Filtered by QA: Biology - QA count "1046" not sorted in 1st place; Actual: "${elementText}"`);
}
console.log('Passed: Filtered by QA: Biology - QA count 1046 sorted in 1st place');
}
},
//Geometry - QA = 981 (2nd)
{
description: 'Validate by filter QA: Geometry - QA 981 count in 2nd place',
action: async () => {
const elementText = await driver.findElement(By.xpath('//ul/ul/li/div/span')).getText();
if (elementText !== '981') {
throw new Error(`Expected: Filtered by QA: Geometry - QA count "981" not sorted in 2nd place; Actual: "${elementText}"`);
}
console.log('Passed: Filtered by QA: Geometry - QA count 981 sorted in 2nd place');
}
},
//English II - QA = 409 (3rd)
{
description: 'Validate by filter QA: English II - QA 409 count in 3rd place',
action: async () => {
const elementText = await driver.findElement(By.xpath('//ul/ul/ul/ul/li/div/span')).getText();
if (elementText !== '409') {
throw new Error(`Expected: Filtered by QA: English II - QA count "409" not sorted in 3rd place; Actual: "${elementText}"`);
}
console.log('Passed: Filtered by QA: English II - QA count 409 sorted in 3rd place');
}
},
//Algebra - QA = 188 (4th)
{
description: 'Validate by filter QA: Algebra - QA 188 count in 4th place',
action: async () => {
const elementText = await driver.findElement(By.xpath('//ul/ul/ul/ul/ul/li/div/span')).getText();
if (elementText !== '188') {
throw new Error(`Expected: Filtered by QA: Algebra - QA count "188" not sorted in 4th place; Actual: "${elementText}"`);
}
console.log('Passed: Filtered by QA: Algebra - QA count 188 sorted in 4th place');
}
},
//US History - QA = 62 (5th)
{
description: 'Validate by filter QA: US History - QA 162 count in 5th place',
action: async () => {
const elementText = await driver.findElement(By.xpath('//ul/ul/ul/ul/ul/ul/li/div/span')).getText();
if (elementText !== '62') {
throw new Error(`Expected: Filtered by QA: US History - QA count "62" not sorted in 5th place; Actual: "${elementText}"`);
}
console.log('Passed: Filtered by QA: US History - QA count 62 sorted in 5th place');
}
},
//Created Content Set = 0 (6th)
{
description: `Validate by filter QA: ${createContentSetName} 0 count in 6th place`,
action: async () => {
const elementText = await driver.findElement(By.xpath('//ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/li/div/span')).getText();
if (elementText !== '0') {
throw new Error(`Expected: Filtered by QA: ${createContentSetName} count "0" not sorted in 6th place; Actual: "${elementText}"`);
}
console.log(`Passed: Filtered by QA: ${createContentSetName} count 0 sorted in 6th place`);
}
},
//NEXT ACTION -Sort content set list by applying sort by Name
{ description: 'Select filter sort order by Name', action: async () => await driver.findElement(By.css('#orgsort > option:nth-child(2)')).click() },
{ description: 'Wait for content list to filter', action: async () => await driver.sleep(2000) },
//Algebra - QA = 188 (1st)
{
description: 'Validate by filter name: Algebra - QA 188 count in 1st place',
action: async () => {
const elementText = await driver.findElement(By.xpath('//li/div/span')).getText();
if (elementText !== '188') {
throw new Error(`Expected: Filtered by Name: Algebra - QA count "188" not sorted in 1st place; Actual: "${elementText}"`);
}
console.log('Passed: Filtered by Name: Algebra - QA count 188 sorted in 1st place');
}
},
//Created Content Set = 0 (2nd)
{
description: `Validate by filter name: ${createContentSetName} 0 count in 2nd place`,
action: async () => {
const elementText = await driver.findElement(By.xpath('//ul/ul/li/div/span')).getText();
if (elementText !== '0') {
throw new Error(`Expected: Filtered by Name: ${createContentSetName} count "0" not sorted in 2nd place; Actual: "${elementText}"`);
}
console.log(`Passed: Filtered by Name: ${createContentSetName} count 0 sorted in 2nd place`);
}
},
//Biology - QA = 1046 (3rd)
{
description: 'Validate by filter name: Biology - QA 1046 count in 3rd place',
action: async () => {
const elementText = await driver.findElement(By.xpath('//ul/ul/ul/li/div/span')).getText();
if (elementText !== '1046') {
throw new Error(`Expected: Filtered by Name: Biology - QA count "1046" not sorted in 3rd place; Actual: "${elementText}"`);
}
console.log('Passed: Filtered by Name: Biology - QA count 1046 sorted in 3rd place');
}
},
//Demo - User Submitted Content = 17 (4th)
{
description: 'Validate by filter name: Demo - User Submitted Content 17 count in 4th place',
action: async () => {
const elementText = await driver.findElement(By.xpath('//ul/ul/ul/ul/li/div/span')).getText();
if (elementText !== '17') {
throw new Error(`Expected: Filtered by Name: Demo - User Submitted ContentA count "17" not sorted in 4th place; Actual: "${elementText}"`);
}
console.log('Passed: Filtered by Name: Demo - User Submitted Content count 17 sorted in 4th place');
}
},
//English II - QA = 409 (5th)
{
description: 'Validate by filter name: English II - QA 409 count in 5th place',
action: async () => {
const elementText = await driver.findElement(By.xpath('//ul/ul/ul/ul/ul/li/div/span')).getText();
if (elementText !== '409') {
throw new Error(`Expected: Filtered by Name: English II - QA count "409" not sorted in 5th place; Actual: "${elementText}"`);
}
console.log('Passed: Filtered by Name: English II - QA 409 count 409 sorted in 5th place');
}
},
//Exploring - Access = 0 (6th)
{
description: `Validate by filter name: Exploring - Access 0 count in 6th place`,
action: async () => {
const elementText = await driver.findElement(By.xpath('//ul/ul/ul/ul/ul/ul/li/div/span')).getText();
if (elementText !== '0') {
throw new Error(`Expected: Filtered by Name: Exploring - Access count "0" not sorted in 6th place; Actual: "${elementText}"`);
}
console.log(`Passed: Filtered by Name: Exploring - Access count 0 sorted in 6th place`);
}
},
//NEXT ACTION -Filter content list by - QA by applying sort by Name and filtered by QA
{ description: 'Enter content set name', action: async () => await driver.findElement(By.css('#content-org-filter')).sendKeys('QA') },
{ description: 'Wait for content list to filter', action: async () => await driver.sleep(2000) },
//Algebra - QA = 188 (1st)
{
description: 'Validate by filter QA and sorted by name: Algebra - QA 188 count in 1st place',
action: async () => {
const elementText = await driver.findElement(By.xpath('//li/div/span')).getText();
if (elementText !== '188') {
throw new Error(`Expected: Filtered by QA and sorted by Name: Algebra - QA count "188" not sorted in 1st place; Actual: "${elementText}"`);
}
console.log('Passed: Filtered by QA and sorted by Name: Algebra - QA count 188 sorted in 1st place');
}
},
//Created Content Set = 0 (2nd)
{
description: `Validate by filter QA and sorted by name: ${createContentSetName} 0 count in 2nd place`,
action: async () => {
const elementText = await driver.findElement(By.xpath('//ul/ul/li/div/span')).getText();
if (elementText !== '0') {
throw new Error(`Expected: Filtered by QA and sorted by Name: ${createContentSetName} count "0" not sorted in 2nd place; Actual: "${elementText}"`);
}
console.log(`Passed: Filtered by QA and sorted by Name: ${createContentSetName} count 0 sorted in 2nd place`);
}
},
//Biology - QA = 1046 (3rd)
{
description: 'Validate by filter QA and sorted by name: Biology - QA 1046 count in 3rd place',
action: async () => {
const elementText = await driver.findElement(By.xpath('//ul/ul/ul/li/div/span')).getText();
if (elementText !== '1046') {
throw new Error(`Expected: Filtered by QA and sorted by Name: Biology - QA count "1046" not sorted in 3rd place; Actual: "${elementText}"`);
}
console.log('Passed: Filtered by QA and sorted by Name: Biology - QA count 1046 sorted in 3rd place');
}
},
//English II - QA = 409 (4th)
{
description: 'Validate by filter QA and sorted by name: English II - QA 409 count in 4th place',
action: async () => {
const elementText = await driver.findElement(By.xpath('//ul/ul/ul/ul/ul/li/div/span')).getText();
if (elementText !== '409') {
throw new Error(`Expected: Filtered by QA and sorted by Name: English II - QA count "409" not sorted in 4th place; Actual: "${elementText}"`);
}
console.log('Passed: Filtered by QA and sorted by Name: English II - QA 409 count 409 sorted in 4th place');
}
},
//Geometry - QA = 981 (5th)
{
description: 'Validate by filter QA and sorted by name: Geometry - QA 981 count in 5th place',
action: async () => {
const elementText = await driver.findElement(By.xpath('//ul/ul/ul/ul/ul/ul/ul/ul/ul/li/div/span')).getText();
if (elementText !== '981') {
throw new Error(`Expected: Filtered by QA and sorted by Name: Geometry - QA count "981" not sorted in 5th place; Actual: "${elementText}"`);
}
console.log('Passed: Filtered by QA and sorted by Name: Geometry - QA count 981 sorted in 5th place');
}
},
//US History - QA = 62 (6th)
{
description: 'Validate by filter QA and sorted by name: US History - QA 162 count in 6th place',
action: async () => {
const elementText = await driver.findElement(By.xpath('//ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/li/div/span')).getText();
if (elementText !== '62') {
throw new Error(`Expected: Filtered by QA and sorted by Name: US History - QA count "62" not sorted in 6th place; Actual: "${elementText}"`);
}
console.log('Passed: Filtered by QA and sorted by Name: US History - QA count 62 sorted in 6th place');
}
},
//NEXT ACTION -DELETE CREATED CONTENT SET
{ description: `Click ${createContentSetName} edit icon`, action: async () => await driver.findElement(By.css('#mycontentlist > #content-org-list > #content-org-list > .content-org .fa')).click() },
{ description: 'Wait for Edit Content DIV to open', action: async () => await driver.sleep(5000) },
//Wait for dashboard to load
{
description: 'Wait for DIV to open',
action: async () => {
return await driver.wait(until.elementLocated(By.css('.modal-lg .modal-title')), 10000).catch(() => false);
}
},
//Edit Content Set DIV
{
description: 'Validate Edit DIV title',
action: async () => {
const elementText = await driver.findElement(By.css('.modal-lg .modal-title')).getText();
if (elementText !== 'Edit Content Set') {
throw new Error(`Expected: Edit DIV title did not match; Actual: "${elementText}"`);
}
console.log('Passed: Edit DIV title matched as expected');
}
},
//Edit Content Set DIV title text font size
{
description: 'Validate Edit Content Set DIV title text font size',
action: async () => {
const elementStyle = await driver.findElement(By.css('.modal-lg .modal-title')).getCssValue('font-size');
if (elementStyle !== '18px') {
throw new Error(`Expected: Edit Content Set DIV title text font-size did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Edit Content Set DIV title text background text font-size matched as expected');
}
},
//Edit Content Set DIV - Content Set Name label
{
description: 'Validate Edit DIV - Content Set Name label',
action: async () => {
const elementText = await driver.findElement(By.css('.modal-lg .form-label')).getText();
if (elementText !== 'Content Set Name') {
throw new Error(`Expected: "Content Set Name" label; Actual: "${elementText}"`);
}
console.log('Passed: Content Set Name label matched as expected');
}
},
//Edit Content Set DIV - Content Set Name label text font size
{
description: 'Validate Edit Content Set DIV - Content Set Name label text font size',
action: async () => {
const elementStyle = await driver.findElement(By.css('.modal-lg .form-label')).getCssValue('font-size');
if (elementStyle !== '15px') {
throw new Error(`Expected: Edit Content Set DIV - Content Set Name label text font-size did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Edit Content Set DIV - Content Set Name label text background text font-size matched as expected');
}
},
//Edit Content Set DIV - textbox
{
description: 'Validate Edit DIV textbox',
action: async () => {
const elementValue = await driver.findElement(By.css('#orgname')).getAttribute('value');
if (elementValue !== createContentSetName) {
throw new Error(`Expected: Edit DIV textbox Expected: "${createContentSetName}"; Actual: "${elementValue}"`);
}
console.log('Passed: Edit DIV textbox matched as expected');
}
},
//Edit Content Set DIV - Delete button
{
description: 'Validate Edit DIV delete text button',
action: async () => {
const elementText = await driver.findElement(By.css('.modal-lg #orgdelete')).getText();
if (elementText !== 'Delete') {
throw new Error(`Expected: "Delete"; Actual: "${elementText}"`);
}
console.log('Passed: Edit DIV delete text button matched as expected');
}
},
//Edit Content Set DIV - Delete button color -red
{
description: 'Validate Edit DIV delete button color',
action: async () => {
const elementStyle = await driver.findElement(By.css('.modal-lg #orgdelete')).getCssValue('background-color');
if (elementStyle !== 'rgba(220, 53, 69, 1)') {
throw new Error(`Expected: Edit DIV delete button color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Edit DIV delete button color matched as expected');
}
},
//Edit Content Set DIV - Save button
{
description: 'Validate Edit DIV save text button',
action: async () => {
const elementText = await driver.findElement(By.css('#modalop')).getAttribute('value');
if (elementText !== 'Save') {
throw new Error(`Expected: "Save"; Actual: "${elementText}"`);
}
console.log('Passed: Edit DIV save text button matched as expected');
}
},
//Edit Content Set DIV - Save button color -green
{
description: 'Validate Edit DIV save button color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#modalop')).getCssValue('background-color');
if (elementStyle !== 'rgba(48, 200, 172, 1)') {
throw new Error(`Expected: Edit DIV save button color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Edit DIV save button color matched as expected');
}
},
//Edit Content Set DIV - Close button
{
description: 'Validate Edit DIV close text button',
action: async () => {
const elementText = await driver.findElement(By.css('#modalclose')).getText();
if (elementText !== 'Close') {
throw new Error(`Expected: "Close"; Actual: "${elementText}"`);
}
console.log('Passed: Edit DIV close text button matched as expected');
}
},
//Edit Content Set DIV - Close button color -white
{
description: 'Validate Edit DIV close button color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#modalclose')).getCssValue('background-color');
if (elementStyle !== 'rgba(0, 0, 0, 0)') {
throw new Error(`Expected: Edit DIV close button color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Edit DIV close button color matched as expected');
}
},
//NEXT ACTION -Delete created content set
{
description: 'Delete created content and validate assert message',
action: async () => {
await driver.wait(
until.elementLocated(By.css('#myModal')),
5000
);
await driver.sleep(2000);
const deleteButton = await driver.wait(
until.elementLocated(By.css('#orgdelete')),
5000
);
await deleteButton.click();
await driver.sleep(2000);
const alert = await driver.wait(
until.alertIsPresent(),
5000
);
const alertText = await alert.getText();
try {
if (alertText !== `Are you sure you want to delete ${createContentSetName}? This operation cannot be undone or recovered.`) {
throw new Error(`Expected: "Are you sure you want to delete ${createContentSetName}? This operation cannot be undone or recovered."; Actual: "${alertText}"`);
}
console.log('Passed: Delete Alert DIV text matched as expected');
console.log('Passed: Delete Alert DIV, OK/Cancel button text matched as expected');
} catch (error) {
console.error('FAILED: Delete Alert DIV, unable to validate text; Error Message: ', error.message);
await alert.dismiss();
throw error;
}
await alert.accept();
await driver.sleep(2000);
}
},
//Validate confirmation message
{
description: 'Validate confirmation message',
action: async () => {
const elementText = await driver.findElement(By.css('strong')).getText();
if (elementText !== 'The content set was successfuly deleted') {
throw new Error(`Expected: Alert banner deleted confirmation message did not match; Actual: "${elementText}"`);
}
console.log('Passed: Alert banner deleted confirmation message displayed as expected');
}
},
//Validate confirmation message background color -green
{
description: 'Validate confirmation message background color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#statalert')).getCssValue('background-color');
if (elementStyle !== 'rgba(40, 167, 69, 1)') {
throw new Error(`Expected: Alert banner background color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Alert banner background color matched as expected');
}
},
//Wait for dashboard to load
{
description: 'Wait for dashboard load to completely',
action: async () => {
return await driver.wait(until.elementLocated(By.linkText('View Details')), 10000).catch(() => false);
}
},
//Verify content was deleted
{
description: 'Verify content set deletion',
action: async () => {
const filterSearch = await driver.wait(
until.elementLocated(By.css('#content-org-filter')),
5000
);
await filterSearch.clear();
await filterSearch.sendKeys('QA');
await driver.sleep(2000);
const createdContentSet = await driver.findElements(
By.linkText(createContentSetName)
);
if (createdContentSet.length > 0) {
throw new Error('Content set was not deleted successfully');
}
}
}
];
const logStep = (worksheet, stepDescription, status, stepIndex, timestamp, screenshotPath) => {
const json_data = XLSX.utils.sheet_to_json(worksheet, { header: 1 });
json_data.push([stepIndex, stepDescription, status, timestamp, screenshotPath]);
return XLSX.utils.aoa_to_sheet(json_data);
};
const takeScreenshot = async (driver, stepIndex, stepDescription) => {
const screenshot = await driver.takeScreenshot();
const dir = path.join('screenshots', 'dashboardMyContent');
const screenshotFileName = `step_${stepIndex}_${stepDescription.replace(/\s+/g, '_')}.png`;
const screenshotPath = path.join(dir, screenshotFileName);
fs.writeFileSync(screenshotPath, screenshot, 'base64');
return screenshotPath;
};
const clearOldResults = () => {
// Remove old screenshots
const screenshotDir = path.join('screenshots', 'dashboardMyContent');
if (fs.existsSync(screenshotDir)) {
fs.rmSync(screenshotDir, { recursive: true, force: true });
}
fs.mkdirSync(screenshotDir, { recursive: true });
// Remove old Excel file
if (fs.existsSync('dashboardMyContentResults.xlsx')) {
fs.unlinkSync('dashboardMyContentResults.xlsx');
}
};
try {
// Initialize workbook and worksheet
clearOldResults();
// Initialize workbook and worksheet
workbook = XLSX.utils.book_new();
worksheet = XLSX.utils.aoa_to_sheet([
['Step Number', 'Step Description', 'Status', 'Timestamp', 'Screenshot']
]);
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
// Log test start time
worksheet = logStep(worksheet, 'Test Start', 'Started', '', startTime, '');
for (const step of steps) {
const stepIndex = steps.indexOf(step) + 1;
const timestamp = new Date().toISOString();
try {
await step.action();
const screenshotPath = await takeScreenshot(driver, stepIndex, step.description);
worksheet = logStep(worksheet, step.description, 'Passed', stepIndex, timestamp, screenshotPath);
} catch (error) {
const screenshotPath = await takeScreenshot(driver, stepIndex, `${step.description}_Failed`);
worksheet = logStep(worksheet, step.description, 'Failed', stepIndex, timestamp, screenshotPath);
console.error(`Step ${stepIndex} FAILED: ${error.message}`);
testStatus = 'Failed';
}
}
//Check if login was successful
const usernameValidation = await driver.wait(until.elementLocated(By.css('#navbarDropdown > span')), 5000).catch(() => false);
if (usernameValidation) {
console.log('PASSED: System logged in as expected');
testStatus = 'Passed';
} else {
console.log('FAILED: Unable to log in');
testStatus = 'Failed';
}
// Log test end time
const endTime = new Date().toISOString();
worksheet = logStep(worksheet, 'Test End', testStatus, '', endTime, '');
// Write the updated worksheet back to the workbook and save it
workbook.Sheets['Sheet1'] = worksheet;
XLSX.writeFile(workbook, 'dashboardMyContentResults.xlsx');
} finally {
await driver.quit();
}
})();
}
export default ExACT_dashboardMyContent;