-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* news page test * news page test url * update after comments * update after comments * update after comments * update after comments
- Loading branch information
Showing
5 changed files
with
127 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// @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 = { | ||
testDir: '../tests/dx', | ||
outputDir: '../test-results', | ||
/* Maximum time one test can run for. */ | ||
timeout: 30 * 1000, | ||
expect: { | ||
/** | ||
* Maximum time expect() should wait for the condition to be met. | ||
* For example in `await expect(locator).toHaveText();` | ||
*/ | ||
timeout: 5000, | ||
}, | ||
/* Run tests in files in parallel */ | ||
fullyParallel: true, | ||
/* Fail the build on CI if you accidentally left test.only in the source code. */ | ||
forbidOnly: !!process.env.CI, | ||
/* Retry on CI only */ | ||
retries: process.env.CI ? 2 : 0, | ||
/* Opt out of parallel tests on CI. */ | ||
workers: process.env.CI ? 4 : 3, | ||
/* Reporter to use. */ | ||
reporter: process.env.CI | ||
? [['github'], ['list'], ['../utils/reporters/base-reporter.js']] | ||
: [['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: { | ||
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ | ||
actionTimeout: 60000, | ||
|
||
trace: 'on-first-retry', | ||
baseURL: process.env.BASE_URL || envs['@dx_stage'] || 'https://stage--dx-partners--adobecom.hlx.live', | ||
}, | ||
|
||
/* Configure projects for major browsers */ | ||
projects: [ | ||
{ | ||
name: 'dx-live-chromium', | ||
use: { | ||
...devices['Desktop Chrome'], | ||
baseURL: envs['@dx_stage'], | ||
}, | ||
}, | ||
|
||
{ | ||
name: 'dx-live-firefox', | ||
use: { | ||
...devices['Desktop Firefox'], | ||
baseURL: envs['@dx_stage'], | ||
}, | ||
}, | ||
|
||
{ | ||
name: 'dx-live-webkit', | ||
use: { | ||
...devices['Desktop Safari'], | ||
baseURL: envs['@dx_stage'], | ||
}, | ||
}, | ||
], | ||
}; | ||
module.exports = config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module.exports = { | ||
FeatureName: 'DX News page', | ||
features: [ | ||
{ | ||
tcid: 'MWPW-137796', | ||
name: '@desc-public-app-gravity-card-collection', | ||
path: '/solutionpartners/drafts/automation/regression/partner-news', | ||
tags: '@dx-news @regression', | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
export default class NewsPage { | ||
constructor(page) { | ||
this.page = page; | ||
this.resultNumber = page.locator('.partner-cards-cards-results').nth(0); | ||
this.firstCardTitle = page.locator('.card-title').nth(0); | ||
} | ||
|
||
async clickSearchField() { | ||
await this.searchField.click(); | ||
} | ||
|
||
/** | ||
* @returns get result number | ||
*/ | ||
async getResultNumber() { | ||
const text = await this.resultNumber.textContent(); | ||
return text; | ||
} | ||
|
||
/** | ||
* @returns get first card text | ||
*/ | ||
async getFirstCardTitle() { | ||
const text = await this.firstCardTitle.textContent(); | ||
return text; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
const News = require('../../features/dx/news.spec.js'); | ||
|
||
const { features } = News; | ||
|
||
test.describe('Validate news page for public users', () => { | ||
// Test - MWPW-137796 | ||
test(`${features[0].name},${features[0].tags}`, async ({ page, baseURL }) => { | ||
console.info(`${baseURL}${features[0].path}`); | ||
|
||
// test step-1 | ||
await test.step('Go to News page', async () => { | ||
await page.goto(`${baseURL}${features[0].path}`); | ||
await expect(page).toHaveURL(`${baseURL}${features[0].path}`); | ||
}); | ||
}); | ||
}); |