Skip to content

Commit

Permalink
commerce: add OST tests cases for Jenkins (#426)
Browse files Browse the repository at this point in the history
* commerce: add OST tests cases for Jenkins

* fix lint

* fix lint

* refactor const

* fix lint

* remove commented lines

* implement suggestions

* remove extra lines
  • Loading branch information
afmicka authored Aug 28, 2024
1 parent b84f9d1 commit 38bbf21
Show file tree
Hide file tree
Showing 3 changed files with 854 additions and 0 deletions.
128 changes: 128 additions & 0 deletions features/milo/ost.tools.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
module.exports = {
name: 'Offer Selector Tool',
features: [
{
tcid: '0',
name: '@OST-Search-OfferID',
path: '/tools/ost',
data: {
offerID: '0ADF92A6C8514F2800BE9E87DB641D2A',
productName: 'Photoshop',
productNameShort: 'phsp',
planType: 'PUF',
offerType: 'TRIAL',
price: 'US$263.88',
opticalPrice: 'US$21.99',
term: '/yr',
opticalTerm: '/mo',
unit: 'per license',
taxLabel: 'excl. tax',
},
browserParams: '?token=',
tags: '@ost @commerce @regression @nopr',
},
{
tcid: '1',
name: '@OST-Offer-Entitlements',
path: '/tools/ost',
data: {
offerID: '0ADF92A6C8514F2800BE9E87DB641D2A',
planType: 'PUF',
offerType: 'TRIAL',
},
browserParams: '?token=',
tags: '@ost @commerce @regression @nopr',

},
{
tcid: '2',
name: '@OST-Offer-Price',
path: '/tools/ost',
data: {
offerID: '0ADF92A6C8514F2800BE9E87DB641D2A',
price: 'US$263.88',
opticalPrice: 'US$21.99',
term: '/yr',
opticalTerm: '/mo',
unit: 'per license',
taxLabel: 'excl. tax',
},
browserParams: '?token=',
tags: '@ost @commerce @regression @nopr',
},
{
tcid: '3',
name: '@OST-Term',
path: '/tools/ost',
data: {
offerID: '0ADF92A6C8514F2800BE9E87DB641D2A',
term: '/yr',
opticalTerm: '/mo',
},
browserParams: '?token=',
tags: '@ost @commerce @regression @nopr',
},
{
tcid: '4',
name: '@OST-Unit',
path: '/tools/ost',
data: {
offerID: '0ADF92A6C8514F2800BE9E87DB641D2A',
unit: 'per license',
},
browserParams: '?token=',
tags: '@ost @commerce @regression @nopr',
},
{
tcid: '5',
name: '@OST-TaxLabel',
path: '/tools/ost',
data: {
offerID: '0ADF92A6C8514F2800BE9E87DB641D2A',
taxLabel: 'excl. tax',
},
browserParams: '?token=',
tags: '@ost @commerce @regression @nopr',
},
{
tcid: '6',
name: '@OST-TaxInclusivity',
path: '/tools/ost',
data: { offerID: '0ADF92A6C8514F2800BE9E87DB641D2A' },
browserParams: '?token=',
tags: '@ost @commerce @regression @nopr',
},
{
tcid: '7',
name: '@OST-Price-Promo',
path: '/tools/ost',
data: {
offerID: '0ADF92A6C8514F2800BE9E87DB641D2A',
promo: 'testpromo',
},
browserParams: '?token=',
tags: '@ost @commerce @regression @nopr',
},
{
tcid: '8',
name: '@OST-Checkout-Link',
path: '/tools/ost',
data: {
offerID: '0ADF92A6C8514F2800BE9E87DB641D2A',
workflowStep_1: 'email',
workflowStep_2: 'recommendation',
promo: 'testpromo',
},
browserParams: '?token=',
tags: '@ost @commerce @regression @nopr',
},
{
tcid: '9',
name: '@OST-OldPrice',
path: '/tools/ost',
data: { offerID: '0ADF92A6C8514F2800BE9E87DB641D2A' },
browserParams: '?token=',
tags: '@ost @commerce @regression @nopr',
},
],
};
31 changes: 31 additions & 0 deletions selectors/milo/ost.tools.page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
export default class OSTPage {
constructor(page) {
this.page = page;

this.searchField = page.locator('//input[contains(@data-testid,"search")]');
this.productList = page.locator('//span[contains(@class,"productName")]');
this.planType = page.locator(
'//button/span[contains(@class, "spectrum-Dropdown-label") and (.//ancestor::div/span[contains(text(),"plan type")])]',
);
this.offerType = page.locator(
'//button/span[contains(@class, "spectrum-Dropdown-label") and (.//ancestor::div/span[contains(text(),"offer type")])]',
);
this.nextButton = page.locator('//button[contains(@data-testid, "nextButton")]/span');
this.price = page.locator('//div[@data-type="price"]/span');
this.priceOptical = page.locator('//div[contains(@data-type, "priceOptical")]/span');
this.priceStrikethrough = page.locator('//div[contains(@data-type, "priceStrikethrough")]/span');
this.termCheckbox = page.locator('//input[@value="displayRecurrence"]');
this.unitCheckbox = page.locator('//input[@value="displayPerUnit"]');
this.taxlabelCheckbox = page.locator('//input[@value="displayTax"]');
this.taxInlcusivityCheckbox = page.locator('//input[@value="forceTaxExclusive"]');
this.oldPrice = page.locator('//input[@value="displayOldPrice"]');
this.priceUse = page.locator('button:near(h4:text("Price"))').first();
this.priceOpticalUse = page.locator('button:near(:text("Optical price"))').first();
this.priceStrikethroughUse = page.locator('button:near(:text("Strikethrough price"))').first();
this.checkoutTab = page.locator('//div[@data-key="checkout"]');
this.checkoutLink = page.locator('//a[@data-type="checkoutUrl"]');
this.workflowMenu = page.locator('button:near(label:text("Workflow"))').first();
this.promoField = page.locator('//input[contains(@class, "spectrum-Textfield-input")]');
this.cancelPromo = page.locator('button:right-of(span:text("Promotion:"))').first();
}
}
Loading

0 comments on commit 38bbf21

Please sign in to comment.