saleor-apps-redis_apl/packages/e2e/tests/operations/log-in-to-dashboard.ts
Lukasz Ostrowski 7c98e384fd
E2E tests (#668)
* playwright install

* Configrations

* assertions

* basic tests for apps installations

* tests for product feed

* Adjust PF assertions to use test-id

* Taxes smoke test

* moved files around

* Add smoke for Klaviyo

* More taxes tests

* remove workflow

* add example

* extract separate test for pf

* Improve PF test

* cr fixes
2023-06-28 17:08:00 +02:00

25 lines
946 B
TypeScript

import { Page, expect } from "@playwright/test";
import { configuration } from "../../setup/configuration";
import { routing } from "../../setup/routing";
interface LogInIntoDashboardArgs {
page: Page;
}
export const logInIntoDashboard = async ({ page }: LogInIntoDashboardArgs) => {
console.log("Will redirect to", routing.saleor.dashboard.homepage);
await page.goto(routing.saleor.dashboard.homepage, { timeout: 20000, waitUntil: "load" });
const url = page.url();
await page.locator('[data-test-id="email"]').click();
await page.locator('[data-test-id="email"]').fill(configuration.dashboardUserEmail);
await page.locator('[data-test-id="email"]').press("Tab");
await page.locator('[data-test-id="password"]').fill(configuration.dashboardUserPassword);
await page.locator('[data-test-id="submit"]').click();
await expect(page.locator('[data-test-id="welcome-header"]')).toBeVisible();
console.log("Logged in");
};