zot-wo-auth/tests/home.spec.js
Raul-Cristian Kele 087b42693f patch: update integration tests
Signed-off-by: raulkele <raulkeleblk@gmail.com>
Signed-off-by: Raul-Cristian Kele <raulkeleblk@gmail.com>
2023-08-15 20:12:30 +03:00

26 lines
917 B
JavaScript

// @ts-check
import { test, expect } from '@playwright/test';
import { hosts, endpoints, sortCriteria } from './values/test-constants';
test.describe('homepage test', () => {
test.beforeEach(async ({ page }) => {
await page.addInitScript(() => {
window.localStorage.setItem('authConfig', '{}');
});
});
test('homepage viewall navigation', async ({ page }) => {
await page.goto(`${hosts.ui}/home`);
const popularRequest = page.waitForRequest(
(request) =>
request.url() === `${hosts.api}${endpoints.globalSearch('', sortCriteria.downloads)}` &&
request.method() === 'GET'
);
const viewAllButton = page.getByText('View all').first();
await viewAllButton.click();
const popularResponse = await popularRequest;
expect(popularResponse).toBeTruthy();
await expect(page).toHaveURL(`${hosts.ui}/explore?sortby=${sortCriteria.downloads}`);
});
});