2555 lines
96 KiB
JavaScript
2555 lines
96 KiB
JavaScript
import { Builder, By, Key, until } from 'selenium-webdriver';
|
|
import fs from 'fs';
|
|
import XLSX from 'xlsx';
|
|
import path from 'path';
|
|
|
|
const ExACT_editItem = (req, res) => {
|
|
res.send('<h2>ExACT Automated Test Script - Edit Item(ExACT_editItem): 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();
|
|
|
|
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 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');
|
|
}
|
|
},
|
|
|
|
//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 link 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(`Biology-QA edit icon color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Bioloby-QA edit icon color matched as expected');
|
|
}
|
|
},
|
|
|
|
//Biology-QA Count
|
|
{
|
|
description: 'Validate Biology-QA Count',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('#mycontentlist > #content-org-list > .content-org .badge')).getText();
|
|
if (elementText !== '1046') {
|
|
throw new Error(`Expected: "1046"; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Biology-QA Count matched as expected');
|
|
}
|
|
},
|
|
|
|
//NEXT ACTION - NAVIGATE TO CONTENT PAGE
|
|
{ description: 'Click Biology - QA link', action: async () => await driver.findElement(By.linkText('Biology - QA')).click() },
|
|
|
|
//Wait for Biology - QA Content page to load
|
|
{
|
|
description: 'Wait for Content page load to completely',
|
|
action: async () => {
|
|
return await driver.wait(until.elementLocated(By.css('.float-left:nth-child(5)')), 10000).catch(() => false);
|
|
}
|
|
},
|
|
|
|
//Results 1-25 of 1046 label
|
|
{
|
|
description: 'Validate Results 1-25 of 1046 label',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.float-left:nth-child(5)')).getText();
|
|
if (elementText !== 'Results 1 - 25 of 1046') {
|
|
throw new Error(`Expected: "Results 1 - 25 of 1046" label; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Results 1 - 25 of 1046 label matched as expected');
|
|
}
|
|
},
|
|
|
|
//CONTENT RESULTS - CONTENT ITEMS
|
|
//Content 1 Title
|
|
{
|
|
description: 'Validate Content 1 title',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.linkText('AAA My Test III')).getText();
|
|
if (elementText !== 'AAA My Test III') {
|
|
throw new Error(`Expected: Content 1 item "AAA My Test III" title; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Content 1 item AAA My Test III tittle matched as expected');
|
|
}
|
|
},
|
|
|
|
//Content 1 edit icon
|
|
{
|
|
description: 'Verify Content 1 edit icon is present',
|
|
action: async () =>
|
|
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.card:nth-child(8) .lo-title .fa')), 5000).catch(() => false);
|
|
if (!expectedIcon) {
|
|
throw new Error('Content 1 edit icon not found');
|
|
}
|
|
console.log('Passed: Content 1 edit icon present');
|
|
}
|
|
},
|
|
|
|
//Content 1 edit button text
|
|
{
|
|
description: 'Validate Content 1 edit button text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.card:nth-child(8) .ml-3')).getText();
|
|
if (elementText !== 'Edit') {
|
|
throw new Error(`Expected: Content 1 "Edit" button text; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Content 1 Edit button text matched as expected');
|
|
}
|
|
},
|
|
|
|
//Content 1 edit button color -green
|
|
{
|
|
description: 'Validate Content 1 Edit button color',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.css('.card:nth-child(8) .ml-3')).getCssValue('background-color');
|
|
if (elementStyle !== 'rgba(48, 200, 172, 1)') {
|
|
throw new Error(`Expected: Content 1 "Edit" button color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Content 1 Edit button color matched as expected');
|
|
}
|
|
},
|
|
|
|
//Content 1 description
|
|
{
|
|
description: 'Validate Content 1 description',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.card:nth-child(8) .lo-descr')).getText();
|
|
if (elementText !== 'Yes, it should work! Perhaps') {
|
|
throw new Error(`Expected: Content 1 description text did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Content 1 description text matched as expected');
|
|
}
|
|
},
|
|
|
|
//Content 1 content set label
|
|
{
|
|
description: 'Validate Content 1 content set label',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.card:nth-child(8) small')).getText();
|
|
if (elementText !== 'Content Set: Biology - QA') {
|
|
throw new Error(`Expected: Content 1 content set label did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Content 1 content set label matched as expected');
|
|
}
|
|
},
|
|
|
|
//Content 1 alignment label
|
|
{
|
|
description: 'Validate Content 1 ECS Alignement label',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('#alignstatuslink874454004 > .display-alignment')).getText();
|
|
if (elementText !== 'Aligned (reset)') {
|
|
throw new Error(`Expected: Content 1 "ECS Alignement" label did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Content 1 ECS Alignement label matched as expected');
|
|
}
|
|
},
|
|
|
|
//Content 1 alignment reset label
|
|
{
|
|
description: 'Validate Content 1 ECS Alignement reset label',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('#alignstatuslink874454004 b')).getText();
|
|
if (elementText !== 'reset') {
|
|
throw new Error(`Expected: Content 1 "ECS Alignement" reset label did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Content 1 ECS Alignement reset label matched as expected');
|
|
}
|
|
},
|
|
|
|
//Content 1 view standards button icon
|
|
{
|
|
description: 'Verify Content 1 View Standards button icon is present',
|
|
action: async () =>
|
|
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.card:nth-child(8) .well .fa')), 5000).catch(() => false);
|
|
if (!expectedIcon) {
|
|
throw new Error('Content 1 "View Standards" button icon not found');
|
|
}
|
|
console.log('Passed: Content 1 View Standards button icon present');
|
|
}
|
|
},
|
|
|
|
//Content 1 view standards button text
|
|
{
|
|
description: 'Validate Content 1 View Standards button text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.card:nth-child(8) .well > .btn')).getText();
|
|
if (elementText !== 'View Standards') {
|
|
throw new Error(`Expected: Content 1 "View Standards" button text did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Content 1 View Standards button text matched as expected');
|
|
}
|
|
},
|
|
|
|
//Content 1 view standards button color -green
|
|
{
|
|
description: 'Validate Content 1 view standards button color',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.css('.card:nth-child(8) .well > .btn')).getCssValue('background-color');
|
|
if (elementStyle !== 'rgba(48, 200, 172, 1)') {
|
|
throw new Error(`Expected: Content 1 "View Standards" button color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Content 1 View Standards button color matched as expected');
|
|
}
|
|
},
|
|
|
|
//NEXT ACTION - VIEW STANDARDS DIV
|
|
{ description: 'Click Content 1 Edit button', action: async () => await driver.findElement(By.css('.card:nth-child(8) .well > .btn')).click() },
|
|
|
|
//Wait for Edit page to open - Resource tab
|
|
{
|
|
description: 'Wait for Edit page to open',
|
|
action: async () => {
|
|
return await driver.wait(until.elementLocated(By.css('.modal-title')), 5000).catch(() => false);
|
|
}
|
|
},
|
|
|
|
//Content 1 view standards DIV
|
|
{
|
|
description: 'Validate Standards DIV title text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.modal-title')).getText();
|
|
if (elementText !== 'View Standards') {
|
|
throw new Error(`Expected: Content 1 "View Standards" button text did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Content 1 View Standards button text matched as expected');
|
|
}
|
|
},
|
|
|
|
//View standards x close icon color -red
|
|
{
|
|
description: 'Validate Content 1 View standards x icon color',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.css('.modal-header span')).getCssValue('color');
|
|
if (elementStyle !== 'rgba(246, 60, 40, 1)') {
|
|
throw new Error(`Expected: Content 1 X icon color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Content 1 X icon color matched as expected');
|
|
}
|
|
},
|
|
|
|
//Content 1 view standards DIV sub-title
|
|
{
|
|
description: 'Validate Standards DIV sub-title text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.mb-1:nth-child(1)')).getText();
|
|
if (elementText !== 'Please select which standards you wish to view:') {
|
|
throw new Error(`Expected: Content 1 "Please select which standards you wish to view" sub-title text did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Content 1 Please select which standards you wish to view: sub-title text matched as expected');
|
|
}
|
|
},
|
|
|
|
//Content 1 view standards DIV label
|
|
{
|
|
description: 'Validate Standards DIV label',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('label > b')).getText();
|
|
if (elementText !== 'Standards') {
|
|
throw new Error(`Expected: Content 1 "Standards" label did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Content 1 Standards label matched as expected');
|
|
}
|
|
},
|
|
|
|
//Select Standards dropdown
|
|
{
|
|
description: 'Validate select standards dropdown value',
|
|
action: async () => {
|
|
const elementValue = await driver.findElement(By.css('#iStateIds')).getAttribute('value');
|
|
if (elementValue !== 'none') {
|
|
throw new Error(`Expected: Dropdown value to be "none" (Select Standards); Actual: "${elementValue}"`);
|
|
}
|
|
console.log('Passed: Dropdown value "none" (Select Standards), matched as expected');
|
|
}
|
|
},
|
|
|
|
//View standards button text
|
|
{
|
|
description: 'Validate View Standards button text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.form-group > .btn')).getAttribute('value');
|
|
if (elementText !== 'View Standards') {
|
|
throw new Error(`Expected: Content 1 "View Standards" button text did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Content 1 View Standards button text matched as expected');
|
|
}
|
|
},
|
|
|
|
//View standards button color -green
|
|
{
|
|
description: 'Validate Content 1 View standards button color',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.css('.form-group > .btn')).getCssValue('background-color');
|
|
if (elementStyle !== 'rgba(48, 200, 172, 1)') {
|
|
throw new Error(`Expected: Content 1 "View Standards" button color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Content 1 View Standards button color matched as expected');
|
|
}
|
|
},
|
|
|
|
//NEXT ACTION - CLOSE VIEW STANDARDS DIV
|
|
{ description: 'Click close icon', action: async () => await driver.findElement(By.css('.modal-header span')).click() },
|
|
{ description: 'Wait for process to complete', action: async () => await driver.sleep(2000) },
|
|
|
|
//NEXT ACTION - EDIT CONTENT PAGE
|
|
{ description: 'Click Content 1 Edit button', action: async () => await driver.findElement(By.css('.card:nth-child(8) .ml-3')).click() },
|
|
|
|
//Wait for Edit page to open - Resource tab
|
|
{
|
|
description: 'Wait for Edit page to open',
|
|
action: async () => {
|
|
return await driver.wait(until.elementLocated(By.css('#myModalLabel')), 5000).catch(() => false);
|
|
}
|
|
},
|
|
|
|
//Page title
|
|
{
|
|
description: 'Validate Page title',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('#myModalLabel')).getText();
|
|
if (elementText !== 'Edit Item') {
|
|
throw new Error(`Expected: "Edit Item" title did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Edit Item title matched as expected');
|
|
}
|
|
},
|
|
|
|
//Page title color -navy blue
|
|
{
|
|
description: 'Validate Page title color',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.css('#myModalLabel')).getCssValue('color');
|
|
if (elementStyle !== 'rgba(40, 39, 90, 1)') {
|
|
throw new Error(`Expected: "Edit Item" Page title color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Edit Item Page title color matched as expected');
|
|
}
|
|
},
|
|
|
|
//Page title font size -32px
|
|
{
|
|
description: 'Validate Page title font size',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.css('#myModalLabel')).getCssValue('font-size');
|
|
if (elementStyle !== '32px') {
|
|
throw new Error(`Expected: "Edit Item" Page title font size did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Edit Item Page title font size matched as expected');
|
|
}
|
|
},
|
|
|
|
//Resource tab
|
|
{
|
|
description: 'Validate edit item tab 1',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.linkText('Resource')).getText();
|
|
if (elementText !== 'Resource') {
|
|
throw new Error(`Expected: "Resource" tab label did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Resource tab label matched as expected');
|
|
}
|
|
},
|
|
|
|
//Resource tab label color -navy blue
|
|
{
|
|
description: 'Validate edit item tab 1',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.linkText('Resource')).getCssValue('color');
|
|
if (elementStyle !== 'rgba(40, 39, 90, 1)') {
|
|
throw new Error(`Expected: Active "Resource" tab label color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Active Resource tab label color matched as expected');
|
|
}
|
|
},
|
|
|
|
//Metadata tab
|
|
{
|
|
description: 'Validate edit item tab 2',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.linkText('Metadata')).getText();
|
|
if (elementText !== 'Metadata') {
|
|
throw new Error(`Expected: "Metadata" tab label did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Metadata tab label matched as expected');
|
|
}
|
|
},
|
|
|
|
//Metadata tab label color -gray (dimmed)
|
|
{
|
|
description: 'Validate edit item tab 2',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.linkText('Metadata')).getCssValue('color');
|
|
if (elementStyle !== 'rgba(182, 186, 181, 1)') {
|
|
throw new Error(`Expected: Dimmed "Metadata" tab label color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Dimmed Metadata tab label color matched as expected');
|
|
}
|
|
},
|
|
|
|
//Concepts/Correlate tab
|
|
{
|
|
description: 'Validate edit item tab 3',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.linkText('Concepts/Correlate')).getText();
|
|
if (elementText !== 'Concepts/Correlate') {
|
|
throw new Error(`Expected: "Concepts/Correlate" tab label did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Concepts/Correlate tab label matched as expected');
|
|
}
|
|
},
|
|
|
|
//Concepts/Correlate tab label color -gray (dimmed)
|
|
{
|
|
description: 'Validate edit item tab 3',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.linkText('Concepts/Correlate')).getCssValue('color');
|
|
if (elementStyle !== 'rgba(182, 186, 181, 1)') {
|
|
throw new Error(`Expected: Dimmed "Concepts/Correlate" tab label color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Dimmed Concepts/Correlate tab label color matched as expected');
|
|
}
|
|
},
|
|
|
|
//Edit item Save button icon
|
|
{
|
|
description: 'Verify Edit item Save button icon is present',
|
|
action: async () =>
|
|
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.glyphicon-save')), 5000).catch(() => false);
|
|
if (!expectedIcon) {
|
|
throw new Error('Save button icon not found');
|
|
}
|
|
console.log('Passed: Save button icon present');
|
|
}
|
|
},
|
|
|
|
//Edit item Save button
|
|
{
|
|
description: 'Validate Save button text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.submit-content-button')).getText();
|
|
if (elementText !== 'Save Changes') {
|
|
throw new Error(`Expected: "Save Changes" button text did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Save Changes button text matched as expected');
|
|
}
|
|
},
|
|
|
|
//Edit item Save button -green
|
|
{
|
|
description: 'Validate required label',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.css('.submit-content-button')).getCssValue('color');
|
|
if (elementStyle !== 'rgba(255, 255, 255, 1)') {
|
|
throw new Error(`Expected: "Save" button text color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Save button text color matched as expected');
|
|
}
|
|
},
|
|
|
|
//Edit item required label
|
|
{
|
|
description: 'Validate Required label',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('#tabsr-1 > div:nth-child(1)')).getText();
|
|
if (elementText !== '* Required') {
|
|
throw new Error(`Expected: "* Required" label did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: * Required label matched as expected');
|
|
}
|
|
},
|
|
|
|
//Edit item required label -red
|
|
{
|
|
description: 'Validate Required label text color',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.css('#tabsr-1 > div:nth-child(1)')).getCssValue('color');
|
|
if (elementStyle !== 'rgba(255, 0, 0, 1)') {
|
|
throw new Error(`Expected: "Required" label color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Required label color matched as expected');
|
|
}
|
|
},
|
|
|
|
//Edit item title label
|
|
{
|
|
description: 'Validate title label',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.form-group:nth-child(3) > label')).getText();
|
|
if (elementText !== '* Title') {
|
|
throw new Error(`Expected: "* Title" label did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: * Title label matched as expected');
|
|
}
|
|
},
|
|
|
|
//Edit item title textbox value
|
|
{
|
|
description: 'Validate Title value text',
|
|
action: async () => {
|
|
const elementValue = await driver.findElement(By.css('#cutitle')).getAttribute('value');
|
|
if (elementValue !== 'AAA My Test III') {
|
|
throw new Error(`Expected: "AAA My Test III"; Actual: "${elementValue}"`);
|
|
}
|
|
console.log('Passed: AAA My Test III value text matched as expected');
|
|
}
|
|
},
|
|
|
|
//Edit item description label
|
|
{
|
|
description: 'Validate Description label',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.form-group:nth-child(4) > label')).getText();
|
|
if (elementText !== 'Description') {
|
|
throw new Error(`Expected: "Description" label did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Description label matched as expected');
|
|
}
|
|
},
|
|
|
|
//Edit item description textbox value
|
|
{
|
|
description: 'Validate Description value text',
|
|
action: async () => {
|
|
const elementValue = await driver.findElement(By.css('#cudesc')).getAttribute('value');
|
|
if (elementValue !== 'Yes, it should work! Perhaps') {
|
|
throw new Error(`Expected: "Yes, it should work! Perhaps"; Actual: "${elementValue}"`);
|
|
}
|
|
console.log('Passed: Yes, it should work! Perhaps value text matched as expected');
|
|
}
|
|
},
|
|
|
|
//Edit item URL label
|
|
{
|
|
description: 'Validate URL label',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.form-group:nth-child(5) > label')).getText();
|
|
if (elementText !== 'URL') {
|
|
throw new Error(`Expected: "URL" label did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: URL label matched as expected');
|
|
}
|
|
},
|
|
|
|
//Edit item URL textbox placeholder
|
|
{
|
|
description: 'Validate URL placeholder text',
|
|
action: async () => {
|
|
const elementValue = await driver.findElement(By.css('#cuurl')).getAttribute('placeholder');
|
|
if (elementValue !== 'https://example.com') {
|
|
throw new Error(`Expected: "https://example.com"; Actual: "${elementValue}"`);
|
|
}
|
|
console.log('Passed: https://example.com placeholder text matched as expected');
|
|
}
|
|
},
|
|
|
|
//Edit item Client Item ID label
|
|
{
|
|
description: 'Validate Client Item ID label',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.form-group:nth-child(6) > label')).getText();
|
|
if (elementText !== 'Client Item ID') {
|
|
throw new Error(`Expected: "Client Item ID" label did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Client Item ID label matched as expected');
|
|
}
|
|
},
|
|
|
|
//Edit item Client Item ID textbox value
|
|
{
|
|
description: 'Validate Client Item ID value text',
|
|
action: async () => {
|
|
const elementValue = await driver.findElement(By.css('#culoid')).getAttribute('value');
|
|
if (elementValue !== '') {
|
|
throw new Error(`Expected: Client Item ID "empty"; Actual: "${elementValue}"`);
|
|
}
|
|
console.log('Passed: Client Item Id empty value text matched as expected');
|
|
}
|
|
},
|
|
|
|
//Edit item Content Set label
|
|
{
|
|
description: 'Validate Content Set label',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.form-group:nth-child(7) > label')).getText();
|
|
if (elementText !== '* Content Set') {
|
|
throw new Error(`Expected: "* Content Set" label did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: *Content Set label matched as expected');
|
|
}
|
|
},
|
|
|
|
//Edit item Content Set textbox value (Biology - QA)
|
|
{
|
|
description: 'Validate Content Set value text',
|
|
action: async () => {
|
|
const elementValue = await driver.findElement(By.css('#orgs')).getAttribute('value');
|
|
if (elementValue !== '873576067') {
|
|
throw new Error(`Expected: "Biology - QA"; Actual: "${elementValue}"`);
|
|
}
|
|
console.log('Passed: Biology - QA value text matched as expected');
|
|
}
|
|
},
|
|
|
|
//Edit item Grades label
|
|
{
|
|
description: 'Validate Grades label',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.form-group:nth-child(8) > label')).getText();
|
|
if (elementText !== '* Grades') {
|
|
throw new Error(`Expected: "* Grades" label did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: * Grades label matched as expected');
|
|
}
|
|
},
|
|
|
|
//K grade checkbox
|
|
{
|
|
description: 'Verify K grade checkbox icon is present',
|
|
action: async () =>
|
|
{ const expectedIcon = await driver.wait(until.elementLocated(By.id('38')), 5000).catch(() => false);
|
|
if (!expectedIcon) {
|
|
throw new Error('"K grade" checkbox icon not found');
|
|
}
|
|
console.log('Passed: K grade checkbox icon present');
|
|
}
|
|
},
|
|
|
|
//K grade label
|
|
{
|
|
description: 'Validate K grade label',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.form-check:nth-child(3) > .form-check-label')).getText();
|
|
if (elementText !== 'K') {
|
|
throw new Error(`Expected: "K grade"; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: K grade label matched as expected');
|
|
}
|
|
},
|
|
|
|
//Grade 1 checkbox
|
|
{
|
|
description: 'Verify grade 1 checkbox icon is present',
|
|
action: async () =>
|
|
{ const expectedIcon = await driver.wait(until.elementLocated(By.id('39')), 5000).catch(() => false);
|
|
if (!expectedIcon) {
|
|
throw new Error('"Grade 1" checkbox icon not found');
|
|
}
|
|
console.log('Passed: Grade 1 checkbox icon present');
|
|
}
|
|
},
|
|
|
|
//Grade 1 label
|
|
{
|
|
description: 'Validate grade 1 label',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.form-check:nth-child(4) > .form-check-label')).getText();
|
|
if (elementText !== '1') {
|
|
throw new Error(`Expected: "Grade 1"; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Grade 1 label matched as expected');
|
|
}
|
|
},
|
|
|
|
//Grade 2 checkbox
|
|
{
|
|
description: 'Verify grade 2 checkbox icon is present',
|
|
action: async () =>
|
|
{ const expectedIcon = await driver.wait(until.elementLocated(By.id('40')), 5000).catch(() => false);
|
|
if (!expectedIcon) {
|
|
throw new Error('"Grade 2" checkbox icon not found');
|
|
}
|
|
console.log('Passed: Grade 2 checkbox icon present');
|
|
}
|
|
},
|
|
|
|
//Grade 2 label
|
|
{
|
|
description: 'Validate grade 2 label',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.form-check:nth-child(5) > .form-check-label')).getText();
|
|
if (elementText !== '2') {
|
|
throw new Error(`Expected: "Grade 2"; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Grade 2 label matched as expected');
|
|
}
|
|
},
|
|
|
|
//Grade 3 checkbox
|
|
{
|
|
description: 'Verify grade 3 checkbox icon is present',
|
|
action: async () =>
|
|
{ const expectedIcon = await driver.wait(until.elementLocated(By.id('41')), 5000).catch(() => false);
|
|
if (!expectedIcon) {
|
|
throw new Error('"Grade 3" checkbox icon not found');
|
|
}
|
|
console.log('Passed: Grade 3 checkbox icon present');
|
|
}
|
|
},
|
|
|
|
//Grade 3 label
|
|
{
|
|
description: 'Validate grade 3 label',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.form-check:nth-child(6) > .form-check-label')).getText();
|
|
if (elementText !== '3') {
|
|
throw new Error(`Expected: "Grade 3"; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Grade 3 label matched as expected');
|
|
}
|
|
},
|
|
|
|
//Grade 4 checkbox
|
|
{
|
|
description: 'Verify grade 4 checkbox icon is present',
|
|
action: async () =>
|
|
{ const expectedIcon = await driver.wait(until.elementLocated(By.id('43')), 5000).catch(() => false);
|
|
if (!expectedIcon) {
|
|
throw new Error('"Grade 4" checkbox icon not found');
|
|
}
|
|
console.log('Passed: Grade 4 checkbox icon present');
|
|
}
|
|
},
|
|
|
|
//Grade 4 label
|
|
{
|
|
description: 'Validate grade 4 label',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.form-check:nth-child(7) > .form-check-label')).getText();
|
|
if (elementText !== '4') {
|
|
throw new Error(`Expected: "Grade 4"; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Grade 4 label matched as expected');
|
|
}
|
|
},
|
|
|
|
//Grade 5 checkbox
|
|
{
|
|
description: 'Verify grade 5 checkbox icon is present',
|
|
action: async () =>
|
|
{ const expectedIcon = await driver.wait(until.elementLocated(By.id('44')), 5000).catch(() => false);
|
|
if (!expectedIcon) {
|
|
throw new Error('"Grade 5" checkbox icon not found');
|
|
}
|
|
console.log('Passed: Grade 5 checkbox icon present');
|
|
}
|
|
},
|
|
|
|
//Grade 5 label
|
|
{
|
|
description: 'Validate grade 5 label',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.form-check:nth-child(8) > .form-check-label')).getText();
|
|
if (elementText !== '5') {
|
|
throw new Error(`Expected: "Grade 5"; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Grade 5 label matched as expected');
|
|
}
|
|
},
|
|
|
|
//Grade 6 checkbox
|
|
{
|
|
description: 'Verify grade 6 checkbox icon is present',
|
|
action: async () =>
|
|
{ const expectedIcon = await driver.wait(until.elementLocated(By.id('45')), 5000).catch(() => false);
|
|
if (!expectedIcon) {
|
|
throw new Error('"Grade 6" checkbox icon not found');
|
|
}
|
|
console.log('Passed: Grade 6 checkbox icon present');
|
|
}
|
|
},
|
|
|
|
//Grade 6 label
|
|
{
|
|
description: 'Validate grade 6 label',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.form-check:nth-child(9) > .form-check-label')).getText();
|
|
if (elementText !== '6') {
|
|
throw new Error(`Expected: "Grade 6"; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Grade 6 label matched as expected');
|
|
}
|
|
},
|
|
|
|
//Grade 7 checkbox
|
|
{
|
|
description: 'Verify grade 7 checkbox icon is present',
|
|
action: async () =>
|
|
{ const expectedIcon = await driver.wait(until.elementLocated(By.id('47')), 5000).catch(() => false);
|
|
if (!expectedIcon) {
|
|
throw new Error('"Grade 7" checkbox icon not found');
|
|
}
|
|
console.log('Passed: Grade 7 checkbox icon present');
|
|
}
|
|
},
|
|
|
|
//Grade 7 label
|
|
{
|
|
description: 'Validate grade 7 label',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.form-check:nth-child(10) > .form-check-label')).getText();
|
|
if (elementText !== '7') {
|
|
throw new Error(`Expected: "Grade 7"; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Grade 7 label matched as expected');
|
|
}
|
|
},
|
|
|
|
//Grade 8 checkbox
|
|
{
|
|
description: 'Verify grade 8 checkbox icon is present',
|
|
action: async () =>
|
|
{ const expectedIcon = await driver.wait(until.elementLocated(By.id('48')), 5000).catch(() => false);
|
|
if (!expectedIcon) {
|
|
throw new Error('"Grade 8" checkbox icon not found');
|
|
}
|
|
console.log('Passed: Grade 8 checkbox icon present');
|
|
}
|
|
},
|
|
|
|
//Grade 8 label
|
|
{
|
|
description: 'Validate grade 8 label',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.form-check:nth-child(11) > .form-check-label')).getText();
|
|
if (elementText !== '8') {
|
|
throw new Error(`Expected: "Grade 8"; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Grade 8 label matched as expected');
|
|
}
|
|
},
|
|
|
|
//Grade 9 checkbox -enabled
|
|
{
|
|
description: 'Validate Grade 9 checkbox enabled',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.id('49')).getAttribute('checked');
|
|
if (elementStyle !== 'true') {
|
|
throw new Error(`Grade 9 checked value did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Grade 9 checkbox enabled as expected');
|
|
}
|
|
},
|
|
|
|
//Grade 9 label
|
|
{
|
|
description: 'Validate grade 9 label',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.form-check:nth-child(12) > .form-check-label')).getText();
|
|
if (elementText !== '9') {
|
|
throw new Error(`Expected: "Grade 9"; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Grade 9 label matched as expected');
|
|
}
|
|
},
|
|
|
|
//Grade 10 checkbox -enabled
|
|
{
|
|
description: 'Validate Grade 10 checkbox enabled',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.id('51')).getAttribute('checked');
|
|
if (elementStyle !== 'true') {
|
|
throw new Error(`Grade 10 checked value did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Grade 10 checkbox enabled as expected');
|
|
}
|
|
},
|
|
|
|
//Grade 10 label
|
|
{
|
|
description: 'Validate grade 10 label',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.form-check:nth-child(13) > .form-check-label')).getText();
|
|
if (elementText !== '10') {
|
|
throw new Error(`Expected: "Grade 10"; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Grade 10 label matched as expected');
|
|
}
|
|
},
|
|
|
|
//Grade 11 checkbox -enabled
|
|
{
|
|
description: 'Validate Grade 11 checkbox enabled',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.id('52')).getAttribute('checked');
|
|
if (elementStyle !== 'true') {
|
|
throw new Error(`Grade 11 checked value did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Grade 11 checkbox enabled as expected');
|
|
}
|
|
},
|
|
|
|
//Grade 11 label
|
|
{
|
|
description: 'Validate grade 11 label',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.form-check:nth-child(14) > .form-check-label')).getText();
|
|
if (elementText !== '11') {
|
|
throw new Error(`Expected: "Grade 11"; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Grade 11 label matched as expected');
|
|
}
|
|
},
|
|
|
|
//Grade 12 checkbox -enabled
|
|
{
|
|
description: 'Validate Grade 12 checkbox enabled',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.id('53')).getAttribute('checked');
|
|
if (elementStyle !== 'true') {
|
|
throw new Error(`Grade 12 checked value did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Grade 12 checkbox enabled as expected');
|
|
}
|
|
},
|
|
|
|
//Grade 12 label
|
|
{
|
|
description: 'Validate grade 12 label',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.form-check:nth-child(15) > .form-check-label')).getText();
|
|
if (elementText !== '12') {
|
|
throw new Error(`Expected: "Grade 12"; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Grade 12 label matched as expected');
|
|
}
|
|
},
|
|
|
|
//NEXT ACTION - METADATA
|
|
{ description: 'Click Metadata tab link', action: async () => await driver.findElement(By.linkText('Metadata')).click() },
|
|
{ description: 'Wait for login process to complete', action: async () => await driver.sleep(5000) },
|
|
|
|
//Page title
|
|
{
|
|
description: 'Validate Page title',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('#myModalLabel')).getText();
|
|
if (elementText !== 'Edit Item') {
|
|
throw new Error(`Expected: "Edit Item" title did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Edit Item title matched as expected');
|
|
}
|
|
},
|
|
|
|
//Page title color -navy blue
|
|
{
|
|
description: 'Validate Page title color',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.css('#myModalLabel')).getCssValue('color');
|
|
if (elementStyle !== 'rgba(40, 39, 90, 1)') {
|
|
throw new Error(`Expected: "Edit Item" Page title color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Edit Item Page title color matched as expected');
|
|
}
|
|
},
|
|
|
|
//Page title font size -32px
|
|
{
|
|
description: 'Validate Page title color',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.css('#myModalLabel')).getCssValue('font-size');
|
|
if (elementStyle !== '32px') {
|
|
throw new Error(`Expected: "Edit Item" Page title font size did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Edit Item Page title font size matched as expected');
|
|
}
|
|
},
|
|
|
|
//Resource tab
|
|
{
|
|
description: 'Validate edit item tab 1',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.linkText('Resource')).getText();
|
|
if (elementText !== 'Resource') {
|
|
throw new Error(`Expected: "Resource" tab label did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Resource tab label matched as expected');
|
|
}
|
|
},
|
|
|
|
//Resource tab label color -gray (dimmed)
|
|
{
|
|
description: 'Validate edit item tab 1',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.linkText('Resource')).getCssValue('color');
|
|
if (elementStyle !== 'rgba(182, 186, 181, 1)') {
|
|
throw new Error(`Expected: Dimmed "Resource" tab label color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Dimmed Resource tab label color matched as expected');
|
|
}
|
|
},
|
|
|
|
//Metadata tab
|
|
{
|
|
description: 'Validate edit item tab 2',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.linkText('Metadata')).getText();
|
|
if (elementText !== 'Metadata') {
|
|
throw new Error(`Expected: "Metadata" tab label did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Metadata tab label matched as expected');
|
|
}
|
|
},
|
|
|
|
//Metadata tab label color -navy blue
|
|
{
|
|
description: 'Validate edit item tab 2',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.linkText('Metadata')).getCssValue('color');
|
|
if (elementStyle !== 'rgba(40, 39, 90, 1)') {
|
|
throw new Error(`Expected: Active "Metadata" tab label color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Active Metadata tab label color matched as expected');
|
|
}
|
|
},
|
|
|
|
//Concepts/Correlate tab
|
|
{
|
|
description: 'Validate edit item tab 3',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.linkText('Concepts/Correlate')).getText();
|
|
if (elementText !== 'Concepts/Correlate') {
|
|
throw new Error(`Expected: "Concepts/Correlate" tab label did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Concepts/Correlate tab label matched as expected');
|
|
}
|
|
},
|
|
|
|
//Concepts/Correlate tab label color -gray (dimmed)
|
|
{
|
|
description: 'Validate edit item tab 3',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.linkText('Concepts/Correlate')).getCssValue('color');
|
|
if (elementStyle !== 'rgba(182, 186, 181, 1)') {
|
|
throw new Error(`Expected: Dimmed "Concepts/Correlate" tab label color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Dimmed Concepts/Correlate tab label color matched as expected');
|
|
}
|
|
},
|
|
|
|
//Edit item Save button
|
|
{
|
|
description: 'Validate Save button text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.submit-content-button')).getText();
|
|
if (elementText !== 'Save Changes') {
|
|
throw new Error(`Expected: "Save Changes" button text did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Save Changes button text matched as expected');
|
|
}
|
|
},
|
|
|
|
//Edit item Save button -green
|
|
{
|
|
description: 'Validate required label',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.css('.submit-content-button')).getCssValue('color');
|
|
if (elementStyle !== 'rgba(255, 255, 255, 1)') {
|
|
throw new Error(`Expected: "Save" button text color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Save button text color matched as expected');
|
|
}
|
|
},
|
|
|
|
//Field Name title
|
|
{
|
|
description: 'Validate Field Name title',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('#tabsr-4 > div:nth-child(1) > b')).getText();
|
|
if (elementText !== 'Field Name') {
|
|
throw new Error(`Expected: "Field Name" title did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Field Name title matched as expected');
|
|
}
|
|
},
|
|
|
|
//Field Name textbox placeholder
|
|
{
|
|
description: 'Validate Field Name placeholder text',
|
|
action: async () => {
|
|
const elementValue = await driver.findElement(By.css('.combobox:nth-child(1)')).getAttribute('placeholder');
|
|
if (elementValue !== 'Select/Enter Field...') {
|
|
throw new Error(`Expected: "Select/Enter Field..."; Actual: "${elementValue}"`);
|
|
}
|
|
console.log('Passed: Select/Enter Field... placeholder text matched as expected');
|
|
}
|
|
},
|
|
|
|
//Value title
|
|
{
|
|
description: 'Validate Value title',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('div:nth-child(2) > b')).getText();
|
|
if (elementText !== 'Value') {
|
|
throw new Error(`Expected: "Value" title did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Value title matched as expected');
|
|
}
|
|
},
|
|
|
|
//Value textbox placeholder
|
|
{
|
|
description: 'Validate Value placeholder text',
|
|
action: async () => {
|
|
const elementValue = await driver.findElement(By.css('#meta_value')).getAttribute('placeholder');
|
|
if (elementValue !== '') {
|
|
throw new Error(`Expected: "empty"; Actual: "${elementValue}"`);
|
|
}
|
|
console.log('Passed: empty placeholder text matched as expected');
|
|
}
|
|
},
|
|
|
|
//Add Metadata button text
|
|
{
|
|
description: 'Validate Metadata button text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.btn:nth-child(5)')).getAttribute('value');
|
|
if (elementText !== 'Add Metadata') {
|
|
throw new Error(`Expected: "Add Metadata" button text did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Add Metadata button text matched as expected');
|
|
}
|
|
},
|
|
|
|
//Add Metadata button color -green
|
|
{
|
|
description: 'Validate Add Metadata button color',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.css('.btn:nth-child(5)')).getCssValue('background-color');
|
|
if (elementStyle !== 'rgba(48, 200, 172, 1)') {
|
|
throw new Error(`Expected: "Add Metadata" button color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Add Metadata button color matched as expected');
|
|
}
|
|
},
|
|
|
|
//Current Metadata title
|
|
{
|
|
description: 'Validate Current Metadata title',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('span:nth-child(7)')).getText();
|
|
if (elementText !== 'Current Metadata') {
|
|
throw new Error(`Expected: "Current Metadata" title did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Current Metadata title matched as expected');
|
|
}
|
|
},
|
|
|
|
//Name title
|
|
{
|
|
description: 'Validate Name title',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('th:nth-child(1)')).getText();
|
|
if (elementText !== 'Name') {
|
|
throw new Error(`Expected: "Name" title did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Name title matched as expected');
|
|
}
|
|
},
|
|
|
|
//Data title
|
|
{
|
|
description: 'Validate Data title',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('th:nth-child(2)')).getText();
|
|
if (elementText !== 'Data') {
|
|
throw new Error(`Expected: "Data" titlel did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Data title matched as expected');
|
|
}
|
|
},
|
|
|
|
//Alginment Status title
|
|
{
|
|
description: 'Validate Alignment title',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('#me51861f7f132f814cec419806f86545e > td:nth-child(1)')).getText();
|
|
if (elementText !== 'Alignment Status') {
|
|
throw new Error(`Expected: "Alignment Status" title did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Alignment Status title matched as expected');
|
|
}
|
|
},
|
|
|
|
//Alignment Status textbox value
|
|
{
|
|
description: 'Validate textbox value',
|
|
action: async () => {
|
|
const elementValue = await driver.findElement(By.css('td > .form-control')).getAttribute('value');
|
|
if (elementValue !== 'Aligned') {
|
|
throw new Error(`Expected: Alignment Status value "Aligned"; Actual: "${elementValue}"`);
|
|
}
|
|
console.log('Passed: Alignment Status value Aligned text matched as expected');
|
|
}
|
|
},
|
|
|
|
/*X delete icon - tooltip UNABLE TO FIND TOOLTIP
|
|
{
|
|
description: 'Validate X delete icon tooltip',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.css('#me51861f7f132f814cec419806f86545e > td:nth-child(3) > a > img')).getAttribute('title');
|
|
if (elementStyle !== 'Remove Field') {
|
|
throw new Error(`Expected: X delete icon "Remove Field" tooltip did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: X delete icon Remove Field tooltip matched as expected');
|
|
}
|
|
},*/
|
|
|
|
//NEXT ACTION - CONCEPTS/CORRELTATE
|
|
{ description: 'Click Metadata tab link', action: async () => await driver.findElement(By.linkText('Concepts/Correlate')).click() },
|
|
{ description: 'Wait for action to complete', action: async () => await driver.sleep(5000) },
|
|
|
|
//Page title
|
|
{
|
|
description: 'Validate Page title',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('#myModalLabel')).getText();
|
|
if (elementText !== 'Edit Item') {
|
|
throw new Error(`Expected: "Edit Item" title did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Edit Item title matched as expected');
|
|
}
|
|
},
|
|
|
|
//Page title color -navy blue
|
|
{
|
|
description: 'Validate Page title color',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.css('#myModalLabel')).getCssValue('color');
|
|
if (elementStyle !== 'rgba(40, 39, 90, 1)') {
|
|
throw new Error(`Expected: "Edit Item" Page title color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Edit Item Page title color matched as expected');
|
|
}
|
|
},
|
|
|
|
//Page title font size -32px
|
|
{
|
|
description: 'Validate Page title color',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.css('#myModalLabel')).getCssValue('font-size');
|
|
if (elementStyle !== '32px') {
|
|
throw new Error(`Expected: "Edit Item" Page title font size did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Edit Item Page title font size matched as expected');
|
|
}
|
|
},
|
|
|
|
//Resource tab
|
|
{
|
|
description: 'Validate edit item tab 1',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.linkText('Resource')).getText();
|
|
if (elementText !== 'Resource') {
|
|
throw new Error(`Expected: "Resource" tab label did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Resource tab label matched as expected');
|
|
}
|
|
},
|
|
|
|
//Resource tab label color -gray (dimmed)
|
|
{
|
|
description: 'Validate edit item tab 1',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.linkText('Resource')).getCssValue('color');
|
|
if (elementStyle !== 'rgba(182, 186, 181, 1)') {
|
|
throw new Error(`Expected: Dimmed "Resource" tab label color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Dimmed Resource tab label color matched as expected');
|
|
}
|
|
},
|
|
|
|
//Metadata tab
|
|
{
|
|
description: 'Validate edit item tab 2',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.linkText('Metadata')).getText();
|
|
if (elementText !== 'Metadata') {
|
|
throw new Error(`Expected: "Metadata" tab label did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Metadata tab label matched as expected');
|
|
}
|
|
},
|
|
|
|
//Metadata tab label color -gray (dimmed)
|
|
{
|
|
description: 'Validate edit item tab 2',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.linkText('Metadata')).getCssValue('color');
|
|
if (elementStyle !== 'rgba(182, 186, 181, 1)') {
|
|
throw new Error(`Expected: Dimmed "Metadata" tab label color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Dimmed Metadata tab label color matched as expected');
|
|
}
|
|
},
|
|
|
|
//Concepts/Correlate tab
|
|
{
|
|
description: 'Validate edit item tab 3',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.linkText('Concepts/Correlate')).getText();
|
|
if (elementText !== 'Concepts/Correlate') {
|
|
throw new Error(`Expected: "Concepts/Correlate" tab label did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Concepts/Correlate tab label matched as expected');
|
|
}
|
|
},
|
|
|
|
//Concepts/Correlate tab label color -navy bue
|
|
{
|
|
description: 'Validate edit item tab 3',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.linkText('Concepts/Correlate')).getCssValue('color');
|
|
if (elementStyle !== 'rgba(40, 39, 90, 1)') {
|
|
throw new Error(`Expected: Active "Concepts/Correlate" tab label color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Active Concepts/Correlate tab label color matched as expected');
|
|
}
|
|
},
|
|
|
|
//Edit item Save button
|
|
{
|
|
description: 'Validate Save button text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.submit-content-button')).getText();
|
|
if (elementText !== 'Save Changes') {
|
|
throw new Error(`Expected: "Save Changes" button text did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Save Changes button text matched as expected');
|
|
}
|
|
},
|
|
|
|
//Edit item Save button -green
|
|
{
|
|
description: 'Validate required label',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.css('.submit-content-button')).getCssValue('color');
|
|
if (elementStyle !== 'rgba(255, 255, 255, 1)') {
|
|
throw new Error(`Expected: "Save" button text color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Save button text color matched as expected');
|
|
}
|
|
},
|
|
|
|
//Tagged Concepts title
|
|
{
|
|
description: 'Validate Tagged Concepts title text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.ui-widget-heading')).getText();
|
|
if (elementText !== 'Tagged Concepts:') {
|
|
throw new Error(`Expected: "Tagged Concepts:" title text did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Tagged Concepts: title text matched as expected');
|
|
}
|
|
},
|
|
|
|
//Tagged Concepts breadcrumb 1 text
|
|
{
|
|
description: 'Validate Tagged Concepts breadcrumb 1 text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('#k252821892')).getText();
|
|
if (elementText !== 'Mathematics | Number Operations | Exponents/Powers | Fractional - Note: includes negative fractional; relates to radicals Remove') {
|
|
throw new Error(`Expected: Tagged Concepts breadcrumb 1 text did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Tagged Concepts breadcrumb 1 text matched as expected');
|
|
}
|
|
},
|
|
|
|
//Tagged Concepts remove button 1 icon
|
|
{
|
|
description: 'Verify remove button 1 icon is present',
|
|
action: async () =>
|
|
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('#k252821892 .glyphicon')), 5000).catch(() => false);
|
|
if (!expectedIcon) {
|
|
throw new Error('Tagged Concept "Remove" button 1 icon not found');
|
|
}
|
|
console.log('Passed: Tagged Concept Remove button 1 icon present');
|
|
}
|
|
},
|
|
|
|
//Tagged Concepts remove button 1 text
|
|
{
|
|
description: 'Validate Tagged Concepts delete button 1 text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('#k252821892 > .btn')).getText();
|
|
if (elementText !== 'Remove') {
|
|
throw new Error(`Expected: Tagged Concept "Remove" button 1 text did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Tagged Concept Remove button 1 text matched as expected');
|
|
}
|
|
},
|
|
|
|
//Tagged Concepts remove button 1 color -red
|
|
{
|
|
description: 'Validate remove button 1 label color',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.css('#k252821892 > .btn')).getCssValue('background-color');
|
|
if (elementStyle !== 'rgba(246, 60, 40, 1)') {
|
|
throw new Error(`Expected: Tagged Concept "Remove" button 1 color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Tagged Concept Remove button 1 color matched as expected');
|
|
}
|
|
},
|
|
|
|
//Tagged Concepts remove button 1 -tooltip
|
|
{
|
|
description: 'Validate Tagged Concepts remove button 1 tooltip',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.css('#k252821892 > .btn')).getAttribute('title');
|
|
if (elementStyle !== 'Remove Concept') {
|
|
throw new Error(`Expected: Tagged Concept "Remove Concept" button 1 tooltip did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Tagged Concepts Remove Concept button 1 tooltip matched as expected');
|
|
}
|
|
},
|
|
|
|
//Tagged Concepts primary toggle button 1
|
|
{
|
|
description: 'Verify primary toggle button 1 is present',
|
|
action: async () =>
|
|
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('#k252821892 .switch-primary')), 5000).catch(() => false);
|
|
if (!expectedIcon) {
|
|
throw new Error('Tagged Concept "Primary" toggle button 1 icon not found');
|
|
}
|
|
console.log('Passed: Tagged Concept Primary toggle button 1 icon present');
|
|
}
|
|
},
|
|
|
|
//Tagged Concepts breadcrumb 2 text
|
|
{
|
|
description: 'Validate Tagged Concepts breadcrumb 2 text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('#k425604098')).getText();
|
|
if (elementText !== 'Mathematics | General Remove checkbox Toggle') {
|
|
throw new Error(`Expected: Tagged Concepts breadcrumb 2 text did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Tagged Concepts breadcrumb 2 text matched as expected');
|
|
}
|
|
},
|
|
|
|
//Tagged Concepts remove button 2 icon
|
|
{
|
|
description: 'Verify remove button 2 icon is present',
|
|
action: async () =>
|
|
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('#k425604098 .glyphicon')), 5000).catch(() => false);
|
|
if (!expectedIcon) {
|
|
throw new Error('Tagged Concept "Remove" button 2 icon not found');
|
|
}
|
|
console.log('Passed: Remove button 2 icon present');
|
|
}
|
|
},
|
|
|
|
//Tagged Concepts remove button 2 text
|
|
{
|
|
description: 'Validate Tagged Concepts delete button 2 text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('#k425604098 > .btn')).getText();
|
|
if (elementText !== 'Remove') {
|
|
throw new Error(`Expected: Tagged Concept "Remove" button 2 text did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Tagged Concept Remove button 2 text matched as expected');
|
|
}
|
|
},
|
|
|
|
//Tagged Concepts remove button 2 color -red
|
|
{
|
|
description: 'Validate remove button 2 color',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.css('#k425604098 > .btn')).getCssValue('background-color');
|
|
if (elementStyle !== 'rgba(246, 60, 40, 1)') {
|
|
throw new Error(`Expected: Tagged Concept "Remove" button 2 text color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Tagged Concept Remove button 2 text color matched as expected');
|
|
}
|
|
},
|
|
|
|
//Tagged Concepts remove button 2 -tooltip
|
|
{
|
|
description: 'Validate Tagged Concepts remove button 2 tooltip',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.css('#k425604098 > .btn')).getAttribute('title');
|
|
if (elementStyle !== 'Remove Concept') {
|
|
throw new Error(`Expected: Tagged Concept "Remove Concept" button 2 tooltip did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Tagged Concept Remove Concept button 2 tooltip matched as expected');
|
|
}
|
|
},
|
|
|
|
//Tagged Concepts primary toggle button 2
|
|
{
|
|
description: 'Verify primary toggle button 2 is present',
|
|
action: async () =>
|
|
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('#k425604098 .switch-primary')), 5000).catch(() => false);
|
|
if (!expectedIcon) {
|
|
throw new Error('Tagged Concept "Primary" toggle button 2 icon not found');
|
|
}
|
|
console.log('Passed: Tagged Concept Primary toggle button 2 icon present');
|
|
}
|
|
},
|
|
|
|
//Find Concepts title text
|
|
{
|
|
description: 'Validate Find Concepts title text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('p')).getText();
|
|
if (elementText !== 'Find Concepts') {
|
|
throw new Error(`Expected: "Find Concepts" title text did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Find Concepts title text matched as expected');
|
|
}
|
|
},
|
|
|
|
//Browse tab title (active)
|
|
{
|
|
description: 'Validate browse tab title',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.linkText('Browse')).getText();
|
|
if (elementText !== 'Browse') {
|
|
throw new Error(`Expected: "Browse" tab title text did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Browse tab title text matched as expected');
|
|
}
|
|
},
|
|
|
|
//Browse tab text title -white (active)
|
|
{
|
|
description: 'Validate browse tab text color',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.linkText('Browse')).getCssValue('color');
|
|
if (elementStyle !== 'rgba(255, 255, 255, 1)') {
|
|
throw new Error(`Expected: "Browse" tab text title color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Browse tab text title color matched as expected');
|
|
}
|
|
},
|
|
|
|
//Browse tab title -navy blue (active)
|
|
{
|
|
description: 'Validate browse tab color',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.linkText('Browse')).getCssValue('background-color');
|
|
if (elementStyle !== 'rgba(40, 39, 90, 1)') {
|
|
throw new Error(`Expected: "Browse" tab title color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Browse tab title color matched as expected');
|
|
}
|
|
},
|
|
|
|
//By Standard tab title (dimmed)
|
|
{
|
|
description: 'Validate by standard tab title',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.linkText('By Standard')).getText();
|
|
if (elementText !== 'By Standard') {
|
|
throw new Error(`Expected: "By Standard" tab title text did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: By Standard tab title text matched as expected');
|
|
}
|
|
},
|
|
|
|
//By Standard tab text title -gray (dimmed)
|
|
{
|
|
description: 'Validate by standard tab text color',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.linkText('By Standard')).getCssValue('color');
|
|
if (elementStyle !== 'rgba(182, 186, 181, 1)') {
|
|
throw new Error(`Expected: "By Standard" tab text title color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: By Standard tab text title color matched as expected');
|
|
}
|
|
},
|
|
|
|
//By Standard tab title -white (dimmed)
|
|
{
|
|
description: 'Validate by standard tab color',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.linkText('By Standard')).getCssValue('background-color');
|
|
if (elementStyle !== 'rgba(0, 0, 0, 0)') {
|
|
throw new Error(`Expected: "By Standard" tab title color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: By Standard tab title color matched as expected');
|
|
}
|
|
},
|
|
|
|
//AutoAlign tab title (dimmed)
|
|
{
|
|
description: 'Validate AutoAlign tab title',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.linkText('AutoAlign')).getText();
|
|
if (elementText !== 'AutoAlign') {
|
|
throw new Error(`Expected: "AutoAlign" tab title text did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: AutoAlign tab title text matched as expected');
|
|
}
|
|
},
|
|
|
|
//AutoAlign tab text title -gray (dimmed)
|
|
{
|
|
description: 'Validate AutoAlign tab text color',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.linkText('AutoAlign')).getCssValue('color');
|
|
if (elementStyle !== 'rgba(182, 186, 181, 1)') {
|
|
throw new Error(`Expected: "AutoAlign" tab text title color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: AutoAlign tab text title color matched as expected');
|
|
}
|
|
},
|
|
|
|
//AutoAlign tab title -white (dimmed)
|
|
{
|
|
description: 'Validate AutoAlign tab color',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.linkText('AutoAlign')).getCssValue('background-color');
|
|
if (elementStyle !== 'rgba(0, 0, 0, 0)') {
|
|
throw new Error(`Expected: "AutoAlign" tab title color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: AutoAlign tab title color matched as expected');
|
|
}
|
|
},
|
|
|
|
//Browse the concept list and filter by term title
|
|
{
|
|
description: 'Validate Browse the concept list and filter by term title',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.mt-2 > h5')).getText();
|
|
if (elementText !== 'Browse the concept list and filter by term') {
|
|
throw new Error(`Expected: "Browse the concept list and filter by term" title text did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Browse the concept list and filter by term title text matched as expected');
|
|
}
|
|
},
|
|
|
|
//Browse the concept list and filter by term -navy blue
|
|
{
|
|
description: 'Validate Browse the concept list and filter by term title color',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.css('.mt-2 > h5')).getCssValue('color');
|
|
if (elementStyle !== 'rgba(40, 39, 90, 1)') {
|
|
throw new Error(`Expected: "Browse the concept list and filter by term" title color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Browse the concept list and filter by term title color matched as expected');
|
|
}
|
|
},
|
|
|
|
//Browse the concept list and filter by term font size -20px
|
|
{
|
|
description: 'Validate Page title color',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.css('.mt-2 > h5')).getCssValue('font-size');
|
|
if (elementStyle !== '20px') {
|
|
throw new Error(`Expected: "Browse the concept list and filter by term" title font size did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Browse the concept list and filter by term title font size matched as expected');
|
|
}
|
|
},
|
|
|
|
//Filter Concepts label
|
|
{
|
|
description: 'Validate Filter Concepts label',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.mr-1')).getText();
|
|
if (elementText !== 'Filter Concepts') {
|
|
throw new Error(`Expected: "Filter Concepts" label text did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Filter Concepts label text matched as expected');
|
|
}
|
|
},
|
|
|
|
//Filter Concepts textbox placeholder
|
|
{
|
|
description: 'Validate URL placeholder text',
|
|
action: async () => {
|
|
const elementValue = await driver.findElement(By.css('#q')).getAttribute('placeholder');
|
|
if (elementValue !== 'Enter Term...') {
|
|
throw new Error(`Expected: "Enter Term..."; Actual: "${elementValue}"`);
|
|
}
|
|
console.log('Passed: Enter Term... placeholder text matched as expected');
|
|
}
|
|
},
|
|
|
|
//Filter button text
|
|
{
|
|
description: 'Validate filter button text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('#qbutton')).getText();
|
|
if (elementText !== 'Filter') {
|
|
throw new Error(`Expected: "Filter" button text did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Filter button text matched as expected');
|
|
}
|
|
},
|
|
|
|
//Filter button color -green
|
|
{
|
|
description: 'Validate filter button color',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.css('#qbutton')).getCssValue('background-color');
|
|
if (elementStyle !== 'rgba(48, 200, 172, 1)') {
|
|
throw new Error(`Expected: "Filter" button color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Filter button color matched as expected');
|
|
}
|
|
},
|
|
|
|
//Language Arts label
|
|
{
|
|
description: 'Validate language arts label text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.list-group-item:nth-child(1) > div:nth-child(3)')).getText();
|
|
if (elementText !== 'Language Arts') {
|
|
throw new Error(`Expected: "Language Arts" label text did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Language Arts label text matched as expected');
|
|
}
|
|
},
|
|
|
|
//Language Arts button text
|
|
{
|
|
description: 'Validate language arts button text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.list-group-item:nth-child(1) > .badge')).getText();
|
|
if (elementText !== '1359') {
|
|
throw new Error(`Expected: "Language Arts" button text did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Language Arts button text matched as expected');
|
|
}
|
|
},
|
|
|
|
//Language Arts button color -navy blue
|
|
{
|
|
description: 'Validate language arts button color',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.css('.list-group-item:nth-child(1) > .badge')).getCssValue('background-color');
|
|
if (elementStyle !== 'rgba(40, 39, 90, 1)') {
|
|
throw new Error(`Expected: Language Arts button color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Language Arts button color matched as expected');
|
|
}
|
|
},
|
|
|
|
//Language Arts arrow icon
|
|
{
|
|
description: 'Verify language arts arrow icon is present',
|
|
action: async () =>
|
|
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.list-group-item:nth-child(1) > .fa')), 5000).catch(() => false);
|
|
if (!expectedIcon) {
|
|
throw new Error('Language Arts arrow icon not found');
|
|
}
|
|
console.log('Passed: Language Arts arrow icon present');
|
|
}
|
|
},
|
|
|
|
//Mathematics label
|
|
{
|
|
description: 'Validate mathematics label text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.list-group-item:nth-child(2) > div:nth-child(3)')).getText();
|
|
if (elementText !== 'Mathematics') {
|
|
throw new Error(`Expected: "Mathematics" label text did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Mathematics label text matched as expected');
|
|
}
|
|
},
|
|
|
|
//Mathematics button text
|
|
{
|
|
description: 'Validate mathematics button text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.list-group-item:nth-child(2) > .badge')).getText();
|
|
if (elementText !== '1219') {
|
|
throw new Error(`Expected: "Mathematics" button text did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Mathematics button text matched as expected');
|
|
}
|
|
},
|
|
|
|
//Mathematics button color -navy blue
|
|
{
|
|
description: 'Validate mathematics button color',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.css('.list-group-item:nth-child(2) > .badge')).getCssValue('background-color');
|
|
if (elementStyle !== 'rgba(40, 39, 90, 1)') {
|
|
throw new Error(`Expected: Mathematics button color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Mathematics button color matched as expected');
|
|
}
|
|
},
|
|
|
|
//Mathematics arrow icon
|
|
{
|
|
description: 'Verify mathematics arrow icon is present',
|
|
action: async () =>
|
|
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.list-group-item:nth-child(2) > .fa')), 5000).catch(() => false);
|
|
if (!expectedIcon) {
|
|
throw new Error('Mathematics arrow icon not found');
|
|
}
|
|
console.log('Passed: Mathematics arrow icon present');
|
|
}
|
|
},
|
|
|
|
//Science label
|
|
{
|
|
description: 'Validate science label text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.list-group-item:nth-child(3) > div:nth-child(3)')).getText();
|
|
if (elementText !== 'Science') {
|
|
throw new Error(`Expected: "Science" label text did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Science label text matched as expected');
|
|
}
|
|
},
|
|
|
|
//Science button text
|
|
{
|
|
description: 'Validate science button text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.list-group-item:nth-child(3) > .badge')).getText();
|
|
if (elementText !== '2108') {
|
|
throw new Error(`Expected: "Science" button text did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Science button text matched as expected');
|
|
}
|
|
},
|
|
|
|
//Science button color -navy blue
|
|
{
|
|
description: 'Validate science button color',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.css('.list-group-item:nth-child(3) > .badge')).getCssValue('background-color');
|
|
if (elementStyle !== 'rgba(40, 39, 90, 1)') {
|
|
throw new Error(`Expected: Science button color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Science button color matched as expected');
|
|
}
|
|
},
|
|
|
|
//Science arrow icon
|
|
{
|
|
description: 'Verify science arrow icon is present',
|
|
action: async () =>
|
|
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.list-group-item:nth-child(3) > .fa')), 5000).catch(() => false);
|
|
if (!expectedIcon) {
|
|
throw new Error('Science arrow icon not found');
|
|
}
|
|
console.log('Passed: Science arrow icon present');
|
|
}
|
|
},
|
|
|
|
//Social Studies label
|
|
{
|
|
description: 'Validate social studies label text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.list-group-item:nth-child(4) > div:nth-child(3)')).getText();
|
|
if (elementText !== 'Social Studies') {
|
|
throw new Error(`Expected: "Social Studies" label text did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Social Studies label text matched as expected');
|
|
}
|
|
},
|
|
|
|
//Social Studies label button text
|
|
{
|
|
description: 'Validate social studies button text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.list-group-item:nth-child(4) > .badge')).getText();
|
|
if (elementText !== '2188') {
|
|
throw new Error(`Expected: "Social Studies" button text did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Social Studies button text matched as expected');
|
|
}
|
|
},
|
|
|
|
//Social Studies button color -navy blue
|
|
{
|
|
description: 'Validate social studies button color',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.css('.list-group-item:nth-child(4) > .badge')).getCssValue('background-color');
|
|
if (elementStyle !== 'rgba(40, 39, 90, 1)') {
|
|
throw new Error(`Expected: Social Studies button color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Social Studies button color matched as expected');
|
|
}
|
|
},
|
|
|
|
//Social Studies arrow icon
|
|
{
|
|
description: 'Verify social studies arrow icon is present',
|
|
action: async () =>
|
|
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.list-group-item:nth-child(4) > .fa')), 5000).catch(() => false);
|
|
if (!expectedIcon) {
|
|
throw new Error('Social Studies arrow icon not found');
|
|
}
|
|
console.log('Passed: Social Studies arrow icon present');
|
|
}
|
|
},
|
|
|
|
//World Languages label
|
|
{
|
|
description: 'Validate world languages label text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.list-group-item:nth-child(5) > div:nth-child(3)')).getText();
|
|
if (elementText !== 'World Languages') {
|
|
throw new Error(`Expected: "World Languages" label text did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: World Languages label text matched as expected');
|
|
}
|
|
},
|
|
|
|
//World Languages label button text
|
|
{
|
|
description: 'Validate world languages button text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.list-group-item:nth-child(5) > .badge')).getText();
|
|
if (elementText !== '375') {
|
|
throw new Error(`Expected: "World Languages" button text did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: World Languages button text matched as expected');
|
|
}
|
|
},
|
|
|
|
//World Languages button color -navy blue
|
|
{
|
|
description: 'Validate world languages button color',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.css('.list-group-item:nth-child(5) > .badge')).getCssValue('background-color');
|
|
if (elementStyle !== 'rgba(40, 39, 90, 1)') {
|
|
throw new Error(`Expected: World Languages button color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: World Languages button color matched as expected');
|
|
}
|
|
},
|
|
|
|
//World Languages arrow icon
|
|
{
|
|
description: 'Verify world languages arrow icon is present',
|
|
action: async () =>
|
|
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.list-group-item:nth-child(5) > .fa')), 5000).catch(() => false);
|
|
if (!expectedIcon) {
|
|
throw new Error('World Languages arrow icon not found');
|
|
}
|
|
console.log('Passed: World Languages arrow icon present');
|
|
}
|
|
},
|
|
|
|
//NEXT ACTION - By Standar
|
|
{ description: 'Click By Standard tab link', action: async () => await driver.findElement(By.linkText('By Standard')).click() },
|
|
{ description: 'Wait for action to complete', action: async () => await driver.sleep(5000) },
|
|
|
|
//Browse tab title (dimmed)
|
|
{
|
|
description: 'Validate browse tab title',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.linkText('Browse')).getText();
|
|
if (elementText !== 'Browse') {
|
|
throw new Error(`Expected: "Browse" tab title text did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Browse tab title text matched as expected');
|
|
}
|
|
},
|
|
|
|
//Browse tab text title -gray (dimmed)
|
|
{
|
|
description: 'Validate browse tab text color',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.linkText('Browse')).getCssValue('color');
|
|
if (elementStyle !== 'rgba(182, 186, 181, 1)') {
|
|
throw new Error(`Expected: "Browse" tab text title color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Browse tab text title color matched as expected');
|
|
}
|
|
},
|
|
|
|
//Browse tab title -white (dimmed)
|
|
{
|
|
description: 'Validate browse tab color',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.linkText('Browse')).getCssValue('background-color');
|
|
if (elementStyle !== 'rgba(0, 0, 0, 0)') {
|
|
throw new Error(`Expected: "Browse" tab title color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Browse tab title color matched as expected');
|
|
}
|
|
},
|
|
|
|
//By Standard tab title (active)
|
|
{
|
|
description: 'Validate by standard tab title',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.linkText('By Standard')).getText();
|
|
if (elementText !== 'By Standard') {
|
|
throw new Error(`Expected: "By Standard" tab title text did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: By Standard tab title text matched as expected');
|
|
}
|
|
},
|
|
|
|
//By Standard tab text title -navy blue (active)
|
|
{
|
|
description: 'Validate by standard tab text color',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.linkText('By Standard')).getCssValue('color');
|
|
if (elementStyle !== 'rgba(255, 255, 255, 1)') {
|
|
throw new Error(`Expected: "By Standard" tab text title color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: By Standard tab text title color matched as expected');
|
|
}
|
|
},
|
|
|
|
//By Standard tab title -navy blue (active)
|
|
{
|
|
description: 'Validate by standard tab color',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.linkText('By Standard')).getCssValue('background-color');
|
|
if (elementStyle !== 'rgba(40, 39, 90, 1)') {
|
|
throw new Error(`Expected: "By Standard" tab title color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: By Standard tab title color matched as expected');
|
|
}
|
|
},
|
|
|
|
//AutoAlign tab title (dimmed)
|
|
{
|
|
description: 'Validate AutoAlign tab title',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.linkText('AutoAlign')).getText();
|
|
if (elementText !== 'AutoAlign') {
|
|
throw new Error(`Expected: "AutoAlign" tab title text did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: AutoAlign tab title text matched as expected');
|
|
}
|
|
},
|
|
|
|
//AutoAlign tab text title -gray (dimmed)
|
|
{
|
|
description: 'Validate AutoAlign tab text color',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.linkText('AutoAlign')).getCssValue('color');
|
|
if (elementStyle !== 'rgba(182, 186, 181, 1)') {
|
|
throw new Error(`Expected: "AutoAlign" tab text title color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: AutoAlign tab text title color matched as expected');
|
|
}
|
|
},
|
|
|
|
//AutoAlign tab title -white (dimmed)
|
|
{
|
|
description: 'Validate AutoAlign tab color',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.linkText('AutoAlign')).getCssValue('background-color');
|
|
if (elementStyle !== 'rgba(0, 0, 0, 0)') {
|
|
throw new Error(`Expected: "AutoAlign" tab title color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: AutoAlign tab title color matched as expected');
|
|
}
|
|
},
|
|
|
|
//Select a set of standards label
|
|
{
|
|
description: 'Validate select a set of standards label',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('label:nth-child(4)')).getText();
|
|
if (elementText !== 'Select a set of standards:') {
|
|
throw new Error(`Expected: "Select a set of standards:" label text did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Select a set of standards: label text matched as expected');
|
|
}
|
|
},
|
|
|
|
//Standards dropdown
|
|
{
|
|
description: 'Validate standards dropdown value',
|
|
action: async () => {
|
|
const elementValue = await driver.findElement(By.css('#correlate-select-state')).getAttribute('value');
|
|
if (elementValue !== 'none') {
|
|
throw new Error(`Expected: Dropdown value to be "none"; Actual: "${elementValue}"`);
|
|
}
|
|
console.log('Passed: Dropdown "none" value matched as expected');
|
|
}
|
|
},
|
|
|
|
//NEXT ACTION - AutoAlign
|
|
{ description: 'Click AutoAlign tab link', action: async () => await driver.findElement(By.linkText('AutoAlign')).click() },
|
|
{ description: 'Wait for action to complete', action: async () => await driver.sleep(5000) },
|
|
|
|
//Browse tab title (dimmed)
|
|
{
|
|
description: 'Validate browse tab title',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.linkText('Browse')).getText();
|
|
if (elementText !== 'Browse') {
|
|
throw new Error(`Expected: "Browse" tab title text did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Browse tab title text matched as expected');
|
|
}
|
|
},
|
|
|
|
//Browse tab text title -gray (dimmed)
|
|
{
|
|
description: 'Validate browse tab text color',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.linkText('Browse')).getCssValue('color');
|
|
if (elementStyle !== 'rgba(182, 186, 181, 1)') {
|
|
throw new Error(`Expected: "Browse" tab text title color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Browse tab text title color matched as expected');
|
|
}
|
|
},
|
|
|
|
//Browse tab title -white (dimmed)
|
|
{
|
|
description: 'Validate browse tab color',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.linkText('Browse')).getCssValue('background-color');
|
|
if (elementStyle !== 'rgba(0, 0, 0, 0)') {
|
|
throw new Error(`Expected: "Browse" tab title color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: Browse tab title color matched as expected');
|
|
}
|
|
},
|
|
|
|
//By Standard tab title (dimmed)
|
|
{
|
|
description: 'Validate by standard tab title',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.linkText('By Standard')).getText();
|
|
if (elementText !== 'By Standard') {
|
|
throw new Error(`Expected: "By Standard" tab title text did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: By Standard tab title text matched as expected');
|
|
}
|
|
},
|
|
|
|
//By Standard tab text title -gray (dimmed)
|
|
{
|
|
description: 'Validate by standard tab text color',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.linkText('By Standard')).getCssValue('color');
|
|
if (elementStyle !== 'rgba(182, 186, 181, 1)') {
|
|
throw new Error(`Expected: "By Standard" tab text title color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: By Standard tab text title color matched as expected');
|
|
}
|
|
},
|
|
|
|
//By Standard tab title -white (dimmed)
|
|
{
|
|
description: 'Validate by standard tab color',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.linkText('By Standard')).getCssValue('background-color');
|
|
if (elementStyle !== 'rgba(0, 0, 0, 0)') {
|
|
throw new Error(`Expected: "By Standard" tab title color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: By Standard tab title color matched as expected');
|
|
}
|
|
},
|
|
|
|
//AutoAlign tab title (active)
|
|
{
|
|
description: 'Validate AutoAlign tab title',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.linkText('AutoAlign')).getText();
|
|
if (elementText !== 'AutoAlign') {
|
|
throw new Error(`Expected: "AutoAlign" tab title text did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: AutoAlign tab title text matched as expected');
|
|
}
|
|
},
|
|
|
|
//AutoAlign tab text title -navy blue (active)
|
|
{
|
|
description: 'Validate AutoAlign tab text color',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.linkText('AutoAlign')).getCssValue('color');
|
|
if (elementStyle !== 'rgba(255, 255, 255, 1)') {
|
|
throw new Error(`Expected: "AutoAlign" tab text title color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: AutoAlign tab text title color matched as expected');
|
|
}
|
|
},
|
|
|
|
//AutoAlign tab title -navy blue (active)
|
|
{
|
|
description: 'Validate AutoAlign tab color',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.linkText('AutoAlign')).getCssValue('background-color');
|
|
if (elementStyle !== 'rgba(40, 39, 90, 1)') {
|
|
throw new Error(`Expected: "AutoAlign" tab title color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
console.log('Passed: AutoAlign tab title color matched as expected');
|
|
}
|
|
},
|
|
|
|
//EdGates AutoAlign system...title
|
|
{
|
|
description: 'Validate EdGates AutoAlign title',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('#suggest_form > b')).getText();
|
|
if (elementText !== `EdGate's AutoAlign system can suggest concepts that may be relevant`) {
|
|
throw new Error(`Expected: "EdGate's AutoAlign system can suggest concepts that may be relevant" tab title text did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log(`Passed: EdGate's AutoAlign system can suggest concepts that may be relevant title text matched as expected`);
|
|
}
|
|
},
|
|
|
|
/*Base Suggestions On sub-title
|
|
{
|
|
description: 'Validate AutoAlign sub-title',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('#suggest_form')).getText();
|
|
if (elementText !== 'Base Suggestions On:2') {
|
|
throw new Error(`Expected: "Base Suggestions On1" sub-title text did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Base Suggestions1 On sub-title text matched as expected');
|
|
}
|
|
},*/
|
|
|
|
//Title checkbox
|
|
{
|
|
description: 'Verify Title checkbox is present',
|
|
action: async () =>
|
|
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('#inlineCheckbox1')), 5000).catch(() => false);
|
|
if (!expectedIcon) {
|
|
throw new Error('Title checkbox not found');
|
|
}
|
|
console.log('Passed: Title checkbox present');
|
|
}
|
|
},
|
|
|
|
//Title checkbox label
|
|
{
|
|
description: 'Validate Title checkbox label',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.checkbox-inline:nth-child(1)')).getText();
|
|
if (elementText !== 'Title') {
|
|
throw new Error(`Expected: "Title" checkbox label did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Title checkbox label matched as expected');
|
|
}
|
|
},
|
|
|
|
//Description checkbox
|
|
{
|
|
description: 'Verify Description checkbox is present',
|
|
action: async () =>
|
|
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('#inlineCheckbox2')), 5000).catch(() => false);
|
|
if (!expectedIcon) {
|
|
throw new Error('Description checkbox not found');
|
|
}
|
|
console.log('Passed: Description checkbox present');
|
|
}
|
|
},
|
|
|
|
//Description checkbox label
|
|
{
|
|
description: 'Validate Description checkbox label',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.checkbox-inline:nth-child(2)')).getText();
|
|
if (elementText !== 'Description') {
|
|
throw new Error(`Expected: "Description" checkbox label did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Description checkbox label matched as expected');
|
|
}
|
|
},
|
|
|
|
//Alignment Status checkbox
|
|
{
|
|
description: 'Verify Alignment Status checkbox is present',
|
|
action: async () =>
|
|
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('#inlineCheckbox3')), 5000).catch(() => false);
|
|
if (!expectedIcon) {
|
|
throw new Error('Alignment Status checkbox not found');
|
|
}
|
|
console.log('Passed: Alignment Status checkbox present');
|
|
}
|
|
},
|
|
|
|
//Alignment Status checkbox label
|
|
{
|
|
description: 'Validate Alignment Status checkbox label',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.checkbox-inline:nth-child(3)')).getText();
|
|
if (elementText !== 'Alignment Status') {
|
|
throw new Error(`Expected: "Alignment Status" checkbox label did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Alignment Status checkbox label matched as expected');
|
|
}
|
|
},
|
|
|
|
/*# of Concepts label
|
|
{
|
|
description: 'Validate # of Concepts label',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('#suggest_form')).getText();
|
|
if (elementText !== '# of Concepts') {
|
|
throw new Error(`Expected: "# of Concepts" label did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: # of Concepts label matched as expected');
|
|
}
|
|
},*/
|
|
|
|
//# of Concepts dropdown value
|
|
{
|
|
description: 'Validate # of Concepts dropdown value text',
|
|
action: async () => {
|
|
const elementValue = await driver.findElement(By.css('#conceptnum')).getAttribute('value');
|
|
if (elementValue !== '5') {
|
|
throw new Error(`Expected: "5"; Actual: "${elementValue}"`);
|
|
}
|
|
console.log('Passed: 5 value text matched as expected');
|
|
}
|
|
},
|
|
|
|
/*Subject Areas label
|
|
{
|
|
description: 'Validate Subject Areas label',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('#suggest_form')).getText();
|
|
if (elementText !== 'Subject Areas') {
|
|
throw new Error(`Expected: "Subject Areas" label did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Subject Areas label matched as expected');
|
|
}
|
|
},*/
|
|
|
|
//Subject Area value -Language Arts
|
|
{
|
|
description: 'Validate Subject Area value Language Arts text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('#concept_subjects > option:nth-child(1)')).getText();
|
|
if (elementText !== 'Language Arts') {
|
|
throw new Error(`Expected: Subject Areas: "Language Arts" label did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Subject Areas: Language Arts label matched as expected');
|
|
}
|
|
},
|
|
|
|
//Subject Area value -Mathematics
|
|
{
|
|
description: 'Validate Subject Area value Mathematics text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('#concept_subjects > option:nth-child(2)')).getText();
|
|
if (elementText !== 'Mathematics') {
|
|
throw new Error(`Expected: Subject Areas: "Mathematics" label did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Subject Areas: Mathematics label matched as expected');
|
|
}
|
|
},
|
|
|
|
//Subject Area value -Science
|
|
{
|
|
description: 'Validate Subject Area value Science text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('#concept_subjects > option:nth-child(3)')).getText();
|
|
if (elementText !== 'Science') {
|
|
throw new Error(`Expected: Subject Areas: "Science" label did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Subject Areas: Science label matched as expected');
|
|
}
|
|
},
|
|
|
|
//Subject Area value -Social Studies
|
|
{
|
|
description: 'Validate Subject Area value Social Studies text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('#concept_subjects > option:nth-child(4)')).getText();
|
|
if (elementText !== 'Social Studies') {
|
|
throw new Error(`Expected: Subject Areas: "Social Studies" label did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Subject Areas: Social Studies label matched as expected');
|
|
}
|
|
},
|
|
|
|
//Suggest Concepts button text
|
|
{
|
|
description: 'Validate Suggest Concepts button text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.btn:nth-child(9)')).getText();
|
|
if (elementText !== 'Suggest Concepts') {
|
|
throw new Error(`Expected: "Suggest Concepts" button text did not match; Actual: "${elementText}"`);
|
|
}
|
|
console.log('Passed: Suggest Concepts button text matched as expected');
|
|
}
|
|
},
|
|
|
|
//Suggest Concepts button icon
|
|
{
|
|
description: 'Verify Suggest Concepts button icon is present',
|
|
action: async () =>
|
|
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.glyphicon-tags')), 5000).catch(() => false);
|
|
if (!expectedIcon) {
|
|
throw new Error('Suggest Concepts button icon not found');
|
|
}
|
|
console.log('Passed: Suggest Concepts button icon present');
|
|
}
|
|
},
|
|
|
|
//Suggest Concepts button color -green
|
|
{
|
|
description: 'Validate Suggest Concepts button color',
|
|
action: async () => {
|
|
const elementValue = await driver.findElement(By.css('.btn:nth-child(9)')).getCssValue('background-color');
|
|
if (elementValue !== 'rgba(48, 200, 172, 1)') {
|
|
throw new Error(`Expected: "Suggest Concepts" button color did not match; Actual: "${elementValue}"`);
|
|
}
|
|
console.log('Passed: Suggest Concepts button color matched as expected');
|
|
}
|
|
},
|
|
|
|
//LOG OUT
|
|
//NEXT ACTION - Log out
|
|
{ description: 'Click Username dropdown', action: async () => await driver.findElement(By.css('#navbarDropdown > span')).click() },
|
|
{ description: 'Wait for action to complete', action: async () => await driver.sleep(2000) },
|
|
{ description: 'Click Log Out link', action: async () => await driver.findElement(By.linkText('Log Out')).click() },
|
|
{ description: 'Wait for action to complete', action: async () => await driver.sleep(2000) },
|
|
|
|
//Wait for login screen to load
|
|
{
|
|
description: 'Wait for log out process to complete',
|
|
action: async () => {
|
|
return await driver.wait(until.elementLocated(By.css('.login')), 10000).catch(() => false);
|
|
}
|
|
},
|
|
];
|
|
|
|
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', 'editItem');
|
|
|
|
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', 'editItem');
|
|
if (fs.existsSync(screenshotDir)) {
|
|
fs.rmSync(screenshotDir, { recursive: true, force: true });
|
|
}
|
|
fs.mkdirSync(screenshotDir, { recursive: true });
|
|
|
|
// Remove old Excel file
|
|
if (fs.existsSync('editItemResults.xlsx')) {
|
|
fs.unlinkSync('editItemResults.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, '');
|
|
|
|
let allStepsPassed = true;
|
|
|
|
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';
|
|
allStepsPassed = false;
|
|
}
|
|
}
|
|
|
|
//Check if log out was successful
|
|
const loginButton = await driver.wait(until.elementLocated(By.css('.login')), 5000).catch(() => false);
|
|
|
|
if (loginButton && allStepsPassed) {
|
|
console.log('PASSED: Edit Item(ExACT_editItem); All test steps completed successfully');
|
|
testStatus = 'Passed';
|
|
} else {
|
|
console.log('FAILED: Edit Item(ExACT_editItem); One or more test steps failed');
|
|
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, 'editItemResults.xlsx');
|
|
} finally {
|
|
await driver.quit();
|
|
}
|
|
})();
|
|
}
|
|
|
|
export default ExACT_editItem;
|