diff --git a/e2e/config/mappings/page-elements/home.json b/e2e/config/mappings/page-elements/home.json index b05b8edba..d366699e1 100644 --- a/e2e/config/mappings/page-elements/home.json +++ b/e2e/config/mappings/page-elements/home.json @@ -6,5 +6,39 @@ "Open existing project": { "role": "button", "name": "Open existing project" }, "Open an example": { "role": "button", "name": "Open an example" }, "Login with github": { "role": "heading", "name": "Login with github" }, - "Escrow Javascript": { "role": "button", "name": "Escrow Javascript" } -} \ No newline at end of file + "Escrow header": { "role": "heading", "name": "Escrow" }, + "Escrow Haskell": { "role": "button", "name": "Escrow Haskell" }, + "Escrow Javascript": { "role": "button", "name": "Escrow Javascript" }, + "Escrow Marlowe": { "role": "button", "name": "Escrow Marlowe" }, + "Escrow Blockly": { "role": "button", "name": "Escrow Blockly" }, + "Escrow with Collateral header": { "role": "heading", "name": "Escrow With Collateral" }, + "Escrow with Collateral Haskell": { "role": "button", "name": "Escrow With Collateral Haskell" }, + "Escrow with Collateral Javascript": { "role": "button", "name": "Escrow With Collateral Javascript" }, + "Escrow with Collateral Marlowe": { "role": "button", "name": "Escrow With Collateral Marlowe" }, + "Escrow with Collateral Blockly": { "role": "button", "name": "Escrow With Collateral Blockly" }, + "Zero Coupon Bond header": { "role": "heading", "name": "Zero Coupon Bond" }, + "Zero Coupon Bond Haskell": { "role": "button", "name": "Zero Coupon Bond Haskell" }, + "Zero Coupon Bond Javascript": { "role": "button", "name": "Zero Coupon Bond Javascript" }, + "Zero Coupon Bond Marlowe": { "role": "button", "name": "Zero Coupon Bond Marlowe" }, + "Zero Coupon Bond Blockly": { "role": "button", "name": "Zero Coupon Bond Blockly" }, + "Coupon Bond Guaranteed header": { "role": "heading", "name": "Coupon Bond Guaranteed" }, + "Coupon Bond Guaranteed Haskell": { "role": "button", "name": "Coupon Bond Guaranteed Haskell" }, + "Coupon Bond Guaranteed Javascript": { "role": "button", "name": "Coupon Bond Guaranteed Javascript" }, + "Coupon Bond Guaranteed Marlowe": { "role": "button", "name": "Coupon Bond Guaranteed Marlowe" }, + "Coupon Bond Guaranteed Blockly": { "role": "button", "name": "Coupon Bond Guaranteed Blockly" }, + "Swap header": { "role": "heading", "name": "Swap" }, + "Swap Haskell": { "role": "button", "name": "Swap Haskell" }, + "Swap Javascript": { "role": "button", "name": "Swap Javascript" }, + "Swap Marlowe": { "role": "button", "name": "Swap Marlowe" }, + "Swap Blockly": { "role": "button", "name": "Swap Blockly" }, + "Contract For Differences header": { "role": "heading", "name": "Contract For Differences" }, + "Contract For Differences Haskell": { "role": "button", "name": "Contract For Differences Haskell" }, + "Contract For Differences Javascript": { "role": "button", "name": "Contract For Differences Javascript" }, + "Contract For Differences Marlowe": { "role": "button", "name": "Contract For Differences Marlowe" }, + "Contract For Differences Blockly": { "role": "button", "name": "Contract For Differences Blockly" }, + "Contract For Differences with Oracle header": { "role": "heading", "name": "Contract For Differences with Oracle" }, + "Contract For Differences with Oracle Haskell": { "role": "button", "name": "Contract For Differences with Oracle Haskell" }, + "Contract For Differences with Oracle Javascript": { "role": "button", "name": "Contract For Differences with Oracle Javascript" }, + "Contract For Differences with Oracle Marlowe": { "role": "button", "name": "Contract For Differences with Oracle Marlowe" }, + "Contract For Differences with Oracle Blockly": { "role": "button", "name": "Contract For Differences with Oracle Blockly" } +} diff --git a/e2e/src/env/global.ts b/e2e/src/env/global.ts index 23cc4a874..d387689c3 100644 --- a/e2e/src/env/global.ts +++ b/e2e/src/env/global.ts @@ -1,6 +1,7 @@ export type PageId = string; export type PagesConfig = Record>; export type HostsConfig = Record; +export type ValidAccessibilityRoles = "link" | "button" | "heading"; export type ElementKey = string; export type ElementLocator = Record; export type PageElementMappings = Record>; diff --git a/e2e/src/features/home-page.feature b/e2e/src/features/home-page.feature index dcaef8b26..8ab673e21 100644 --- a/e2e/src/features/home-page.feature +++ b/e2e/src/features/home-page.feature @@ -3,7 +3,6 @@ Feature: As a user I should be able to see the Marlowe Playground home page As a user I should be able to navigate to the marlowe playground home page and see all the starting point options available - @dev @smoke @regression Scenario: As a user I expect to be able to see the available languages @@ -18,4 +17,24 @@ Feature: As a user I should be able to see the Marlowe Playground home page And I should see a button with "Open an example" text When I click the "Open existing project" button - Then I should see "Login with github" text \ No newline at end of file + Then I should see "Login with github" text + + @dev + Scenario Outline: As a user, I would like to see a list of example contracts by language + Given I am on the "home" page + When I click the "Open an example" button + Then I should see " header" text + And I should see " Haskell" text + And I should see " Javascript" text + And I should see " Marlowe" text + And I should see " Blockly" text + + Examples: + | Contract Name | + | Escrow | + | Escrow with Collateral | + | Zero Coupon Bond | + | Coupon Bond Guaranteed | + | Swap | + | Contract For Differences | + | Contract For Differences with Oracle | diff --git a/e2e/src/step-definitions/assertions/verify-element-value.ts b/e2e/src/step-definitions/assertions/verify-element-value.ts index dedfcd54d..c7777ba09 100644 --- a/e2e/src/step-definitions/assertions/verify-element-value.ts +++ b/e2e/src/step-definitions/assertions/verify-element-value.ts @@ -55,8 +55,8 @@ Then( globalConfig } = this; const document = await getDocument(page); - const elementIdentifier = getElementLocator(page, "playground editor", globalConfig); - const { role, name } = elementIdentifier; + // const elementIdentifier = getElementLocator(page, "playground editor", globalConfig); + // const { role, name } = elementIdentifier; const fixture = getFixtureText(contractFixtureKey, globalConfig); await waitFor(async() => { diff --git a/e2e/src/step-definitions/assertions/verify-elements-visibility.ts b/e2e/src/step-definitions/assertions/verify-elements-visibility.ts index 5602bdc92..614e8db05 100644 --- a/e2e/src/step-definitions/assertions/verify-elements-visibility.ts +++ b/e2e/src/step-definitions/assertions/verify-elements-visibility.ts @@ -1,15 +1,16 @@ import { Then } from '@cucumber/cucumber'; -import { ElementKey } from '../../env/global'; +import { ElementKey, ValidAccessibilityRoles } from '../../env/global'; import { getElementLocator } from '../../support/web-element-helper'; import { ScenarioWorld } from '../setup/world' import { waitFor } from '../../support/wait-for-behavior'; + Then( /^I should see "([^"]*)" text$/, async function(this: ScenarioWorld, elementKey: ElementKey) { const { - screen: { page, document }, + screen: { page }, globalConfig } = this; @@ -17,7 +18,10 @@ Then( const { role, name } = elementIdentifier; await waitFor(async() => { - const locator = await page.getByRole(role as "link" | "button" | "heading", { name }); + const locator = await page.getByRole( + role as ValidAccessibilityRoles, + { name, exact: true } + ); const isElementVisible = await locator.isVisible() return isElementVisible; })