-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Helpx_Milo Components Script Fixes #235
Changes from 3 commits
6c15306
058af49
6b31244
d5eb7a1
ce9e2d3
e813a1b
323c465
a33eeb4
de560f5
1e722ec
534cfca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
// @ts-check | ||
const { devices } = require('@playwright/test'); | ||
|
||
const envs = require('../envs/envs.js'); | ||
|
||
/** | ||
* @see https://playwright.dev/docs/test-configuration | ||
* @type {import('@playwright/test').PlaywrightTestConfig} | ||
*/ | ||
const config = { | ||
const helpxconfig = { | ||
testDir: '../tests/helpx', | ||
outputDir: '../test-results', | ||
/* Maximum time one test can run for. */ | ||
|
@@ -35,11 +34,11 @@ const config = { | |
workers: process.env.CI ? 2 : undefined, | ||
/* Reporter to use. See https://playwright.dev/docs/test-reporters */ | ||
reporter: process.env.CI | ||
? [['github'], ['list'], ['../utils/reporters/base-reporter.js']] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You need to add base-reporter.js There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @JackySun9 I appreciate your comments. Added Base Reporter along with d5eb7a1. |
||
? [['github'], ['list']] | ||
: [ | ||
['html', { outputFolder: 'test-html-results' }], | ||
['list'], | ||
['./utils/reporters/base-reporter.js'], | ||
|
||
], | ||
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ | ||
use: { | ||
|
@@ -59,6 +58,10 @@ const config = { | |
name: 'helpx-live-chrome', | ||
use: { | ||
...devices['Desktop Chrome'], | ||
channel: 'chrome', | ||
launchOptions: { | ||
args: ['--disable-web-security', '--disable-gpu'], | ||
}, | ||
}, | ||
}, | ||
|
||
|
@@ -77,4 +80,4 @@ const config = { | |
}, | ||
], | ||
}; | ||
export default config; | ||
export default helpxconfig; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kirupacommit : Any reason for changing this from default config?, as other dependent libraries, use default config There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thought of giving project specific config name so used helpxconfig, since other libs are using config i have changed to default config. |
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']); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
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'); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,14 @@ | ||
import { expect, test } from '@playwright/test'; | ||
import { features } from '../../features/helpx/codeBlock.spec.js'; | ||
import { CodeBlock } from '../../selectors/helpx/codeBlock.page.js'; | ||
import CodeBlock from '../../selectors/helpx/codeBlock.page.js'; | ||
import config from '../../configs/helpx.config.js'; | ||
import { WebUtil } from '../../libs/webutil.js'; | ||
|
||
|
||
let codeBlk; | ||
let page; | ||
let codeblocktag = features[0].path; | ||
|
||
|
||
test.beforeAll(async ({ browser }) => { | ||
if (process.env.HLX_TKN !== undefined && process.env.HLX_TKN !== '') { | ||
|
@@ -19,38 +25,48 @@ test.beforeAll(async ({ browser }) => { | |
const context = await browser.newContext(); | ||
// Set the authorization token in the header | ||
await context.setExtraHTTPHeaders({ authorization: `token ${authToken}` }); | ||
const page = await context.newPage(); | ||
page = await context.newPage(); | ||
codeBlk = new CodeBlock(page); | ||
await page.goto(`${baseURL}${features[0].path}`); | ||
|
||
|
||
await page.goto(`${config.use?.baseURL}${codeblocktag}`); | ||
await page.waitForLoadState('networkidle'); | ||
}); | ||
|
||
test.describe('CodeBlock sanity test suite', () => { | ||
// CodeBlock Sanity Checks: | ||
test(`${features[0].name}, ${features[0].tags}`, async ({ | ||
page, | ||
baseURL, | ||
}) => { | ||
console.info(`[Test Page]: ${baseURL}${features[0].path}`); | ||
test(`verify Code Block Page Elements`, async ({baseURL}) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please update the test title as per the Nala test title template. |
||
console.info(`[Test Page]: ${baseURL}${codeblocktag}`); | ||
await test.step('Navigate to CodeBlock page', async () => { | ||
await expect(page).toHaveURL(`${baseURL}${features[0].path}`); | ||
await expect(page).toHaveURL(`${baseURL}${codeblocktag}.html`); | ||
}); | ||
|
||
// Check for different codeBlock formats present | ||
await expect(codeBlk.codeBlockA3).toBeVisible(); | ||
await expect(codeBlk.codeA3).toBeVisible(); | ||
await expect(codeBlk.codeFusion).toBeVisible(); | ||
await expect(codeBlk.codeC).toBeVisible(); | ||
await expect(codeBlk.codeCss).toBeVisible(); | ||
await expect(codeBlk.codeJava).toBeVisible(); | ||
await expect(codeBlk.codeJS).toBeVisible(); | ||
await expect(codeBlk.codePhp).toBeVisible(); | ||
await expect(codeBlk.codeJS).toHaveCount(4); | ||
await expect(codeBlk.codePhp).toHaveCount(5); | ||
await expect(codeBlk.codePlain).toBeVisible(); | ||
await expect(codeBlk.codeSql).toBeVisible(); | ||
await expect(codeBlk.codeXml).toBeVisible(); | ||
await expect(codeBlk.codeSql).toHaveCount(3); | ||
await expect(codeBlk.codeXml).toHaveCount(2); | ||
await expect(codeBlk.codeMxml).toBeVisible(); | ||
|
||
// Check different InLineNumber codeBlock formats present | ||
await expect(codeBlk.codeBlockA3Num).toBeVisible(); | ||
//verify Code block css Properties | ||
expect(await WebUtil.verifyCSS(await codeBlk.codeHideDsktop.first(), codeBlk.cssProperties['codeHideDsktop'])).toBeTruthy(); | ||
expect(await WebUtil.verifyCSS(await codeBlk.codeHideTablet.first(), codeBlk.cssProperties['codeHideTablet'])).toBeTruthy(); | ||
expect(await WebUtil.verifyCSS(await codeBlk.codeHideMobile.first(), codeBlk.cssProperties['codeHideMobile'])).toBeTruthy(); | ||
|
||
//Verify code Block Attribute Properties | ||
expect(await WebUtil.verifyAttributes(await codeBlk.codeHideDsktop.first(), codeBlk.attProperties['codeHideDsktop'])).toBeTruthy(); | ||
expect(await WebUtil.verifyAttributes(await codeBlk.codeHideTablet.first(), codeBlk.attProperties['codeHideTablet'])).toBeTruthy(); | ||
expect(await WebUtil.verifyAttributes(await codeBlk.codeHideMobile.first(), codeBlk.attProperties['codeHideMobile'])).toBeTruthy(); | ||
|
||
|
||
//Check different InLineNumber codeBlock formats present | ||
await expect(codeBlk.codeA3Num).toBeVisible(); | ||
await expect(codeBlk.codeFusionNum).toBeVisible(); | ||
await expect(codeBlk.codeCNum).toBeVisible(); | ||
await expect(codeBlk.codeCssNum).toBeVisible(); | ||
|
@@ -61,43 +77,5 @@ test.describe('CodeBlock sanity test suite', () => { | |
await expect(codeBlk.codeSqlNum).toBeVisible(); | ||
await expect(codeBlk.codeXmlNum).toBeVisible(); | ||
await expect(codeBlk.codeMxmlNum).toBeVisible(); | ||
|
||
expect( | ||
await WebUtil.verifyCSS( | ||
await this.codeHideDsktop, | ||
this.cssProperties['codeHideDsktop'] | ||
) | ||
).toBeTruthy(); | ||
expect( | ||
await WebUtil.verifyCSS( | ||
await this.codeHideTablet, | ||
this.cssProperties['codeHideTablet'] | ||
) | ||
).toBeTruthy(); | ||
expect( | ||
await WebUtil.verifyCSS( | ||
await this.codeHideMobile, | ||
this.cssProperties['codeHideMobile'] | ||
) | ||
).toBeTruthy(); | ||
|
||
expect( | ||
await WebUtil.verifyAttributes( | ||
await this.codeHideDsktop, | ||
this.attProperties['codeHideDsktop'] | ||
) | ||
).toBeTruthy(); | ||
expect( | ||
await WebUtil.verifyAttributes( | ||
await this.codeHideTablet, | ||
this.attProperties['codeHideTablet'] | ||
) | ||
).toBeTruthy(); | ||
expect( | ||
await WebUtil.verifyAttributes( | ||
await this.codeHideMobile, | ||
this.attProperties['codeHideMobile'] | ||
) | ||
).toBeTruthy(); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kirupacommit :
Any reason not using
base-reporter.js
, we need this for dailyrun report metricsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now i have added Base reporter to the helpx Project