Skip to content

Commit

Permalink
Helpx_Milo Components Script Fixes (#235)
Browse files Browse the repository at this point in the history
* Helpx_Milo Components Script Fixes

* removed Base reporter from helpx

* Added Base reporter to the helpx Config File

* Added daily Run yml file and additional test cases on draft page

* Draftpgae_MinorChanges on spec.js and test.js file

* Helpx_Test cases Name changes and Added more test cases for Procedure component

* Helpx Config variable changed to config

* procedure_test case name changes

---------

Co-authored-by: Kirupaagar R M <[email protected]>
  • Loading branch information
kirupacommit and Kirupaagar R M authored Jan 8, 2024
1 parent be63bf9 commit 7945139
Show file tree
Hide file tree
Showing 12 changed files with 586 additions and 175 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/helpx.daily.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Helpx Nala Daily Run

on:
schedule:
- cron: "30 15 * * *"
workflow_dispatch:

jobs:
platform_matrix:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
name: Running tests
runs-on: ${{ matrix.os }}
env:
WORKFLOW_NAME: 'Helpx Nala Daily Run'
DAILY_RUN: 'true'

steps:
- name: Check out repository
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: lts/*

- name: Run Nala ${{ matrix.os }}
run: bash dailyrun.sh helpx
env:
IMS_EMAIL: ${{ secrets.IMS_EMAIL }}
IMS_PASS: ${{ secrets.IMS_PASS }}
HLX_TKN: ${{ secrets.HLX_TKN }}
SLACK_WH: ${{ secrets.SLACK_WH }}

- name: Display workflow name
run: echo "The workflow name is $WORKFLOW_NAME"

- name: Persist JSON Artifact
uses: actions/upload-artifact@v3
if: always()
with:
name: nala-results
path: nala-results.json
retention-days: 30
7 changes: 5 additions & 2 deletions configs/helpx.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// @ts-check
const { devices } = require('@playwright/test');

const envs = require('../envs/envs.js');

/**
Expand Down Expand Up @@ -39,7 +38,7 @@ const config = {
: [
['html', { outputFolder: 'test-html-results' }],
['list'],
['./utils/reporters/base-reporter.js'],
['../utils/reporters/base-reporter.js']
],
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
Expand All @@ -59,6 +58,10 @@ const config = {
name: 'helpx-live-chrome',
use: {
...devices['Desktop Chrome'],
channel: 'chrome',
launchOptions: {
args: ['--disable-web-security', '--disable-gpu'],
},
},
},

Expand Down
20 changes: 19 additions & 1 deletion features/helpx/draft.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,26 @@ module.exports = {
{
tcid: '0',
name: '@draft',
path: '/automation/blocks/Drafts/draft-test',
path: '/automation/blocks/Draft/draft-test.html',
tags: '@draft @regression @helpx',
},
{
tcid: '1',
name: '@draftforBeforeAfter',
path: '/automation/blocks/Draft/draft-before-after.html',
tags: '@draft @regression @helpx',
},
{
tcid: '2',
name: '@draftforCodeBlock',
path: '/automation/blocks/Draft/draft-code-block.html',
tags: '@draft @regression @helpx',
},
{
tcid: '3',
name: '@draftforGeneric',
path: '/automation/blocks/Draft/draft-generic.html',
tags: '@draft @regression @helpx',
}
],
};
72 changes: 72 additions & 0 deletions features/helpx/procedure.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,78 @@ module.exports = {
path: '/automation/blocks/procedure',
tags: '@procedure @regression @helpx',
},
{
tcid: '1',
name: '@procedureComponentTitleValidation',
path: '/automation/blocks/procedure/procedure-step-component',
tags: '@procedure @regression @helpx',
},
{
tcid: '2',
name: '@procedureComponentCaseSensitive',
path: '/automation/blocks/procedure/procedure-step-component',
tags: '@procedure @regression @helpx',
},
{
tcid: '3',
name: '@procedureComponentWrongProcedureClassName',
path: '/automation/blocks/procedure/procedure-step-component',
tags: '@procedure @regression @helpx',
},
{
tcid: '4',
name: '@procedureComponentDraftFunctionality',
path: '/automation/blocks/procedure/procedure-step-component',
tags: '@procedure @regression @helpx',
},
{
tcid: '5',
name: '@procedureComponentTextProperties',
path: '/automation/blocks/procedure/procedure-step-component',
tags: '@procedure @regression @helpx',
},
{
tcid: '6',
name: '@procedureComponentVideo',
path: '/automation/blocks/procedure/procedure-step-component',
tags: '@procedure @regression @helpx',
},
{
tcid: '1',
name: '@procedureAndStepValidation',
path: '/automation/blocks/procedure/procedure-step-component',
tags: '@procedure @regression @helpx',
},
{
tcid: '7',
name: '@procedureComponentFileDownload',
path: '/automation/blocks/procedure/procedure-step-component',
tags: '@procedure @regression @helpx',
},
{
tcid: '8',
name: '@procedureComponentBeforeAfter',
path: '/automation/blocks/procedure/procedure-step-component',
tags: '@procedure @regression @helpx',
},
{
tcid: '9',
name: '@procedureComponentCodeBlock',
path: '/automation/blocks/procedure/procedure-step-component',
tags: '@procedure @regression @helpx',
},
{
tcid: '10',
name: '@procedureComponentAllComponents',
path: '/automation/blocks/procedure/procedure-step-component',
tags: '@procedure @regression @helpx',
},
{
tcid: '11',
name: '@procedureComponentImageComponent',
path: '/automation/blocks/procedure/procedure-step-component',
tags: '@procedure @regression @helpx',
}
],
};

11 changes: 3 additions & 8 deletions selectors/helpx/beforeafter.page.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
import { expect } from '@playwright/test';
import { WebUtil } from '../../libs/webutil.js';

export default class BeforeAfter {
constructor(page) {
this.page = page;

// BeforeAfter Selectors:
this.beforeAftr = page.locator('.beforeafter');
this.beforeafterVertical = page.locator(selectors['@beforeafter-vertical']);
this.beforeafterVerticalmoved = page.locator(
selectors['@beforeafter-vertical-moved']
);
this.beforeAftr = page.locator("(//div[@class='before-after-slider vertical'])[1]");
this.beforeafterVertical = page.locator(['@beforeafter-vertical']);
this.beforeafterVerticalmoved = page.locator(['@beforeafter-vertical-moved']);
}
}
7 changes: 3 additions & 4 deletions selectors/helpx/codeBlock.page.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import { expect } from '@playwright/test';
import { WebUtil } from '../../libs/webutil.js';

export default class CodeBlock {
constructor(page) {
this.page = page;

// CodeBlock Selectors:
this.codeA3 = page.locator('div.language-as3');
this.codeA3 = page.locator("//div[@class='code language-as3']");
this.codeFusion = page.locator('div.language-coldfusion');
this.codeC = page.locator('div.language-c');
this.codeCss = page.locator('div.language-css');
Expand All @@ -17,6 +14,7 @@ export default class CodeBlock {
this.codeSql = page.locator('div.language-sql');
this.codeXml = page.locator('div.language-xml');
this.codeMxml = page.locator('div.language-mxml');
//language Selectors
this.codeA3Num = page.locator('.language-as3.line-numbers');
this.codeFusionNum = page.locator('.language-coldfusion.line-numbers');
this.codeCNum = page.locator('.language-c.line-numbers');
Expand All @@ -28,6 +26,7 @@ export default class CodeBlock {
this.codeSqlNum = page.locator('.language-sql.line-numbers');
this.codeXmlNum = page.locator('.language-xml.line-numbers');
this.codeMxmlNum = page.locator('.language-mxml.line-numbers');
//Hidden Value Selectors
this.codeHideDsktop = page.locator('.hidden-desktop');
this.codeHideTablet = page.locator('.hidden-tablet');
this.codeHideMobile = page.locator('.hidden-mobile');
Expand Down
30 changes: 27 additions & 3 deletions selectors/helpx/draft.page.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import { expect } from '@playwright/test';
import { WebUtil } from '../../libs/webutil.js';

export default class Draft {
constructor(page) {
this.page = page;
Expand Down Expand Up @@ -34,5 +31,32 @@ export default class Draft {
'codeBlock': { 'class': 'code language-as3 line-numbers draft' },
'generic': { 'class': 'generic draft class1 class2' },
};

//draftPage for before after
this.codeAs3LineNumbersDraft = page.locator("//div[@class='code language-as3 line-numbers draft']");
this.beforeAfterSlider = page.locator("//div[@class='before-after-slider draft']").first();
this.horizontalBeforeAfterSlider = page.locator("//div[@class='before-after-slider horizontal draft']");
this.beforeAfterSliderDraft = page.locator("//div[@class='before-after-slider draft'][2]");
this.beforeAfterSliderDraftHorizontal = page.locator("//div[@class='before-after-slider draft horizontal']");
this.as3CodeSnippet = page.locator("//div[@class='code language-as3 line-numbers draft']");

//draft page for codeblock
this.codeColdFusionDraft = page.locator("//div[@class='code language-coldfusion draft']");
this.codeCPlusPlusDraft = page.locator("//div[@class='code language-c draft']");
this.codeCSSLineNumbersDraft = page.locator("//div[@class='code language-css draft line-number']");
this.codeJavaLineNumbersDraft = page.locator("//div[@class='code draft language-java line-numbers']");
this.codeJavaScriptDraft = page.locator("//div[@class='code language-javascript draft']");
this.codePHPDraft = page.locator("//div[@class='code draft language-php']");
this.codeSQLDraft = page.locator("//div[@class='code language-sql darft']");
this.codeXMLDraft = page.locator("//div[@class='code language-xml draft']");
this.codeShellDraft = page.locator("//div[@class='code draft language-shell']");
this.codePlainDraft = page.locator("//div[@class='code language-plain draft']");

//Draft Page for Generic
this.genericComponentsDraft = page.locator("//h1[@id='generic-components-draft']");
this.genericImageDraft1 = page.locator("//div[@class='generic draft'][1]");
this.genericImageDraft2 = page.locator("//div[@class='generic draft'][2]");
this.genericTextDraft = page.locator("//div[@class='generic draft'][3]");

}
};
83 changes: 78 additions & 5 deletions selectors/helpx/procedure.page.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,87 @@
import { expect } from '@playwright/test';
import { WebUtil } from '../../libs/webutil.js';

export default class Procedure {
constructor(page) {
this.page = page;

// Procedure Selectors:
this.procedure = page.locator('.procedure');
this.procedureStep = page.locator('li[class=step]');
this.procedureImage = page.locator('hli[class=step] img');
this.procedureStep = page.locator("//li[contains(@class,'step')]");
this.procedureImage = page.locator("//li[@class='step']//descendant::picture/img");
this.procedureTxtBold = page.locator('li[class=step] strong');

//Procedure and Step Component
//Title
this.procedureTitle = page.locator("//h1[@id='procedure-and-step-component']");
//First procedure Component
this.procedureforb2 = page.locator("//div[contains(@daa-lh,'b2|procedure|nopzn|nopzn')]");
this.procedureforb2Ol = page.locator("//div[@daa-lh='b2|procedure|nopzn|nopzn']/child::ol");
this.procedureforb2liFirst = page.locator("//div[@daa-lh='b2|procedure|nopzn|nopzn']/child::ol/li[contains(@class,'step')][1]");


//procedure is not case sensitive
const xpathWithDaaLh = "//div[contains(@daa-lh, 'b4|procedure|nopzn|nopzn')]/ol[@class='stepList']/li[@class='step']/div[contains(text(), 'PROCEDURE-Capital letter')]";
this.procedurecapitalLetter = page.locator(xpathWithDaaLh).first();
const xpathForSecondElement = "//div[contains(@daa-lh, 'b5|procedure|nopzn|nopzn')]/ol[@class='stepList']/li[@class='step']/div[contains(.,'PROCEDURE- Capital Letter - Bold -Italic')]";
this.secondProcedureElement = page.locator(xpathForSecondElement).first();

const xpathForThirdElement = "//div[contains(@daa-lh, 'b6|procedure|nopzn|nopzn')]/ol[@class='stepList']/li[@class='step']//div[contains(.,'PROCEDURE-Capital Letter - Bold -Italic-Underline')]";
this.thirdProcedureElement = page.locator(xpathForThirdElement).first();

//Incorrect Procedure Name
const xpathForFailedProcedure = "//div[contains(@class,'proedure')][contains(@data-failed,'true')][contains(@data-reason,'Failed loading proedure block.')]";
this.failedProcedureElement = page.locator(xpathForFailedProcedure).first();

//verify Draft Procedure
const procedureDraft = "//li[contains(.,'Procedure Component with Draft Option')]/following-sibling::li[1][contains(.,'In Procedure Component, adding Text in the Step')]";
this.draftProcedure = page.locator(procedureDraft).first();

//Text in procedure
this.textInProcedureComponent = page.locator("//div[contains(@daa-lh,'b11|procedure|nopzn|nopzn')]/ol/li[1]/div/p[contains(.,'Some copy-paste features that you can try out with this latest updated workflow are given here.')]");
this.StrongtextInProcedureComponent = page.locator("//div[contains(@daa-lh,'b11|procedure|nopzn|nopzn')]/ol/li[2]/div/strong[contains(text(),'Continue')]");
this.thirdStepLink = page.locator("//div[contains(@daa-lh,'b11|procedure|nopzn|nopzn')]/ol/li[3]/div/strong/a[contains(@href,'https://account.adobe.com/plans')]");
this.iconinprocedureComponet = page.locator("//div[contains(@daa-lh,'b11|procedure|nopzn|nopzn')]/ol/li[6]/div/ol/li/span[contains(@class,'icon icon-objectives margin-left margin-right')]");
this.notealertinprocedure = page.locator("//div[contains(@daa-lh,'b11|procedure|nopzn|nopzn')]/ol/li[6]/child::div/child::div[contains(@class,'note alert')]");
this.noteiconinprocedure = page.locator("//div[contains(@daa-lh,'b11|procedure|nopzn|nopzn')]/ol/li[6]/child::div/child::div[contains(@class,'note alert')]/span[contains(@class,'note-icon')]");
this.notecautionInprocedure = page.locator("//div[contains(@daa-lh,'b11|procedure|nopzn|nopzn')]/ol/li[8]/div/div[contains(@class,'note caution')]");
this.notetipinProcedure = page.locator("//div[contains(@daa-lh,'b11|procedure|nopzn|nopzn')]/ol/li[8]/div/div[contains(@class,'note tip')]");

//Images in procedure
this.webpImageinProcedure = page.locator("//div[@class='procedure']/ol[@class='stepList']/li[@class='step'][1]//img[@title='attach_email_mfa']");
this.pngImageInprocedure = page.locator("(//img[@loading='lazy'])[1]");
const xpathLocator = "//div[contains(@daa-lh,'b13|procedure|nopzn|nopzn')]/ol/li[3]/div/p/em[contains(text(),'Great. I will process this for you now')]";
this.textBeforeImageInProcedure = page.locator(xpathLocator);
this.imageafterTextInProcedure = page.locator(`${xpathLocator}/following::p[1]`);
this.urlBasedURLInProcedure = page.locator("//div[contains(@daa-lh,'b13|procedure|nopzn|nopzn')]/ol/li[4]/descendant::a[contains(@href,'/automation/blocks/procedure/')]");


//Videos In Procedure
this.videoinprocedure = page.locator("//div[@class='procedure']//li[@class='step'][1]//video[@controls]");
this.youtubevideoinprocedure = page.locator("//div[@class='procedure']//li[@class='step'][2]//iframe[contains(@src, 'youtube.com')]");

//Download Component
this.pdfforprocedure = page.locator("//div[@class='procedure']//li[@class='step'][1]//div[@class='download']//a[@class='download-button' and contains(@href, 'SKU%20search%20in%20Hendrix.pdf')]");
this.xlsxforprocedure = page.locator("//div[@class='procedure']//li[@class='step'][2]//div[@class='download']//a[@class='download-button' and contains(@href, 'All%20Products_080213.xls')]");
this.pptforprocedure = page.locator("//div[@class='procedure']//li[@class='step'][3]//div[@class='download']//a[@class='download-button' and contains(@href, 'cct_save_tagging-hendrix.pptx')]");

//BeforeAfter component
this.beforeafterfirst = page.locator("//input[@orient='vertical']");
this.beforeaftersecond = page.locator("//div[@class='procedure']//li[@class='step'][2]//div[@class='before-after-slider hidden-tablet']");
this.beforeafterthird = page.locator("//div[@class='procedure']//li[@class='step'][3]//div[@class='before-after-slider draft hidden-desktop hidden-mobile']");

//code block component
this.as3Inprocedure = page.locator("//div[@class='procedure']//li[@class='step'][1]//div[@class='code language-as3']").first();
this.cplusplusInprocedure = page.locator("//div[@class='procedure']//li[@class='step'][2]//div[@class='code language-c++ line-numbers']").first();
this.sqlInprocedure = page.locator("//div[@class='procedure']//li[@class='step'][3]//div[@class='code language-sql draft']").first();

//All components
this.codeBlock = page.locator("//div[@class='procedure']//li[@class='step'][1]//div[@class='code language-as3']").first();
this.imageWithinProcedure = page.locator("//div[@class='procedure']//li[@class='step'][2]//h1[@id='image-within-procedure']/following-sibling::p/picture");
this.ambientVideo = page.locator("//div[@class='procedure']//li[@class='step'][3]//p[contains(text(),'Ambient video')]").first();
this.downloadSection = page.locator("//div[@class='procedure']//li[@class='step'][4]//div[@class='download']");
this.miloVideo = page.locator("//div[@class='procedure']//li[@class='step'][5]//div[@class='milo-video']/iframe");
this.beforeAfterSlider = page.locator("//div[@class='procedure']//li[@class='step'][6]//div[@class='before-after-slider hidden-mobile']");
this.listWithLinks = page.locator("//div[@class='procedure']//li[@class='step'][7]//ul");
this.noteUpdate = page.locator("//div[@class='procedure']//li[@class='step'][8]//div[@class='note alert']");
this.noteAddReason = page.locator("//div[@class='procedure']//li[@class='step'][9]//div[@class='note caution']");

}
}
Loading

0 comments on commit 7945139

Please sign in to comment.