@salla.sa/twilight-components
Version:
Salla Web Component
55 lines (54 loc) • 1.7 kB
JavaScript
/*!
* Crafted with ❤ by Salla
*/
import { newE2EPage } from "@stencil/core/testing";
describe('salla-login-modal-e2e', () => {
let page;
let element;
beforeEach(async () => {
page = await newE2EPage({
html: `<salla-login-modal></salla-login-modal>`
});
element = await page.find('salla-login-modal');
});
it('should render the component', async () => {
expect(element).not.toBeNull();
});
it('should render the first tab (Tab 1 :: Select Login Type)', async () => {
await page.$eval("salla-installment", elm => {
//@ts-ignore
elm.isEmailAllowed = true;
//@ts-ignore
elm.isMobileAllowed = true;
});
await page.waitForChanges();
const tabButton = await element.find(".s-login-modal-main-btn");
expect(tabButton).not.toBeNull();
});
it('should render the second tab (Tab 2 :: Login By Mobile)', async () => {
await page.$eval("salla-installment", elm => {
//@ts-ignore
elm.isEmailAllowed = false;
//@ts-ignore
elm.isMobileAllowed = true;
});
await page.waitForChanges();
const telInputField = await element.find("salla-tel-input");
expect(telInputField).not.toBeNull();
});
it('should render the third tab (Tab 3 :: Login By Email)', async () => {
await page.$eval("salla-installment", elm => {
//@ts-ignore
elm.isEmailAllowed = true;
//@ts-ignore
elm.isMobileAllowed = false;
});
await page.waitForChanges();
const emailInputField = await element.find("input");
expect(emailInputField.getAttribute('type')).toBe("email");
});
/**
* Unable to test tab 4 and 5
*/
});
//# sourceMappingURL=salla-login-modal.e2e.js.map