@salla.sa/twilight-components
Version:
Salla Web Component
40 lines (39 loc) • 2.05 kB
JavaScript
/*!
* Crafted with ❤ by Salla
*/
import { newE2EPage } from "@stencil/core/testing";
describe('salla-add-product-button-e2e', () => {
it('should be able to render salla-product-availability component', async () => {
const page = await newE2EPage();
await page.setContent(`<salla-add-product-button channels="sampleChannel"></salla-add-product-button>`);
await page.$eval("salla-add-product-button", elm => {
elm.productStatus = "out-and-notify";
});
await page.waitForChanges();
const element = await page.find('salla-add-product-button');
expect(await element.find('salla-button')).not.toBeNull();
});
it('should not create add product button with salla-product-availability component as default', async () => {
const page = await newE2EPage();
await page.setContent(`<salla-add-product-button></salla-add-product-button>`);
await page.waitForChanges();
const element = await page.find('salla-add-product-button');
expect(await element.find('salla-product-availability')).toBeNull();
});
it('should create add product button with salla-product-availability component due to the props', async () => {
const page = await newE2EPage();
await page.setContent(`<salla-add-product-button channels="sampleChannel" ></salla-add-product-button>`, { waitUntil: 'load' });
await page.waitForChanges();
const element = await page.find('salla-add-product-button');
expect(await element.find('salla-product-availability')).toBeNull();
});
it('should create add product button with out salla-button sub component', async () => {
const page = await newE2EPage();
await page.setContent(`<salla-add-product-button channels="sampleChannel" product-status="out-and-notify"></salla-add-product-button>`, { waitUntil: 'load' });
await page.waitForChanges();
const element = await page.find('salla-add-product-button');
//@ts-ignore
expect(element.children[0].children[0].innerHTML).toBe("");
});
});
//# sourceMappingURL=salla-add-product-button.e2e.js.map