Skip to content

Commit

Permalink
Test(ci): Use internal docker host to map localhost
Browse files Browse the repository at this point in the history
  • Loading branch information
literat committed Jan 2, 2024
1 parent dcb7e09 commit bcaf99d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions packages/common/constants/servers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ const SERVERS = {
},
};

const getDevelopmentEndpointUri = (packageName) =>
`http://${SERVERS.DEVELOPMENT[packageName].host}:${SERVERS.DEVELOPMENT[packageName].port}`;
const getDevelopmentEndpointUri = (packageName, { isDocker } = { isDocker: false }) =>
`http://${isDocker ? 'host.docker.internal' : SERVERS.DEVELOPMENT[packageName].host}:${
SERVERS.DEVELOPMENT[packageName].port
}`;

module.exports = { SERVERS, getDevelopmentEndpointUri };
4 changes: 2 additions & 2 deletions tests/e2e/demo-homepages.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import { expect, test } from '@playwright/test';
test.describe('Demo Homepages', () => {
const demos = [
{
url: isTesting() ? SERVERS.TESTING.web : getDevelopmentEndpointUri('web'),
url: isTesting() ? SERVERS.TESTING.web : getDevelopmentEndpointUri('web', { isDocker: true }),
package: 'web',
},
{
url: isTesting() ? SERVERS.TESTING['web-react'] : getDevelopmentEndpointUri('web-react'),
url: isTesting() ? SERVERS.TESTING['web-react'] : getDevelopmentEndpointUri('web-react', { isDocker: true }),
package: 'web-react',
},
];
Expand Down

0 comments on commit bcaf99d

Please sign in to comment.