Skip to content

Commit

Permalink
Skips electron in e2e display tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dbrudner committed Aug 7, 2020
1 parent 52aca59 commit cee6299
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 66 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
134 changes: 68 additions & 66 deletions test/e2e/display.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,93 +17,95 @@ const sel = {
cvv: 'input[placeholder="CVV"]'
};

describe('Display', function () {
describe('when configured with elements', async function () {
beforeEach(init());

describe('CardElement', async function () {
it('matches CardElement baseline', async function () {
await createElement(ELEMENT_TYPES.CardElement, { style: { fontFamily: 'Pacifico' }});
await enterCardValues();
await clickBody();

const diff = await browser.checkFullPageScreen('elements/card-element-pacifico');
assert.strictEqual(diff, 0);
});
});
if (BROWSER !== 'Electron') {
describe('Display', function () {
describe('when configured with elements', async function () {
beforeEach(init());

describe('CardElement', async function () {
it('matches CardElement baseline', async function () {
await createElement(ELEMENT_TYPES.CardElement, { style: { fontFamily: 'Pacifico' }});
await enterCardValues();
await clickBody();

describe('distinct elements', async function () {
it('matches distinct elements baseline', async function () {
const { CardElement, ...distinctElements } = ELEMENT_TYPES;
for (const element in distinctElements) {
await createElement(element, { style: { fontFamily: 'Pacifico' }});
}
await enterDistinctFieldValues();
await clickBody();

const diff = await browser.checkFullPageScreen('elements/distinct-elements-pacifico');
assert.strictEqual(diff, 0);
const diff = await browser.checkFullPageScreen('elements/card-element-pacifico');
assert.strictEqual(diff, 0);
});
});
});
});

describe('when configured with fields', async function () {
const config = { fields: { all: { style: { fontFamily: "Pacifico" } } } };

describe('CardElement', async function () {
beforeEach(init({ fixture: 'hosted-fields-card', opts: config }));

it('matches CardElement baseline', async function () {
await enterCardValues();
await browser.switchToFrame(null);
await clickBody();
describe('distinct elements', async function () {
it('matches distinct elements baseline', async function () {
const { CardElement, ...distinctElements } = ELEMENT_TYPES;
for (const element in distinctElements) {
await createElement(element, { style: { fontFamily: 'Pacifico' }});
}
await enterDistinctFieldValues();
await clickBody();

const diff = await browser.checkFullPageScreen('hosted-fields/card-element-pacifico');
assert.strictEqual(diff, 0);
const diff = await browser.checkFullPageScreen('elements/distinct-elements-pacifico');
assert.strictEqual(diff, 0);
});
});
});

if (BROWSER !== 'BrowserStackEdge') {
describe("distinct elements", async function () {
beforeEach(init({ fixture: 'hosted-fields-card-distinct', opts: config }));
describe('when configured with fields', async function () {
const config = { fields: { all: { style: { fontFamily: "Pacifico" } } } };

it('matches distinct elements baseline', async function () {
await enterDistinctFieldValues();
describe('CardElement', async function () {
beforeEach(init({ fixture: 'hosted-fields-card', opts: config }));

it('matches CardElement baseline', async function () {
await enterCardValues();
await browser.switchToFrame(null);
await clickBody();

const diff = await browser.checkFullPageScreen('hosted-fields/distinct-elements-pacifico');
const diff = await browser.checkFullPageScreen('hosted-fields/card-element-pacifico');
assert.strictEqual(diff, 0);
});
});
}
});
});

async function clickBody() {
const body = await $("body");
await body.click();
if (BROWSER !== 'BrowserStackEdge') {
describe("distinct elements", async function () {
beforeEach(init({ fixture: 'hosted-fields-card-distinct', opts: config }));

it('matches distinct elements baseline', async function () {
await enterDistinctFieldValues();
await browser.switchToFrame(null);
await clickBody();

const diff = await browser.checkFullPageScreen('hosted-fields/distinct-elements-pacifico');
assert.strictEqual(diff, 0);
});
});
}
});
});
}

async function enterCardValues() {
await browser.switchToFrame(0);
async function clickBody() {
const body = await $("body");
await body.click();
}

const number = await $(sel.number);
const expiry = await $(sel.expiry);
const cvv = await $(sel.cvv);
async function enterCardValues() {
await browser.switchToFrame(0);

await number.setValue('4111111111111111');
await expiry.setValue('1028');
await cvv.setValue('123');
const number = await $(sel.number);
const expiry = await $(sel.expiry);
const cvv = await $(sel.cvv);

await browser.switchToFrame(null);
}
await number.setValue('4111111111111111');
await expiry.setValue('1028');
await cvv.setValue('123');

await browser.switchToFrame(null);
}

async function enterDistinctFieldValues() {
const withCvv = [
['4111111111111111', '4111 1111 1111 1111'],
['10', '10'],
['28', '28'],
async function enterDistinctFieldValues() {
const withCvv = [
['4111111111111111', '4111 1111 1111 1111'],
['10', '10'],
['28', '28'],
['123', '123']
];

Expand Down

0 comments on commit cee6299

Please sign in to comment.