From 6a282249f72bacdacb95b05f20516f4ffa2a60ac Mon Sep 17 00:00:00 2001 From: jhuerta Date: Tue, 16 Sep 2025 16:32:59 -0700 Subject: [PATCH] Cleaned up script --- tests/ExACT_frameworkFrameworkGroupsDIV.js | 1796 +------------------- 1 file changed, 26 insertions(+), 1770 deletions(-) diff --git a/tests/ExACT_frameworkFrameworkGroupsDIV.js b/tests/ExACT_frameworkFrameworkGroupsDIV.js index d0e9961..cf1de22 100644 --- a/tests/ExACT_frameworkFrameworkGroupsDIV.js +++ b/tests/ExACT_frameworkFrameworkGroupsDIV.js @@ -2703,1780 +2703,36 @@ const steps = [ } }, + //DIV Close button text + { + description: 'Validate Close button text', + action: async () => { + const elementText = await driver.findElement(By.css('#modalclose')).getText(); + if (elementText === 'Close') { + console.log('Passed: Close button text matched as expected'); + } else { + throw new Error(`Expected: "Close" button text; Actual: "${elementText}"`); + } + } + }, + + //DIV Close button color -white + { + description: 'Validate Close button color', + action: async () => { + const elementStyle = await driver.findElement(By.css('#modalclose')).getCssValue('background-color'); + if (elementStyle === 'rgba(0, 0, 0, 0)') { + console.log('Passed: Close button color matched as expected'); + } else { + throw new Error(`Close button color did not match; Actual: "${elementStyle}"`); + } + } + }, + //NEXT ACTION - Close DIV { description: 'Click Close button', action: async () => await driver.findElement(By.css('#modalclose')).click() }, { description: 'Wait for action to complete', action: async () => await driver.sleep(2000) }, - - - - - - - - - - - - - - - - - - - - - - - -/* - //DIV Framework label - { - description: 'Validate Framework label', - action: async () => { - const elementText = await driver.findElement(By.css('#divtype > .form-label')).getText(); - if (elementText === 'Framework') { - console.log('Passed: Framework title text matched as expected'); - } else { - throw new Error(`Expected: "Framework" label text; Actual: "${elementText}"`); - } - } - }, - - //DIV Framework data - { - description: 'Validate Framework dropdown option', - action: async () => { - const dropdown = await driver.findElement(By.css('#divtype')); - const options = await dropdown.findElements(By.css('option')); - - for (const option of options) { - const elementText = await option.getText(); - if (elementText === 'Select a framework') { - await option.click(); - console.log(`Passed: Dropdown option: "${elementText}", matched as expected`); - return; - } - throw new Error(`Expected dropdown option: "${elementText}", value not found`); - } - } - }, - - //DIV Display Title label - { - description: 'Validate Display Title label', - action: async () => { - const elementText = await driver.findElement(By.css('#divname > .form-label')).getText(); - if (elementText === 'Display Title') { - console.log('Passed: Display Title label text matched as expected'); - } else { - throw new Error(`Expected: "Display Title" label text; Actual: "${elementText}"`); - } - } - }, - - //DIV Display Title - info icon - { - description: 'Verify Display Title info icon', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('#divname .fa')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Display Title info icon not found'); - } - console.log('Passed: Display Title info icon present'); - } - }, - - //DIV Display Title - value - { - description: 'Validate Display Title value', - action: async () => { - const elementValue = await driver.findElement(By.css('#title')).getAttribute('value'); - if (elementValue === '') { - console.log('Passed: Display Title empty value text, matched as expected'); - } else { - throw new Error(`Expected: "empty" value text; Actual: "${elementValue}"`); - } - } - }, - - //DIV Version label - { - description: 'Validate Version label', - action: async () => { - const elementText = await driver.findElement(By.css('#divsource > .form-label')).getText(); - if (elementText === 'Version') { - console.log('Passed: Version label text matched as expected'); - } else { - throw new Error(`Expected: "Version" label text; Actual: "${elementText}"`); - } - } - }, - - //DIV Version - info icon - { - description: 'Verify Version info icon', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('#divsource .fa')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Version info icon not found'); - } - console.log('Passed: Version info icon present'); - } - }, - - //DIV Version - value - { - description: 'Validate Version value', - action: async () => { - const elementValue = await driver.findElement(By.css('#version')).getAttribute('value'); - if (elementValue === '') { - console.log('Passed: empty value text, matched as expected'); - } else { - throw new Error(`Expected: "empty" value text; Actual: "${elementValue}"`); - } - } - }, - - //DIV Display Status label - { - description: 'Validate Display Status label', - action: async () => { - const elementText = await driver.findElement(By.css('#divpublisher > .form-label')).getText(); - if (elementText === 'Display Status') { - console.log('Passed: Display Status label text matched as expected'); - } else { - throw new Error(`Expected: "Display Status" label text; Actual: "${elementText}"`); - } - } - }, - - //DIV Display Status - info icon - { - description: 'Verify Display Status info icon', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('#divpublisher .fa')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Display Status info icon not found'); - } - console.log('Passed: Display Status info icon present'); - } - }, - - //DIV Display Status - value - { - description: 'Validate Display dropdown selection', - action: async () => { - const elementOption = await driver.findElement(By.css('#status')).getAttribute('value'); - if (elementOption === 'Implemented') { - console.log('Passed: Implemented dropdown option matched as expected'); - } else { - throw new Error(`Expected: "Implemented" dropdown selection; Actual: "${elementOption}"`); - } - } - }, - - //DIV Group label - { - description: 'Validate Group label', - action: async () => { - const elementText = await driver.findElement(By.css('#divparent > .form-label')).getText(); - if (elementText === 'Group') { - console.log('Passed: Group label text matched as expected'); - } else { - throw new Error(`Expected: "Group" label text; Actual: "${elementText}"`); - } - } - }, - - //DIV Group - info icon - { - description: 'Verify Group info icon', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('#divparent .fa')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Group info icon not found'); - } - console.log('Passed: Group info icon present'); - } - }, - - //DIV Group - value {7=Initial Framwork Group for Testing} - { - description: 'Validate Group dropdown selection', - action: async () => { - const elementOption = await driver.findElement(By.css('#group')).getAttribute('value'); - if (elementOption === '7') { - console.log('Passed: Initial Framwork Group for Testing dropdown option matched as expected'); - } else { - throw new Error(`Expected: "Initial Framwork Group for Testing" dropdown selection; Actual: "${elementOption}"`); - } - } - }, - - //DIV Download Formats label - { - description: 'Validate Download Formats label', - action: async () => { - const elementText = await driver.findElement(By.css('#divcreator > .form-label')).getText(); - if (elementText === 'Download Formats') { - console.log('Passed: Download Formats label text matched as expected'); - } else { - throw new Error(`Expected: "Download Formats" label text; Actual: "${elementText}"`); - } - } - }, - - //DIV Download Formats - info icon - { - description: 'Verify Download Formats info icon', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('#divcreator .fa')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Download Formats info icon not found'); - } - console.log('Passed: Download Formats info icon present'); - } - }, - - //DIV Download Formats: CSV checkbox -active - { - description: 'Validate CSV checkbox option enabled', - action: async () => { - const elementStyle = await driver.findElement(By.css('#formatcsv')).getAttribute('checked'); - if (elementStyle === 'true') { - console.log('Passed: CSV checkbox option value matched as expected'); - } else { - throw new Error(`CSV checkbox option value checked did not match; Actual: "${elementStyle}"`); - } - } - }, - - //DIV Download Formats: CSV handle - { - description: 'Validate CSV label', - action: async () => { - const elementText = await driver.findElement(By.css('#divcreator > .form-check:nth-child(4) > .form-check-label')).getText(); - if (elementText === 'CSV') { - console.log('Passed: CSV label text matched as expected'); - } else { - throw new Error(`Expected: "CSV" label text; Actual: "${elementText}"`); - } - } - }, - - //DIV Download Formats: PDF checkbox -active - { - description: 'Validate PDF checkbox option enabled', - action: async () => { - const elementStyle = await driver.findElement(By.css('#formatpdf')).getAttribute('checked'); - if (elementStyle === 'true') { - console.log('Passed: PDF checkbox option value matched as expected'); - } else { - throw new Error(`PDF checkbox option value checked did not match; Actual: "${elementStyle}"`); - } - } - }, - - //DIV Download Formats: PDF handle - { - description: 'Validate PDF label', - action: async () => { - const elementText = await driver.findElement(By.css('.form-check:nth-child(5) > .form-check-label')).getText(); - if (elementText === 'PDF') { - console.log('Passed: PDF label text matched as expected'); - } else { - throw new Error(`Expected: "PDF" label text; Actual: "${elementText}"`); - } - } - }, - - //DIV Download Formats: JSON checkbox -active - { - description: 'Validate JSON checkbox option enabled', - action: async () => { - const elementStyle = await driver.findElement(By.css('#formatcase')).getAttribute('checked'); - if (elementStyle === 'true') { - console.log('Passed: JSON checkbox option value matched as expected'); - } else { - throw new Error(`JSON checkbox option value checked did not match; Actual: "${elementStyle}"`); - } - } - }, - - //DIV Download Formats: JSON handle - { - description: 'Validate JSON label', - action: async () => { - const elementText = await driver.findElement(By.css('.form-check:nth-child(6) > .form-check-label')).getText(); - if (elementText === 'CASE JSON/API*') { - console.log('Passed: CASE JSON/API* label text matched as expected'); - } else { - throw new Error(`Expected: "CASE JSON/API*" label text; Actual: "${elementText}"`); - } - } - }, - - //DIV Download Formats: Required text - { - description: 'Validate Required text', - action: async () => { - const elementText = await driver.findElement(By.css('em > small')).getText(); - if (elementText === 'This option also allows access to this framework via CASE compliant API') { - console.log('Passed: This option also allows access to this framework via CASE compliant API text matched as expected'); - } else { - throw new Error(`Expected: "This option also allows access to this framework via CASE compliant API" text; Actual: "${elementText}"`); - } - } - }, - - //DIV Comment Settings text - { - description: 'Validate Comment Settings text', - action: async () => { - const elementText = await driver.findElement(By.css('#divstatus > .form-label')).getText(); - if (elementText === 'Comment Settings') { - console.log('Passed: Comment Settings text matched as expected'); - } else { - throw new Error(`Expected: "Comment Settings" text; Actual: "${elementText}"`); - } - } - }, - - //DIV Comment Settings: Allow Comments checkbox -active - { - description: 'Validate Allow Comments checkbox option enabled', - action: async () => { - const elementStyle = await driver.findElement(By.css('#comments')).getAttribute('checked'); - if (elementStyle === 'true') { - console.log('Passed: Allow Comments checkbox option value matched as expected'); - } else { - throw new Error(`Allow Comments checkbox option value checked did not match; Actual: "${elementStyle}"`); - } - } - }, - - //DIV Comment Settings: Allow Comments handle - { - description: 'Validate Allow Comments label', - action: async () => { - const elementText = await driver.findElement(By.css('.form-check:nth-child(3) > .form-check-label')).getText(); - if (elementText === 'Allow Comments') { - console.log('Passed: Allow Comments label text matched as expected'); - } else { - throw new Error(`Expected: "Allow Comments" label text; Actual: "${elementText}"`); - } - } - }, - - //DIV Comment Settings: Comments are private checkbox - { - description: 'Validate Comments are private checkbox', - action: async () => { - const elementStyle = await driver.findElement(By.css('#private')).getAttribute('type'); - if (elementStyle === 'checkbox') { - console.log('Passed: Comments are private checkbox type matched as expected'); - } else { - throw new Error(`Comments are private checkbox type does not match; Actual: "${elementStyle}"`); - } - } - }, - - //DIV Comment Settings: Comments are private handle - { - description: 'Validate Comments are private label', - action: async () => { - const elementText = await driver.findElement(By.css('#divstatus > .form-check:nth-child(4) > .form-check-label')).getText(); - if (elementText === 'Comments are private') { - console.log('Passed: Comments are private label text matched as expected'); - } else { - throw new Error(`Expected: "Comments are private" label text; Actual: "${elementText}"`); - } - } - }, - - //DIV Publishers Notes label - { - description: 'Validate Publishers Notes label', - action: async () => { - const elementText = await driver.findElement(By.css('#divpubnotes > .form-label')).getText(); - if (elementText === `Publisher's Notes`) { - console.log(`Passed: Publisher's Notese label text matched as expected`); - } else { - throw new Error(`Expected: "Publisher's Notes" label text; Actual: "${elementText}"`); - } - } - }, - - //DIV Publishers Notes textbox placeholder - { - description: 'Validate Publishers Notes textbox placeholder', - action: async () => { - const elementValue = await driver.findElement(By.css('#pubnotes')).getAttribute('placeholder'); - if (elementValue === '') { - console.log('Passed: "blank" placeholder text, matched as expected'); - } else { - throw new Error(`Expected: "blank" placeholder text; Actual: "${elementValue}"`); - } - } - }, - - //DIV Publish button text - { - description: 'Validate Publish button text', - action: async () => { - const elementText = await driver.findElement(By.css('#modalop')).getAttribute('value'); - if (elementText === 'Publish') { - console.log('Passed: Publish button text matched as expected'); - } else { - throw new Error(`Expected: "Publish" button text; Actual: "${elementText}"`); - } - } - }, - - //DIV Publish button color -white - { - description: 'Validate Publish button color', - action: async () => { - const elementStyle = await driver.findElement(By.css('#modalop')).getCssValue('background-color'); - if (elementStyle === 'rgba(48, 200, 172, 1)') { - console.log('Passed: Publish button color matched as expected'); - } else { - throw new Error(`Publish button color did not match; Actual: "${elementStyle}"`); - } - } - }, - - //DIV Close button text - { - description: 'Validate Close button text', - action: async () => { - const elementText = await driver.findElement(By.css('#modalclose')).getText(); - if (elementText === 'Close') { - console.log('Passed: Close button text matched as expected'); - } else { - throw new Error(`Expected: "Close" button text; Actual: "${elementText}"`); - } - } - }, - - //DIV Close button color -white - { - description: 'Validate Close button color', - action: async () => { - const elementStyle = await driver.findElement(By.css('#modalclose')).getCssValue('background-color'); - if (elementStyle === 'rgba(0, 0, 0, 0)') { - console.log('Passed: Close button color matched as expected'); - } else { - throw new Error(`Close button color did not match; Actual: "${elementStyle}"`); - } - } - }, - - //NEXT ACTION - Publish button (validation) - { description: 'Click Publish button', action: async () => await driver.findElement(By.css('#modalop')).click() }, - - //Wait for validation to appear - { - description: 'Wait for validation text', - action: async () => { - return await driver.wait(until.elementLocated(By.css('.invalid-feedback:nth-child(3)')), 10000).catch(() => false); - } - }, - - //Framework validation text - { - description: 'Validate Framework validation text', - action: async () => { - const elementText = await driver.findElement(By.css('.invalid-feedback:nth-child(3)')).getText(); - if (elementText === 'You must select a framework to publish.') { - console.log('Passed: Framework validation text matched as expected'); - } else { - throw new Error(`Expected: "You must select a framework to publish." validation text; Actual: "${elementText}"`); - } - } - }, - - //Framework validation text color -red - { - description: 'Validate Framework validation text color', - action: async () => { - const elementStyle = await driver.findElement(By.css('.invalid-feedback:nth-child(3)')).getCssValue('color'); - if (elementStyle === 'rgba(220, 53, 69, 1)') { - console.log('Passed: Framework validation text color matched as expected'); - } else { - throw new Error(`Framework validation text color did not match; Actual: "${elementStyle}"`); - } - } - }, - - //Display Title validation text - { - description: 'Validate Display Title validation text', - action: async () => { - const elementText = await driver.findElement(By.css('#divname > .invalid-feedback')).getText(); - if (elementText === 'You must enter a framework title') { - console.log('Passed: Display Title validation text matched as expected'); - } else { - throw new Error(`Expected: "You must enter a framework title" validation text; Actual: "${elementText}"`); - } - } - }, - - //Display Title validation text color -red - { - description: 'Validate Display Title validation text color', - action: async () => { - const elementStyle = await driver.findElement(By.css('#divname > .invalid-feedback')).getCssValue('color'); - if (elementStyle === 'rgba(220, 53, 69, 1)') { - console.log('Passed: Display Title validation text color matched as expected'); - } else { - throw new Error(`Display Title validation text color did not match; Actual: "${elementStyle}"`); - } - } - }, - - //Version validation text - { - description: 'Validate Version validation text', - action: async () => { - const elementText = await driver.findElement(By.css('#divsource > .invalid-feedback')).getText(); - if (elementText === 'You must enter a version for the published framework') { - console.log('Passed: Version validation text matched as expected'); - } else { - throw new Error(`Expected: "You must enter a version for the published framework" validation text; Actual: "${elementText}"`); - } - } - }, - - //Version validation text color -red - { - description: 'Validate Version validation text color', - action: async () => { - const elementStyle = await driver.findElement(By.css('#divsource > .invalid-feedback')).getCssValue('color'); - if (elementStyle === 'rgba(220, 53, 69, 1)') { - console.log('Passed: Version validation text color matched as expected'); - } else { - throw new Error(`Version validation text color did not match; Actual: "${elementStyle}"`); - } - } - }, - - //DIV validation text - { - description: 'Validate DIV validation text', - action: async () => { - const elementText = await driver.findElement(By.css('b')).getText(); - if (elementText === 'Please enter a value for all highlighted fields') { - console.log('Passed: DIV validation text matched as expected'); - } else { - throw new Error(`Expected: "Please enter a value for all highlighted fields" validation text; Actual: "${elementText}"`); - } - } - }, - - //DIV validation text color -red - { - description: 'Validate DIV validation text color', - action: async () => { - const elementStyle = await driver.findElement(By.css('b')).getCssValue('color'); - if (elementStyle === 'rgba(220, 53, 69, 1)') { - console.log('Passed: DIV validation text color matched as expected'); - } else { - throw new Error(`DIV validation text color did not match; Actual: "${elementStyle}"`); - } - } - }, - - //PUBLISH FRAMEWORK - //NEXT ACTION - Publish Framework (to be deleted) - { description: 'Click Framework dropdown', action: async () => await driver.findElement(By.css('#divtype > .form-label')).click() }, - { description: 'Select framework - Make Sure To Delete', action: async () => await driver.findElement(By.css('optgroup:nth-child(8) > option')).click() }, - { description: 'Enter Display Title', action: async () => await driver.findElement(By.css('#title')).sendKeys('I will automatically delete you') }, - { description: 'Enter Version', action: async () => await driver.findElement(By.css('#version')).sendKeys('1.19') }, - { description: 'Click Publish button', action: async () => await driver.findElement(By.css('#modalop')).click() }, - { description: 'Wait for action to complete', action: async () => await driver.sleep(5000) }, - - //Alert banner - { - description: 'Validate alert banner text', - action: async () => { - try { - const element = await driver.findElement(By.css('.alert')); - - //Get different versions of the text for debugging - const fullText = await element.getText(); - - //Check for the expected text in different ways - const expectedText = 'Make Sure To Delete'; - const trimmedFullText = fullText.trim(); - const firstLine = trimmedFullText.split('\n')[0].trim(); - - //Try multiple matching strategies - if (firstLine.includes(expectedText)) { - console.log(`Passed: "${expectedText}" text found as expected`); - } else if (trimmedFullText.includes(expectedText)) { - console.log(`Passed: "${expectedText}" text found as expected`); - } else { - throw new Error( - `Text validation failed.\nExpected: "${expectedText}"\n` + - `Full text: "${fullText}"\n` + - `First line: "${firstLine}"\n` - ); - } - - } catch (error) { - console.error('Detailed error during validation:', error); - throw error; //Re-throw after logging - } - } - }, - - //Alert banner background color -green - { - description: 'Validate alert banner background text color', - action: async () => { - const elementStyle = await driver.findElement(By.css('.alert')).getCssValue('background-color'); - if (elementStyle === 'rgba(40, 167, 69, 1)') { - console.log('Passed: Alert banner background text color matched as expected'); - } else { - throw new Error(`Alert banner text color did not match; Actual: "${elementStyle}"`); - } - } - }, - - //NEXT ACTION - Close alert banner - { description: 'Click X icon on alert banner', action: async () => await driver.findElement(By.css('.close > span')).click() }, - { description: 'Wait for action to complete', action: async () => await driver.sleep(2000) }, - - //Framework column title - { - description: 'Validate Framework column title', - action: async () => { - const elementText = await driver.findElement(By.css('th:nth-child(1)')).getText(); - if (elementText === 'Framework') { - console.log('Passed: Framework column title text matched as expected'); - } else { - throw new Error(`Expected: "Framework" column title text; Actual: "${elementText}"`); - } - } - }, - - //Framework column title text color -dark blue - { - description: 'Validate Framework column title text color', - action: async () => { - const elementStyle = await driver.findElement(By.css('th:nth-child(1)')).getCssValue('color'); - if (elementStyle === 'rgba(33, 37, 41, 1)') { - console.log('Passed: Framework column title text color matched as expected'); - } else { - throw new Error(`Framework column title text color did not match; Actual: "${elementStyle}"`); - } - } - }, - - //Framework column title text font - { - description: 'Validate Framework column title text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('th:nth-child(1)')).getCssValue('font-size'); - if (elementStyle === '14.3px') { - console.log('Passed: Framework column title text font-size matched as expected'); - } else { - throw new Error(`Framework column title text font-size did not match; Actual: "${elementStyle}"`); - } - } - }, - - //Version column title - { - description: 'Validate Version column title', - action: async () => { - const elementText = await driver.findElement(By.css('th:nth-child(2)')).getText(); - if (elementText === 'Version') { - console.log('Passed: Version column title text matched as expected'); - } else { - throw new Error(`Expected: "Version" column title text; Actual: "${elementText}"`); - } - } - }, - - //Version column title text color -dark blue - { - description: 'Validate Version column title text color', - action: async () => { - const elementStyle = await driver.findElement(By.css('th:nth-child(2)')).getCssValue('color'); - if (elementStyle === 'rgba(33, 37, 41, 1)') { - console.log('Passed: Version column title text color matched as expected'); - } else { - throw new Error(`Version column title text color did not match; Actual: "${elementStyle}"`); - } - } - }, - - //Version column title text font - { - description: 'Validate Version column title text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('th:nth-child(2)')).getCssValue('font-size'); - if (elementStyle === '14.3px') { - console.log('Passed: Version column title text font-size matched as expected'); - } else { - throw new Error(`Version column title text font-size did not match; Actual: "${elementStyle}"`); - } - } - }, - - //Revision column title - { - description: 'Validate Revision column title', - action: async () => { - const elementText = await driver.findElement(By.css('th:nth-child(3)')).getText(); - if (elementText === 'Revision') { - console.log('Passed: Revision column title text matched as expected'); - } else { - throw new Error(`Expected: "Revision" column title text; Actual: "${elementText}"`); - } - } - }, - - //Revision column title text color -dark blue - { - description: 'Validate Revision column title text color', - action: async () => { - const elementStyle = await driver.findElement(By.css('th:nth-child(3)')).getCssValue('color'); - if (elementStyle === 'rgba(33, 37, 41, 1)') { - console.log('Passed: Revision column title text color matched as expected'); - } else { - throw new Error(`Revision column title text color did not match; Actual: "${elementStyle}"`); - } - } - }, - - //Revision column title text font - { - description: 'Validate Revision column title text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('th:nth-child(3)')).getCssValue('font-size'); - if (elementStyle === '14.3px') { - console.log('Passed: Revision column title text font-size matched as expected'); - } else { - throw new Error(`Revision column title text font-size did not match; Actual: "${elementStyle}"`); - } - } - }, - - //Status column title - { - description: 'Validate Status column title', - action: async () => { - const elementText = await driver.findElement(By.css('th:nth-child(4)')).getText(); - if (elementText === 'Status') { - console.log('Passed: Status column title text matched as expected'); - } else { - throw new Error(`Expected: "Status" column title text; Actual: "${elementText}"`); - } - } - }, - - //Status column title text color -dark blue - { - description: 'Validate Status column title text color', - action: async () => { - const elementStyle = await driver.findElement(By.css('th:nth-child(4)')).getCssValue('color'); - if (elementStyle === 'rgba(33, 37, 41, 1)') { - console.log('Passed: Status column title text color matched as expected'); - } else { - throw new Error(`Status column title text color did not match; Actual: "${elementStyle}"`); - } - } - }, - - //Status column title text font - { - description: 'Validate Status column title text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('th:nth-child(4)')).getCssValue('font-size'); - if (elementStyle === '14.3px') { - console.log('Passed: Status column title text font-size matched as expected'); - } else { - throw new Error(`Status column title text font-size did not match; Actual: "${elementStyle}"`); - } - } - }, - - //Visibility column title - { - description: 'Validate Visibility column title', - action: async () => { - const elementText = await driver.findElement(By.css('th:nth-child(5)')).getText(); - if (elementText === 'Visibility') { - console.log('Passed: Visibility column title text matched as expected'); - } else { - throw new Error(`Expected: "Visibility" column title text; Actual: "${elementText}"`); - } - } - }, - - //Visibility column title text color -dark blue - { - description: 'Validate Visibility column title text color', - action: async () => { - const elementStyle = await driver.findElement(By.css('th:nth-child(5)')).getCssValue('color'); - if (elementStyle === 'rgba(33, 37, 41, 1)') { - console.log('Passed: Visibility column title text color matched as expected'); - } else { - throw new Error(`Visibility column title text color did not match; Actual: "${elementStyle}"`); - } - } - }, - - //Visibility column title text font - { - description: 'Validate Visibility column title text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('th:nth-child(5)')).getCssValue('font-size'); - if (elementStyle === '14.3px') { - console.log('Passed: Visibility column title text font-size matched as expected'); - } else { - throw new Error(`Visibility column title text font-size did not match; Actual: "${elementStyle}"`); - } - } - }, - - //Group column title - { - description: 'Validate Group column title', - action: async () => { - const elementText = await driver.findElement(By.css('th:nth-child(6)')).getText(); - if (elementText === 'Group') { - console.log('Passed: Group column title text matched as expected'); - } else { - throw new Error(`Expected: "Group" column title text; Actual: "${elementText}"`); - } - } - }, - - //Group column title text color -dark blue - { - description: 'Validate Group column title text color', - action: async () => { - const elementStyle = await driver.findElement(By.css('th:nth-child(6)')).getCssValue('color'); - if (elementStyle === 'rgba(33, 37, 41, 1)') { - console.log('Passed: Group column title text color matched as expected'); - } else { - throw new Error(`Group column title text color did not match; Actual: "${elementStyle}"`); - } - } - }, - - //Group column title text font - { - description: 'Validate Group column title text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('th:nth-child(6)')).getCssValue('font-size'); - if (elementStyle === '14.3px') { - console.log('Passed: Group column title text font-size matched as expected'); - } else { - throw new Error(`Group column title text font-size did not match; Actual: "${elementStyle}"`); - } - } - }, - - //Published At column title - { - description: 'Validate Published At column title', - action: async () => { - const elementText = await driver.findElement(By.css('th:nth-child(7)')).getText(); - if (elementText === 'Published At') { - console.log('Passed: Published At column title text matched as expected'); - } else { - throw new Error(`Expected: "Published At" column title text; Actual: "${elementText}"`); - } - } - }, - - //Published At column title text color -dark blue - { - description: 'Validate Published At column title text color', - action: async () => { - const elementStyle = await driver.findElement(By.css('th:nth-child(7)')).getCssValue('color'); - if (elementStyle === 'rgba(33, 37, 41, 1)') { - console.log('Passed: Published At column title text color matched as expected'); - } else { - throw new Error(`Published At column title text color did not match; Actual: "${elementStyle}"`); - } - } - }, - - //Published At column title text font - { - description: 'Validate Published At column title text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('th:nth-child(7)')).getCssValue('font-size'); - if (elementStyle === '14.3px') { - console.log('Passed: Published At column title text font-size matched as expected'); - } else { - throw new Error(`Published At column title text font-size did not match; Actual: "${elementStyle}"`); - } - } - }, - - //By column title - { - description: 'Validate By column title', - action: async () => { - const elementText = await driver.findElement(By.css('th:nth-child(8)')).getText(); - if (elementText === 'By') { - console.log('Passed: By column title text matched as expected'); - } else { - throw new Error(`Expected: "By" column title text; Actual: "${elementText}"`); - } - } - }, - - //By column title text color -dark blue - { - description: 'Validate By column title text color', - action: async () => { - const elementStyle = await driver.findElement(By.css('th:nth-child(8)')).getCssValue('color'); - if (elementStyle === 'rgba(33, 37, 41, 1)') { - console.log('Passed: By column title text color matched as expected'); - } else { - throw new Error(`By column title text color did not match; Actual: "${elementStyle}"`); - } - } - }, - - //By column title text font - { - description: 'Validate By column title text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('th:nth-child(8)')).getCssValue('font-size'); - if (elementStyle === '14.3px') { - console.log('Passed: By column title text font-size matched as expected'); - } else { - throw new Error(`By column title text font-size did not match; Actual: "${elementStyle}"`); - } - } - }, - - //Comments column title - { - description: 'Validate Comments column title', - action: async () => { - const elementText = await driver.findElement(By.css('th:nth-child(9)')).getText(); - if (elementText === 'Comments') { - console.log('Passed: Comments column title text matched as expected'); - } else { - throw new Error(`Expected: "Comments" column title text; Actual: "${elementText}"`); - } - } - }, - - //Comments column title text color -dark blue - { - description: 'Validate Comments column title text color', - action: async () => { - const elementStyle = await driver.findElement(By.css('th:nth-child(9)')).getCssValue('color'); - if (elementStyle === 'rgba(33, 37, 41, 1)') { - console.log('Passed: Comments column title text color matched as expected'); - } else { - throw new Error(`Comments column title text color did not match; Actual: "${elementStyle}"`); - } - } - }, - - //Comments column title text font - { - description: 'Validate Comments column title text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('th:nth-child(9)')).getCssValue('font-size'); - if (elementStyle === '14.3px') { - console.log('Passed: Comments column title text font-size matched as expected'); - } else { - throw new Error(`Comments column title text font-size did not match; Actual: "${elementStyle}"`); - } - } - }, - - //Action column title - { - description: 'Validate Action column title', - action: async () => { - const elementText = await driver.findElement(By.css('th:nth-child(10)')).getText(); - if (elementText === 'Action') { - console.log('Passed: Action column title text matched as expected'); - } else { - throw new Error(`Expected: "Action" column title text; Actual: "${elementText}"`); - } - } - }, - - //Action column title text color -dark blue - { - description: 'Validate Action column title text color', - action: async () => { - const elementStyle = await driver.findElement(By.css('th:nth-child(10)')).getCssValue('color'); - if (elementStyle === 'rgba(33, 37, 41, 1)') { - console.log('Passed: Action column title text color matched as expected'); - } else { - throw new Error(`Action column title text color did not match; Actual: "${elementStyle}"`); - } - } - }, - - //Action column title text font - { - description: 'Validate Action column title text font size', - action: async () => { - const elementStyle = await driver.findElement(By.css('th:nth-child(10)')).getCssValue('font-size'); - if (elementStyle === '14.3px') { - console.log('Passed: Action column title text font-size matched as expected'); - } else { - throw new Error(`Action column title text font-size did not match; Actual: "${elementStyle}"`); - } - } - }, - - //Published Framework 1 display title - { - description: 'Validate Published Framework 1 display title', - action: async () => { - try { - const element = await driver.findElement(By.css('tr:nth-child(2) > td:nth-child(1)')); - - //Get different versions of the text for debugging - const fullText = await element.getText(); - - //Check for the expected text in different ways - const expectedText = 'I will automatically delete you'; - const trimmedFullText = fullText.trim(); - const firstLine = trimmedFullText.split('\n')[0].trim(); - - //Try multiple matching strategies - if (firstLine.includes(expectedText)) { - console.log(`Passed: Framework title row 1 "${expectedText}" text in first line`); - } else if (trimmedFullText.includes(expectedText)) { - console.log(`Passed: Framework title row 1 "${expectedText}" text within full text`); - } else { - throw new Error( - `Text validation failed.\nExpected: "${expectedText}"\n` + - `Full text: "${fullText}"\n` + - `First line: "${firstLine}"\n` - ); - } - - } catch (error) { - console.error('Detailed error during validation:', error); - throw error; //Re-throw after logging - } - } - }, - - //Published Framework 1 API icon - { - description: 'Verify Published Framework 1 API icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(2) .fa-code')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Published Framework 1 API icon not found'); - } - console.log('Passed: Published Framework 1 API icon present'); - } - }, - - //Published Framework 1 title - { - description: 'Validate Published Framework 1 title', - action: async () => { - const elementText = await driver.findElement(By.css('tr:nth-child(2) em')).getText(); - if (elementText === 'Make Sure To Delete') { - console.log('Passed: Make Sure To Delete row 1 title text matched as expected'); - } else { - throw new Error(`Expected: "Make Sure To Delete" row 1 title text; Actual: "${elementText}"`); - } - } - }, - - //Published Framework 1 Version - { - description: 'Validate Published Framework 1 version', - action: async () => { - const elementText = await driver.findElement(By.css('tr:nth-child(2) > td:nth-child(2)')).getText(); - if (elementText === '1.19') { - console.log('Passed: Version 1.19 row 1 title text matched as expected'); - } else { - throw new Error(`Expected: Version "1.19" row 1 title text; Actual: "${elementText}"`); - } - } - }, - - /*Published Framework 1 Revision {revision number increases at every publish} - { - description: 'Validate Published Framework 1 revision', - action: async () => { - const elementText = await driver.findElement(By.css('tr:nth-child(2) > td:nth-child(3)')).getText(); - if (elementText === '1') { - console.log('Passed: Revision 1 row 1 title text matched as expected'); - } else { - throw new Error(`Expected: Revision "1" row 1 title text; Actual: "${elementText}"`); - } - } - },*/ -/* - //Published Framework 1 Status button text - { - description: 'Validate Published Framework 1 status button text', - action: async () => { - const elementText = await driver.findElement(By.css('tr:nth-child(2) > td > .badge')).getText(); - if (elementText === 'Implemented') { - console.log('Passed: Implemented row 1 title text matched as expected'); - } else { - throw new Error(`Expected: "Implemented" row 1 title text; Actual: "${elementText}"`); - } - } - }, - - //Published Framework 1 Status button color -gray - { - description: 'Validate Action column title text color', - action: async () => { - const elementStyle = await driver.findElement(By.css('tr:nth-child(2) > td > .badge')).getCssValue('background-color'); - if (elementStyle === 'rgba(40, 167, 69, 1)') { - console.log('Passed: Published Framework row 1 Status button color matched as expected'); - } else { - throw new Error(`Published Framework row 1 Status button color did not match; Actual: "${elementStyle}"`); - } - } - }, - - //Published Framework 1 Visibility - { - description: 'Validate Published Framework 1 visibility', - action: async () => { - const elementText = await driver.findElement(By.css('tr:nth-child(2) > td:nth-child(5)')).getText(); - if (elementText === 'Public') { - console.log('Passed: Public row 1 title text matched as expected'); - } else { - throw new Error(`Expected: "Public" row 1 title text; Actual: "${elementText}"`); - } - } - }, - - //Published Framework 1 Group - { - description: 'Validate Published Framework 1 group', - action: async () => { - const elementText = await driver.findElement(By.css('tr:nth-child(2) > td:nth-child(6)')).getText(); - if (elementText === 'Initial Framework Group for Testing') { - console.log('Passed: Initial Framework Group for Testing row 1 title text matched as expected'); - } else { - throw new Error(`Expected: "Initial Framework Group for Testing" row 1 title text; Actual: "${elementText}"`); - } - } - }, - - /*Published Framework 1 Published At - { - description: 'Validate Published Framework 1 published at', - action: async () => { - const elementText = await driver.findElement(By.css('tr:nth-child(2) > td:nth-child(7) > small')).getText(); - if (elementText === 'Apr 15, 2025 10:29pm PDT') { - console.log('Passed: Apr 15, 2025 10:29pm PDT row 1 title text matched as expected'); - } else { - throw new Error(`Expected: "Apr 15, 2025 10:29pm PDT" row 1 title text; Actual: "${elementText}"`); - } - } - },*/ -/* - //Published Framework 1 By - { - description: 'Validate Published Framework 1 by', - action: async () => { - const elementText = await driver.findElement(By.css('tr:nth-child(2) > td:nth-child(8)')).getText(); - if (elementText === 'exact_juan') { - console.log('Passed: exact_juan row 1 title text matched as expected'); - } else { - throw new Error(`Expected: "exact_juan" row 1 title text; Actual: "${elementText}"`); - } - } - }, - - //Published Framework 1 Comments icon - { - description: 'Verify Published Framework 1 comments icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(2) .fa-check-circle')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Published Framework row 1 comments icon not found'); - } - console.log('Passed: Published Framework row 1 comments icon present'); - } - }, - - //Published Framework 1 Comments Count icon - { - description: 'Validate Published Framework 1 comments count icon', - action: async () => { - const elementText = await driver.findElement(By.css('tr:nth-child(2) .badge-primary')).getText(); - if (elementText === '0') { - console.log('Passed: Comments count 0 row 1 title text matched as expected'); - } else { - throw new Error(`Expected: Comments count "0" row 1 title text; Actual: "${elementText}"`); - } - } - }, - - //Published Framework 1 ellipsis icon - { - description: 'Verify Published Framework 1 ellipsis icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.xpath('//td[11]/div/a/i')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Published Framework row 1 ellipsis icon not found'); - } - console.log('Passed: Published Framework row 1 ellipsis icon present'); - } - }, - - //Published Framework 2 display title - { - description: 'Validate Published Framework 2 display title', - action: async () => { - try { - const element = await driver.findElement(By.css('tr:nth-child(3) > td:nth-child(1)')); - - //Get different versions of the text for debugging - const fullText = await element.getText(); - - //Check for the expected text in different ways - const expectedText = 'Painting Done Today'; - const trimmedFullText = fullText.trim(); - const firstLine = trimmedFullText.split('\n')[0].trim(); - - //Try multiple matching strategies - if (firstLine.includes(expectedText)) { - console.log(`Passed: Framework title row 2 "${expectedText}" text in first line`); - } else if (trimmedFullText.includes(expectedText)) { - console.log(`Passed: Framework title row 2 "${expectedText}" text within full text`); - } else { - throw new Error( - `Text validation failed.\nExpected: "${expectedText}"\n` + - `Full text: "${fullText}"\n` + - `First line: "${firstLine}"\n` - ); - } - - } catch (error) { - console.error('Detailed error during validation:', error); - throw error; //Re-throw after logging - } - } - }, - - //Published Framework 2 Notes icon - { - description: 'Verify Published Framework 2 notes icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('.fa-sticky-note-o')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Published Framework 2 Notes icon not found'); - } - console.log('Passed: Published Framework 2 Notes icon present'); - } - }, - - //Published Framework 2 title - { - description: 'Validate Published Framework 2 title', - action: async () => { - const elementText = await driver.findElement(By.css('tr:nth-child(3) em')).getText(); - if (elementText === 'Juan Testing Again & Again') { - console.log('Passed: Juan Testing Again & Again row 2 title text matched as expected'); - } else { - throw new Error(`Expected: "Juan Testing Again & Again" row 2 title text; Actual: "${elementText}"`); - } - } - }, - - //Published Framework 2 Version - { - description: 'Validate Published Framework 2 version', - action: async () => { - const elementText = await driver.findElement(By.css('tr:nth-child(3) > td:nth-child(2)')).getText(); - if (elementText === '1.1') { - console.log('Passed: Version 1.1 row 2 title text matched as expected'); - } else { - throw new Error(`Expected: Version "1.1" row 2 title text; Actual: "${elementText}"`); - } - } - }, - - //Published Framework 2 Revision - { - description: 'Validate Published Framework 2 revision', - action: async () => { - const elementText = await driver.findElement(By.css('tr:nth-child(3) > td:nth-child(3)')).getText(); - if (elementText === '5') { - console.log('Passed: Revision 5 row 2 title text matched as expected'); - } else { - throw new Error(`Expected: Revision "5" row 2 title text; Actual: "${elementText}"`); - } - } - }, - - //Published Framework 2 Status button text - { - description: 'Validate Published Framework 2 status button text', - action: async () => { - const elementText = await driver.findElement(By.css('tr:nth-child(3) > td > .badge')).getText(); - if (elementText === 'Implemented') { - console.log('Passed: Implemented row 2 title text matched as expected'); - } else { - throw new Error(`Expected: "Implemented" row 2 title text; Actual: "${elementText}"`); - } - } - }, - - //Published Framework 2 Status button color -green - { - description: 'Validate Action column title text color', - action: async () => { - const elementStyle = await driver.findElement(By.css('tr:nth-child(3) > td > .badge')).getCssValue('background-color'); - if (elementStyle === 'rgba(40, 167, 69, 1)') { - console.log('Passed: Published Framework row 2 Status button color matched as expected'); - } else { - throw new Error(`Published Framework row 2 Status button color did not match; Actual: "${elementStyle}"`); - } - } - }, - - //Published Framework 2 Visibility - { - description: 'Validate Published Framework 2 visibility', - action: async () => { - const elementText = await driver.findElement(By.css('tr:nth-child(3) > td:nth-child(5)')).getText(); - if (elementText === 'Public') { - console.log('Passed: Public row 2 title text matched as expected'); - } else { - throw new Error(`Expected: "Public" row 2 title text; Actual: "${elementText}"`); - } - } - }, - - //Published Framework 2 Group - { - description: 'Validate Published Framework 2 group', - action: async () => { - const elementText = await driver.findElement(By.css('tr:nth-child(3) > td:nth-child(6)')).getText(); - if (elementText === 'Initial Framework Group for Testing') { - console.log('Passed: Initial Framework Group for Testing row 2 title text matched as expected'); - } else { - throw new Error(`Expected: "Initial Framework Group for Testing" row 2 title text; Actual: "${elementText}"`); - } - } - }, - - //Published Framework 2 Published At - { - description: 'Validate Published Framework 2 published at', - action: async () => { - const elementText = await driver.findElement(By.css('tr:nth-child(3) > td:nth-child(7) > small')).getText(); - if (elementText === 'Apr 15, 2025 10:29pm PDT') { - console.log('Passed: Apr 15, 2025 10:29pm PDT row 2 title text matched as expected'); - } else { - throw new Error(`Expected: "Apr 15, 2025 10:29pm PDT" row 2 title text; Actual: "${elementText}"`); - } - } - }, - - //Published Framework 2 By - { - description: 'Validate Published Framework 2 by', - action: async () => { - const elementText = await driver.findElement(By.css('tr:nth-child(3) > td:nth-child(8)')).getText(); - if (elementText === 'exact_juan') { - console.log('Passed: exact_juan row 2 title text matched as expected'); - } else { - throw new Error(`Expected: "exact_juan" row 2 title text; Actual: "${elementText}"`); - } - } - }, - - //Published Framework 2 Comments icon - { - description: 'Verify Published Framework 2 comments icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(3) .fa-check-circle')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Published Framework row 2 comments icon not found'); - } - console.log('Passed: Published Framework row 2 comments icon present'); - } - }, - - //Published Framework 2 Comments Count icon - { - description: 'Validate Published Framework 2 comments count icon', - action: async () => { - const elementText = await driver.findElement(By.css('tr:nth-child(3) a > .badge')).getText(); - if (elementText === '3') { - console.log('Passed: Comments count 3 row 2 title text matched as expected'); - } else { - throw new Error(`Expected: Comments count "3" row 2 title text; Actual: "${elementText}"`); - } - } - }, - - //Published Framework 2 ellipsis icon - { - description: 'Verify Published Framework 2 ellipsis icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('#dropdownMenu17 > .fa')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Published Framework row 2 ellipsis icon not found'); - } - console.log('Passed: Published Framework row 2 ellipsis icon present'); - } - }, - - //RESET PUBLISHING HISTORY - //NEXT ACTION - Delete published Framework - { description: 'Click published framework ellipsis icon', action: async () => await driver.findElement(By.xpath('//td[11]/div/a/i')).click() }, - { description: 'Wait for action to complete', action: async () => await driver.sleep(2000) }, - - //Ellipsis menu - View text - { - description: 'Validate ellipsis menu option View text label', - action: async () => { - const elementText = await driver.findElement(By.linkText('View')).getText(); - if (elementText === 'View') { - console.log('Passed: Ellipsis menu option View label text matched as expected'); - } else { - throw new Error(`Expected: Ellisis menu option "View" label text; Actual: "${elementText}"`); - } - } - }, - - //Ellipsis menu - View icon - { - description: 'Verify ellipsis menu option View icon', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('.show > .dropdown-item > .fa')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Ellipsis view icon not found'); - } - console.log('Passed: Ellipsis view icon present'); - } - }, - - //Ellipsis menu - Edit text - { - description: 'Validate ellipsis menu option Edit text label', - action: async () => { - const elementText = await driver.findElement(By.linkText('Edit')).getText(); - if (elementText === 'Edit') { - console.log('Passed: Ellipsis menu option Edit label text matched as expected'); - } else { - throw new Error(`Expected: Ellisis menu option "Edit" label text; Actual: "${elementText}"`); - } - } - }, - - //Ellipsis menu - Archive text - { - description: 'Validate ellipsis menu option Archive text label', - action: async () => { - const elementText = await driver.findElement(By.linkText('Archive')).getText(); - if (elementText === 'Archive') { - console.log('Passed: Ellipsis menu option Archive label text matched as expected'); - } else { - throw new Error(`Expected: Ellisis menu option "Archive" label text; Actual: "${elementText}"`); - } - } - }, - - //Ellipsis menu - Delete text - { - description: 'Validate ellipsis menu option Delete text label', - action: async () => { - const elementText = await driver.findElement(By.linkText('Delete')).getText(); - if (elementText === 'Delete') { - console.log('Passed: Ellipsis menu option Delete label text matched as expected'); - } else { - throw new Error(`Expected: Ellisis menu option "Delete" label text; Actual: "${elementText}"`); - } - } - }, - - //Ellipsis menu - Delete text color -red - { - description: 'Validate ellipsis Delete text color', - action: async () => { - const elementStyle = await driver.findElement(By.linkText('Delete')).getCssValue('color'); - if (elementStyle === 'rgba(220, 53, 69, 1)') { - console.log('Passed: Delete text color matched as expected'); - } else { - throw new Error(`Delete text color did not match; Actual: "${elementStyle}"`); - } - } - }, - - //NEXT ACTION - Delete published Framework - { description: 'Click Delete link', action: async () => await driver.findElement(By.linkText('Delete')).click() }, - - //Wait for DIV to load - Delete - { - description: 'Wait for DIV to load', - action: async () => { - return await driver.wait(until.elementLocated(By.css('.modal-title')), 10000).catch(() => false); - } - }, - - //DIV Delete Published Framework title text - { - description: 'Validate Delete Published Framework title text', - action: async () => { - const elementText = await driver.findElement(By.css('.modal-title')).getText(); - if (elementText === 'Delete Published Framework') { - console.log('Passed: Delete Published Framework title text matched as expected'); - } else { - throw new Error(`Expected: "Delete Published Framework" title text; Actual: "${elementText}"`); - } - } - }, - - //DIV X icon color -red - { - description: 'Validate X icon color', - action: async () => { - const elementStyle = await driver.findElement(By.css('.close > span')).getCssValue('color'); - if (elementStyle === 'rgba(246, 60, 40, 1)') { - console.log('Passed: DIV X icon color matched as expected'); - } else { - throw new Error(`DIV X icon color did not match; Actual: "${elementStyle}"`); - } - } - }, - - //DIV info icon - { - description: 'Verify Delete Info icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('.fa-info-circle')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Info icon not found'); - } - console.log('Passed: Info button icon present'); - } - }, - - //DIV Delete description text - { - description: 'Validate Delete description text', - action: async () => { - const elementText = await driver.findElement(By.css('.alert')).getText(); - if (elementText === 'You are about to delete this framework revision from the system. Its data will no longer be accesible and this action is not recoverable.') { - console.log('Passed: Deleting descriptive text matched as expected'); - } else { - throw new Error(`Expected: "Deleting descriptive" text; Actual: "${elementText}"`); - } - } - }, - - //DIV Delete description text background color -red - { - description: 'Validate Delete description background text color', - action: async () => { - const elementStyle = await driver.findElement(By.css('.alert')).getCssValue('background-color'); - if (elementStyle === 'rgba(231, 76, 60, 0.88)') { - console.log('Passed: Delete background text color matched as expected'); - } else { - throw new Error(`Delete background text color did not match; Actual: "${elementStyle}"`); - } - } - }, - - //DIV Framework label - { - description: 'Validate Framework label', - action: async () => { - const elementText = await driver.findElement(By.css('#divtype > .form-label')).getText(); - if (elementText === 'Framework') { - console.log('Passed: Framework label text matched as expected'); - } else { - throw new Error(`Expected: "Framework" label text; Actual: "${elementText}"`); - } - } - }, - - //DIV Framework value text - { - description: 'Validate Framework value text', - action: async () => { - try { - const element = await driver.findElement(By.css('#divtype')); - - //Get different versions of the text for debugging - const fullText = await element.getText(); - - //Check for the expected text in different ways - const expectedText = 'I will automatically delete you'; - const trimmedFullText = fullText.trim(); - const firstLine = trimmedFullText.split('\n')[0].trim(); - - //Try multiple matching strategies - if (firstLine.includes(expectedText)) { - console.log(`Passed: "${expectedText}" text in first line`); - } else if (trimmedFullText.includes(expectedText)) { - console.log(`Passed: "${expectedText}" text within full text`); - } else { - throw new Error( - `Text validation failed.\nExpected: "${expectedText}"\n` + - `Full text: "${fullText}"\n` + - `First line: "${firstLine}"\n` - ); - } - - } catch (error) { - console.error('Detailed error during validation:', error); - throw error; //Re-throw after logging - } - } - }, - - //DIV Retain comments checkbox -null - { - description: 'Validate Retain comments checkbox option enabled', - action: async () => { - const elementStyle = await driver.findElement(By.css('#retain')).getAttribute('type'); - if (elementStyle === 'checkbox') { - console.log('Passed: Retain comments checkbox type matched as expected'); - } else { - throw new Error(`Retain comments checkbox type does not match; Actual: "${elementStyle}"`); - } - } - }, - - //DIV Retain comments label - { - description: 'Validate Retain comments label', - action: async () => { - const elementText = await driver.findElement(By.css('.form-check-label')).getText(); - if (elementText === 'Retain comments') { - console.log('Passed: Retain comments label text matched as expected'); - } else { - throw new Error(`Expected: "Retain comments" label text; Actual: "${elementText}"`); - } - } - }, - - //DIV Delete button text - { - description: 'Validate Delete button text', - action: async () => { - const elementText = await driver.findElement(By.css('#modalop')).getAttribute('value'); - if (elementText === 'Delete') { - console.log('Passed: Delete button text matched as expected'); - } else { - throw new Error(`Expected: "Delete" button text; Actual: "${elementText}"`); - } - } - }, - - //DIV Delete button color -red - { - description: 'Validate Delete button color', - action: async () => { - const elementStyle = await driver.findElement(By.css('#modalop')).getCssValue('background-color'); - if (elementStyle === 'rgba(220, 53, 69, 1)') { - console.log('Passed: Delete button color matched as expected'); - } else { - throw new Error(`Delete button color did not match; Actual: "${elementStyle}"`); - } - } - }, - - //DIV Close button text - { - description: 'Validate Close button text', - action: async () => { - const elementText = await driver.findElement(By.css('#modalclose')).getText(); - if (elementText === 'Close') { - console.log('Passed: Close button text matched as expected'); - } else { - throw new Error(`Expected: "Close" button text; Actual: "${elementText}"`); - } - } - }, - - //DIV Close button color -white - { - description: 'Validate Close button color', - action: async () => { - const elementStyle = await driver.findElement(By.css('#modalclose')).getCssValue('background-color'); - if (elementStyle === 'rgba(0, 0, 0, 0)') { - console.log('Passed: Close button color matched as expected'); - } else { - throw new Error(`Close button color did not match; Actual: "${elementStyle}"`); - } - } - }, - - //NEXT ACTION - Click Delete - { description: 'Click Delete button', action: async () => await driver.findElement(By.css('#modalop')).click() }, - { description: 'Wait for action to complete', action: async () => await driver.sleep(2000) }, - - //Alert banner - { - description: 'Validate alert banner text', - action: async () => { - try { - const element = await driver.findElement(By.css('.alert')); - - //Get different versions of the text for debugging - const fullText = await element.getText(); - - //Check for the expected text in different ways - const expectedText = 'Framework deleted!'; - const trimmedFullText = fullText.trim(); - const firstLine = trimmedFullText.split('\n')[0].trim(); - - //Try multiple matching strategies - if (firstLine.includes(expectedText)) { - console.log(`Passed: "${expectedText}" text found as expected`); - } else if (trimmedFullText.includes(expectedText)) { - console.log(`Passed: "${expectedText}" text found as expected`); - } else { - throw new Error( - `Text validation failed.\nExpected: "${expectedText}"\n` + - `Full text: "${fullText}"\n` + - `First line: "${firstLine}"\n` - ); - } - - } catch (error) { - console.error('Detailed error during validation:', error); - throw error; //Re-throw after logging - } - } - }, - - //Alert banner background color -green - { - description: 'Validate alert banner background text color', - action: async () => { - const elementStyle = await driver.findElement(By.css('.alert')).getCssValue('background-color'); - if (elementStyle === 'rgba(40, 167, 69, 1)') { - console.log('Passed: Alert banner background text color matched as expected'); - } else { - throw new Error(`Alert banner text color did not match; Actual: "${elementStyle}"`); - } - } - }, -*/ //LOG OUT //NEXT ACTION - Log out { description: 'Click Username dropdown', action: async () => await driver.findElement(By.css('#navbarDropdown > span')).click() },