Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test after changing description and filter #43

Merged
merged 1 commit into from
Jan 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions e2e/tests/test-extension.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { test, expect } from './fixtures';

const ADD_TO_FAVS_TEXT = "Click \'☆\' to add your favourites here";

// verify filter
test('filter', async ({ page, extensionId }) => {
await page.goto(`chrome-extension://${extensionId}/panel.html`);

// use filter
await expect(page.locator('text="Filter:"')).toBeVisible();
await expect(page.getByPlaceholder('Filter...')).toBeVisible();
await page.locator('input').pressSequentially('Mastercard', { delay: 100 });

// Mastercard visible
Expand All @@ -19,8 +21,7 @@ test('filter', async ({ page, extensionId }) => {
// verify favourites message
test('fav', async ({ page, extensionId }) => {
await page.goto(`chrome-extension://${extensionId}/panel.html`);

await expect(page.locator('text="Add favourites if you like :-)"')).toBeVisible();
await expect(page.locator('text=' + ADD_TO_FAVS_TEXT)).toBeVisible();
});

// verify copy card to clipboard
Expand All @@ -42,6 +43,15 @@ test('copy card details', async ({ page, extensionId }) => {

clipboard = await page.evaluate("navigator.clipboard.readText()");
expect(clipboard).toContain("7373");

// country
let country = page.locator('text="NL"').first();
await expect(country).toBeVisible();
await country.click();

clipboard = await page.evaluate("navigator.clipboard.readText()");
expect(clipboard).toContain("NL");

});

// verify copy IBAN to clipboard
Expand Down Expand Up @@ -93,19 +103,20 @@ test('make favourite', async ({ page, extensionId }) => {

await page.goto(`chrome-extension://${extensionId}/panel.html`);
// empty favs message is visible
await expect(page.locator('text="Add favourites if you like :-)"')).toBeVisible();
await expect(page.locator('text=' + ADD_TO_FAVS_TEXT)).toBeVisible();

// pin card in favs
await page.click("[id='4871_0499_9999_9910']");
await page.waitForTimeout(1000);

// empty favs message is hidden
await expect(page.locator('text="Add favourites if you like :-)"')).not.toBeVisible();
await expect(page.locator('text=' + ADD_TO_FAVS_TEXT)).not.toBeVisible();

// unpin card from favs
await page.click("[id='4871_0499_9999_9910']");
await page.waitForTimeout(1000);

// empty favs message is visible
await expect(page.locator('text="Add favourites if you like :-)"')).toBeVisible();
await expect(page.locator('text=' + ADD_TO_FAVS_TEXT)).toBeVisible();

});
Loading