e2ed
Version:
E2E testing framework over Playwright
21 lines (20 loc) • 1.07 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.assertUrlMatchRoute = void 0;
const expect_1 = require("../../expect");
const asserts_1 = require("../../utils/asserts");
const log_1 = require("../../utils/log");
/**
* Asserts that url or url path (which can be wrapped in a promise) match route.
*/
const assertUrlMatchRoute = async (maybeUrlOrPath, route) => {
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 });
(0, log_1.log)('Asserts that url or url path match route', { routeParams, routeUrl, urlOrPath }, 6 /* LogEventType.InternalAssert */);
// TODO: support Smart Assertions
await (0, expect_1.expect)(routeUrl, 'route url contains the specified url or url path').contains(urlOrPath);
};
exports.assertUrlMatchRoute = assertUrlMatchRoute;