UNPKG

e2ed

Version:

E2E testing framework over Playwright

21 lines (20 loc) 1.09 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.assertUrlMatchRoute = void 0; const expect_1 = require("../../expect"); const step_1 = require("../../step"); const asserts_1 = require("../../utils/asserts"); /** * Asserts that url or url path (which can be wrapped in a promise) match route. */ const assertUrlMatchRoute = (maybeUrlOrPath, route) => (0, step_1.step)('Asserts that url or url path match route', async () => { const { routeParams } = route; const routeUrl = route.getUrl(); const urlOrPath = await maybeUrlOrPath; (0, asserts_1.assertValueIsDefined)(urlOrPath, 'urlOrPath is defined', { routeParams, routeUrl }); (0, asserts_1.assertValueIsNotNull)(urlOrPath, 'urlOrPath is not null', { routeParams, routeUrl }); // TODO: support Smart Assertions await (0, expect_1.expect)(routeUrl, 'route url contains the specified url or url path').contains(urlOrPath); return { routeParams, routeUrl, urlOrPath }; }, { type: 6 /* LogEventType.InternalAssert */ }); exports.assertUrlMatchRoute = assertUrlMatchRoute;