-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add flow builder templates page object
- Loading branch information
Showing
8 changed files
with
95 additions
and
9 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
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
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,28 @@ | ||
import type { Page, Locator } from '@playwright/test'; | ||
import type { PageObject } from '../../types/PageObject'; | ||
import { FlowBuilderListing } from './FlowBuilderListing'; | ||
|
||
export class FlowBuilderTemplates extends FlowBuilderListing implements PageObject { | ||
|
||
public readonly searchBar: Locator; | ||
|
||
constructor(public readonly page: Page) { | ||
super(page); | ||
this.searchBar = page.locator('.sw-search-bar').getByPlaceholder('Search flows...'); | ||
} | ||
url() { | ||
return `#/sw/flow/index/templates`; | ||
} | ||
|
||
async getLineItemByFlowName(flowName: string): Promise<Record<string, Locator>> { | ||
const lineItem = this.page.locator('.sw-data-grid__row').filter({ hasText: flowName }); | ||
const createFlowLink = lineItem.getByRole('link').getByTestId('sw-icon__regular-long-arrow-right'); | ||
const templateDetailLink = lineItem.getByRole('link').getByText(flowName); | ||
|
||
return { | ||
createFlowLink: createFlowLink, | ||
lineItem: lineItem, | ||
templateDetailLink: templateDetailLink, | ||
} | ||
} | ||
} |
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,28 @@ | ||
import { Locator, test as base } from '@playwright/test'; | ||
Check warning on line 1 in src/tasks/shop-admin/Flow/AssertFlowStructure.ts GitHub Actions / eslint
|
||
import type { Task } from '../../../types/Task'; | ||
import type { FixtureTypes } from '../../../types/FixtureTypes'; | ||
|
||
|
||
export const AssertFlowStructure = base.extend<{ AssertFlowStructure: Task }, FixtureTypes>({ | ||
AssertFlowStructure: async ({ AdminFlowBuilderDetail, ShopAdmin }, use ) => { | ||
const task = () => { | ||
return async function AssertFlowStructure() { | ||
|
||
await ShopAdmin.expects(AdminFlowBuilderDetail.triggerSelectField).toBeVisible(); | ||
await AdminFlowBuilderDetail.triggerSelectField.hover(); | ||
const tooltip = await AdminFlowBuilderDetail.page.waitForSelector('.sw-tooltip'); | ||
const tooltipText = await tooltip.innerText(); // Get text from the tooltip | ||
await ShopAdmin.expects(tooltipText).toEqual('Checkout / Order / Placed'); | ||
await ShopAdmin.expects(AdminFlowBuilderDetail.page.locator('.sw-flow-sequence-action__content').locator('.sw-single-select__selection')).toBeVisible(); | ||
// asserts there are no other containers | ||
await ShopAdmin.expects(AdminFlowBuilderDetail.page.locator('.sw-flow-sequence-condition__container')).not.toBeVisible(); | ||
await ShopAdmin.expects(AdminFlowBuilderDetail.page.locator('.sw-flow-delay-action__delay_card')).not.toBeVisible(); | ||
// asserts email action (only partially available during test) | ||
await ShopAdmin.expects(AdminFlowBuilderDetail.page.locator('.sw-flow-sequence-action__content').locator('.sw-single-select__selection')).toBeVisible(); | ||
await ShopAdmin.expects(AdminFlowBuilderDetail.page.locator('.sw-flow-sequence-action__content').getByRole('button').first()).toContainText('Template: Order confirmation'); | ||
|
||
} | ||
} | ||
await use(task); | ||
}, | ||
}); |
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