diff --git a/src/e2e/home.e2e.js b/src/e2e/home.e2e.js
index 20763ff69a34639cb5fbe6149605cf1f7411eb5a..914ed7c1934eaf4fb2f89d6aee76a5f81470482e 100644
--- a/src/e2e/home.e2e.js
+++ b/src/e2e/home.e2e.js
@@ -1,10 +1,12 @@
import puppeteer from 'puppeteer';
+const BASE_URL = `http://localhost:${process.env.PORT || 8000}`;
+
describe('Homepage', () => {
it('it should have logo text', async () => {
const browser = await puppeteer.launch({ args: ['--no-sandbox'] });
const page = await browser.newPage();
- await page.goto('http://localhost:8000', { waitUntil: 'networkidle2' });
+ await page.goto(BASE_URL, { waitUntil: 'networkidle2' });
await page.waitForSelector('#logo h1');
const text = await page.evaluate(() => document.body.innerHTML);
expect(text).toContain('
Ant Design Pro
');
diff --git a/src/e2e/layout.e2e.js b/src/e2e/layout.e2e.js
index af1d2b33ea9aa0fe8ed565737b106fa720fe7f65..fa5edfd2e4faa8ebc7d8ae31f3d52813596aaf45 100644
--- a/src/e2e/layout.e2e.js
+++ b/src/e2e/layout.e2e.js
@@ -1,6 +1,8 @@
import puppeteer from 'puppeteer';
import RouterConfig from '../../config/router.config';
+const BASE_URL = `http://localhost:${process.env.PORT || 8000}`;
+
function formatter(data) {
return data
.reduce((pre, item) => {
@@ -22,7 +24,7 @@ describe('Homepage', () => {
const loadPage = async index => {
const path = layout[index];
try {
- await page.goto(`http://localhost:8000${path}`, { waitUntil: 'networkidle2' });
+ await page.goto(`${BASE_URL}${path}`, { waitUntil: 'networkidle2' });
const haveFooter = await page.evaluate(
() => document.getElementsByTagName('footer').length > 0
);
diff --git a/src/e2e/login.e2e.js b/src/e2e/login.e2e.js
index 2ecb3fe7bc81fb74d34ddc5bb5c3c51eb3709116..366de8cc6b902ece908d20a614d94cfd338f85f9 100644
--- a/src/e2e/login.e2e.js
+++ b/src/e2e/login.e2e.js
@@ -1,5 +1,7 @@
import puppeteer from 'puppeteer';
+const BASE_URL = `http://localhost:${process.env.PORT || 8000}`;
+
describe('Login', () => {
let browser;
let page;
@@ -10,7 +12,7 @@ describe('Login', () => {
beforeEach(async () => {
page = await browser.newPage();
- await page.goto('http://localhost:8000/user/login', { waitUntil: 'networkidle2' });
+ await page.goto(`${BASE_URL}/user/login`, { waitUntil: 'networkidle2' });
await page.evaluate(() => window.localStorage.setItem('antd-pro-authority', 'guest'));
});