export getBaseUrl

This commit is contained in:
Ashley Harrison 2021-12-15 16:01:42 +00:00
parent 5a0dd3cca0
commit ae7eecea37
No known key found for this signature in database
GPG Key ID: AEC29E54E8D7CD90
2 changed files with 3 additions and 3 deletions

View File

@ -1,5 +1,5 @@
import { e2e } from '../index'; import { e2e } from '../index';
import { fromBaseUrl } from '../support/url'; import { getBaseUrl } from '../support/url';
const DEFAULT_USERNAME = 'admin'; const DEFAULT_USERNAME = 'admin';
const DEFAULT_PASSWORD = 'admin'; const DEFAULT_PASSWORD = 'admin';
@ -8,7 +8,7 @@ export const login = (username = DEFAULT_USERNAME, password = DEFAULT_PASSWORD,
if (loginViaApi) { if (loginViaApi) {
cy.request({ cy.request({
method: 'POST', method: 'POST',
url: fromBaseUrl('/login'), url: `${getBaseUrl}/login`,
body: { body: {
user: username, user: username,
password, password,

View File

@ -1,6 +1,6 @@
import { e2e } from '../index'; import { e2e } from '../index';
const getBaseUrl = () => e2e.env('BASE_URL') || e2e.config().baseUrl || 'http://localhost:3000'; export const getBaseUrl = () => e2e.env('BASE_URL') || e2e.config().baseUrl || 'http://localhost:3000';
export const fromBaseUrl = (url = '') => new URL(url, getBaseUrl()).href; export const fromBaseUrl = (url = '') => new URL(url, getBaseUrl()).href;