Skip to content

Commit

Permalink
Add stub test files
Browse files Browse the repository at this point in the history
  • Loading branch information
cblanc committed Jun 18, 2020
1 parent a0dc4cd commit b4c63ac
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/billing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
hoistCountry
} from "./extension";

const selectors = {
export const selectors = {
line_1: '[name="street[0]"]',
line_2: '[name="street[1]"]',
line_3: '[name="street[2]"]',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,24 @@ describe("Customer address form", () => {
});
});

// Stick to selector from bindings
// Avoid early optimisation (putting tests in util functions)


describe("setup", () => {
it("hoists country field");
// 1. Country field is lifted before address lines
// 2. Select US - postcode lookup and autocomplete disables
// 3. Select UK - postcode lookup and autocomplete enables
it("loads address validation tools on page");
});

describe("autocomplete", () => {
// Search for address from line 1
it("enables address search on line 1");
it("hides if unsupported country selected");
});

describe("postcode lookup", () => {
// Search for postcode in postcode lookup
it("enables postcode lookup");
it("hides if unsupported country selected");
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/// <reference types="cypress" />

import { Config } from "@ideal-postcodes/jsutil";
import { address as fixtures } from "@ideal-postcodes/api-fixtures";
const address = fixtures.jersey;

declare global {
interface Window {
idpcConfig: Partial<Config>;
}
}

describe("Customer address form", () => {
before(() => {
cy.visit("./fixtures/customer-checkout-billing.html", {
onBeforeLoad: window => {
window.idpcConfig = {
apiKey: Cypress.env("API_KEY"),
populateOrganisation: true,
populateCounty: true,
autocomplete: true,
postcodeLookup: true,
autocompleteOverride: {
checkKey: false
},
postcodeLookupOverride: {
checkKey: false
}
};
},
onLoad: window => {
const document = window.document;
const script = document.createElement("script");
script.setAttribute("type", "text/javascript");
script.setAttribute(
"src",
"http://localhost:60154/test/snapshot/fixtures/binding.js"
);
document.head.appendChild(script);
}
});
});

// Stick to selector from bindings
// Avoid early optimisation (putting tests in util functions)


describe("setup", () => {
// 1. Country field is lifted before address lines
// 2. Select US - postcode lookup and autocomplete disables
// 3. Select UK - postcode lookup and autocomplete enables
it("loads address validation tools on page");
});

describe("autocomplete", () => {
// Search for address from line 1
it("enables address search on line 1");
});

describe("postcode lookup", () => {
// Search for postcode in postcode lookup
it("enables postcode lookup");
});
});

0 comments on commit b4c63ac

Please sign in to comment.