Skip to content

Commit

Permalink
CC firefly product page UI, search integration with firefly web tests (
Browse files Browse the repository at this point in the history
…#361)

* CC Merchtable block automation

CC Merchtable block automation (JIra: MWPW-140978)

* CC sticky promo bar, promo with close action automated test cases

CC sticky promo bar, promo with close action automated test cases
Jira : MWPW-140982, MWPW-142252

* CC Regression automated cases for media rounded corners, breadcrumb features

CC Regression automated cases for media rounded corners, breadcrumb features (MWPW-140976, MWPW-142543)

* Update roundedcorners-mediablock.test.js

* CC home page tabs, fragment reference , merch pod AU tests

CC home page tabs, fragment reference , merch pod AU tests
Jiras:
https://jira.corp.adobe.com/browse/MWPW-143230
https://jira.corp.adobe.com/browse/MWPW-142599
https://jira.corp.adobe.com/browse/MWPW-143231

* CC , CCT product pages sanity checks automation for EN

Key CC , CCT product pages sanity checks automation for EN
https://jira.corp.adobe.com/browse/MWPW-146289

* CC Tier1 locales production sanity tests

CC Tier1 locales production sanity tests
https://jira.corp.adobe.com/browse/MWPW-146289

* Update productionsanity.spec.js

removed the lengthy URL

* Update productionsanity.page.js

removed the space

* Update productionsanity.test.js

removed tailing spaces from given lines

* CC page Accordion features regression automated cases

CC page Accordion features regression automated cases
https://jira.corp.adobe.com/browse/MWPW-147151
https://jira.corp.adobe.com/browse/MWPW-147152
https://jira.corp.adobe.com/browse/MWPW-147153
https://jira.corp.adobe.com/browse/MWPW-147154

* Update accordion.test.js

corrected the typo

* Update accordion.test.js

fixed indentations issue at line 14,15,16

Also removed wait from line number 81

* CC Firefly integration tests

CC firefly product page UI & integration with FF web

* Update firefly.test.js

removed unwanted wait

* Update firefly.test.js

removed commented line

* Update firefly.test.js

removed wait for load state line

* Update firefly.test.js

typo fixed

---------

Co-authored-by: Aaron Mauchley <[email protected]>
  • Loading branch information
sigadamvenkata and amauch-adobe committed Jun 5, 2024
1 parent bf6dbb9 commit 76dc322
Show file tree
Hide file tree
Showing 3 changed files with 145 additions and 0 deletions.
25 changes: 25 additions & 0 deletions features/cc/firefly.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module.exports = {
name: 'firefly endToend',
features: [
{
tcid: '0',
name: '@firefly-searchIMSLogin',
path: '/products/firefly.html?georouting=off',
term: 'world famous seven wonders animated images',
fireflyURL: 'https://firefly-stage.corp.adobe.com/generate/images?prompt=world%20famous%20wonders',
tags: '@cc @cc-firefly @cc-fireflyIMS-search',
},
{
tcid: '1',
name: '@firefly-searchwithoutIMS',
path: '/products/firefly.html?georouting=off',
tags: '@cc @cc-firefly @cc-fireflyAnonymouse-search',
},
{
tcid: '3',
name: '@firefly-UIDesignschecks',
path: '/products/firefly.html?georouting=off',
tags: '@cc @cc-firefly @cc-firefly-UI',
},
],
};
62 changes: 62 additions & 0 deletions selectors/cc/firefly.page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { expect } from '@playwright/test';

export default class firefly {
constructor(page) {
this.page = page;
// firefly UI elements in page
this.FFInteractiveCards = page.locator('.interactive-container');
this.FFEntisement = page.locator('.enticement-container');
this.promptDefaultText = page.locator('masonry-prompttext');
this.searchPromptBox = page.locator('.masonry-prompttext').nth(1);
this.generateCTA = page.locator('.con-button.blue.masonry-generate.button-xl').nth(1);
// signin page locatores
this.IMSPageLoad = page.locator('form#EmailForm');
this.IMSFireflyCanvas = page.locator('.Canvas.Canvas--background-firefly2023');
this.signInEmailAddress = page.locator('#EmailPage-EmailField');
this.emailIdContinueBtn = page.locator('//button[@data-id="EmailPage-ContinueButton"]');
this.IMSPasswordPage = page.locator('form#PasswordForm');
this.signInPassword = page.locator('#PasswordPage-PasswordField');
this.passwordContinueBtn = page.locator('//button[@data-id="PasswordPage-ContinueButton"]');
this.IMSProfileInPasswordPage = page.locator('.Profile-Picture');
this.FFpageLoad = page.locator('.universal-nav-container');
}

/**
* @param {string} email
* @param {string} password
* @return {Promise} PlayWright promise
*/

async stage_login(email, password) {
expect(process.env.IMS_EMAIL, 'ERROR: No environment variable found for IMS_EMAIL').toBeTruthy();
expect(process.env.IMS_PASS, 'ERROR: No environment variable found for IMS_PASS.').toBeTruthy();
console.log('using IMS stage credentials to login to Firefly custom IMS page');
// Wait for page to load & stabilize:
await this.page.waitForLoadState('networkidle');
// Wait for Firefly IMS page
await this.IMSPageLoad.waitFor({ state: 'visible', timeout: 5000 });
await this.signInEmailAddress.fill(email);
await this.page.keyboard.press('Tab');
await this.emailIdContinueBtn.click();
// Wait for next IMS page to load
await this.page.waitForLoadState('domcontentloaded');
// Enter password and proceed
await this.IMSPasswordPage.waitFor({ state: 'visible', timeout: 10000 });
// await this.signInPassword.waitFor({ state: 'visible', timeout: 5000 });
await this.signInPassword.fill(password);
// Complete the login flow:
await this.passwordContinueBtn.waitFor({ state: 'visible', timeout: 10000 });
await this.passwordContinueBtn.click();
// Check if login process was successful:
await this.FFpageLoad.waitFor({ state: 'visible', timeout: 20000 });
console.info('Login success');
}

// eslint-disable-next-line no-unused-vars
async promtbar_input(searchtext) {
console.log('this function use check give prompt text reside in product page');
// eslint-disable-next-line no-template-curly-in-string
this.promptsearchtext = this.page.locator('//textarea[contains (text(),"#${searchtext}")]');
expect(this.promptsearchtext).toBeTruthy();
}
}
58 changes: 58 additions & 0 deletions tests/cc/firefly.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { expect, test } from '@playwright/test';
import { features } from '../../features/cc/firefly.spec.js';
import FireFly from '../../selectors/cc/firefly.page.js';

let firefly;
test.describe('firefly integration', () => {
test.beforeEach(async ({ page }) => {
firefly = new FireFly(page);
});
test(`${features[0].name},${features[0].tags}`, async ({ page, baseURL }) => {
console.info(`[Test Page]: ${baseURL}${features[0].path}`);
await test.step('Firefly interactive marquee search via IMS login', async () => {
await page.goto(`${baseURL}${features[0].path}`);
await page.waitForLoadState('domcontentloaded');
await expect(page).toHaveURL(`${baseURL}${features[0].path}`);
});
await test.step('search term take use to IMS and post login to FF product page', async () => {
const searchtext = features[0].term;
expect(await firefly.searchPromptBox).toBeTruthy();
expect(await firefly.generateCTA).toBeTruthy();
await firefly.searchPromptBox.fill(features[0].term);
await firefly.generateCTA.click();
await firefly.stage_login(process.env.IMS_EMAIL, process.env.IMS_PASS);
await expect(page).toHaveURL(/.*firefly/);
await firefly.promtbar_input(searchtext);
});
});

test(`${features[1].name},${features[1].tags}`, async ({ page, baseURL }) => {
console.info(`[Test Page]: ${baseURL}${features[1].path}`);
await test.step('click generate without search prompt', async () => {
await page.goto(`${baseURL}${features[1].path}`);
await page.waitForLoadState('domcontentloaded');
await expect(page).toHaveURL(`${baseURL}${features[1].path}`);
});
await test.step('user hits serach CTA with out search prompt', async () => {
expect(await firefly.searchPromptBox).toBeTruthy();
expect(await firefly.generateCTA).toBeTruthy();
await firefly.generateCTA.click();
await expect(page).toHaveURL(/.*firefly/);
});
});

test(`${features[2].name},${features[2].tags}`, async ({ page, baseURL }) => {
console.info(`[Test Page]: ${baseURL}${features[2].path}`);
await test.step('click generate without search prompt', async () => {
await page.goto(`${baseURL}${features[2].path}`);
await page.waitForLoadState('domcontentloaded');
await expect(page).toHaveURL(`${baseURL}${features[2].path}`);
});
await test.step('user hits serach CTA without search prompt', async () => {
expect(await firefly.FFInteractiveCards).toBeTruthy();
expect(await firefly.FFEntisement).toBeTruthy();
expect(await firefly.searchPromptBox).toBeTruthy();
expect(await firefly.promptDefaultText).toBeTruthy();
});
});
});

0 comments on commit 76dc322

Please sign in to comment.