Skip to content

Commit

Permalink
test(toast): added component e2es
Browse files Browse the repository at this point in the history
  • Loading branch information
marinakostic committed Mar 28, 2023
1 parent a0f1fdb commit dcb087b
Showing 1 changed file with 33 additions and 4 deletions.
37 changes: 33 additions & 4 deletions packages/bee-q/src/components/toast/__tests__/bq-toast.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,41 @@ describe('bq-toast', () => {
expect(element.shadowRoot).not.toBeNull();
});

it('should display text', async () => {
it('should be visible on button click', async () => {
const page = await newE2EPage();
await page.setContent('<bq-toast></bq-toast>');
await page.setContent(`
<bq-button appearance="primary" size="small" target="" type="button" variant="standard">
Show Toast!
</bq-button>
<bq-toast>
<bq-icon slot="icon" name="info" color="ui--brand" size="24" weight="bold"></bq-icon>
<span slot="text">This is some toast text message! </span></bq-toast
>
`);

const element = await page.find('bq-toast >>> [part="panel"]');
expect(element).not.toBeDefined;

const button = await page.find('bq-button');
await button.click();
expect(element).toBeDefined;
});

it('should render basic toast', async () => {
const page = await newE2EPage();
await page.setContent('<bq-toast>New Toast<span slot="text">This is some toast text message!</span></bq-toast>');

const text = await page.find('bq-toast >>> slot[name="text"]');

expect(text).not.toBeNull();
});

it('should show toast with icon', async () => {
const page = await newE2EPage();
await page.setContent('<bq-toast type="info" show-icon="true">New Toast Message!</bq-toast>');

const element = await page.find('bq-toast >>> p');
const iconHolder = await page.find('bq-toast >>> [part="icon"]');

expect(element).toEqualText('My name is Stencil');
expect(iconHolder).not.toBeNull();
});
});

0 comments on commit dcb087b

Please sign in to comment.