Skip to content

Commit

Permalink
creating the server in the playwright config file
Browse files Browse the repository at this point in the history
  • Loading branch information
SergioCasCeb committed Jan 5, 2024
1 parent d6cf68f commit 55f4685
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions packages/web-new/playwright.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,20 @@
// @ts-check
const { defineConfig, devices } = require('@playwright/test');

//server
const express = require('express')
const port = 5100

const app = express()

//Middleware
app.use(express.json())
app.use(express.urlencoded({extended: false}))

app.use('/', express.static('./dist/'))

app.listen(port, () => console.log(`Running siteTest on port ${port}`))

const isCI = process.env.CI;

module.exports = defineConfig({
Expand All @@ -34,7 +48,7 @@ module.exports = defineConfig({
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL: isCI ? 'https://deploy-preview-515--thingweb-playground.netlify.app' : 'http://127.0.0.1:5100',
baseURL: 'http://127.0.0.1:5100',

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
Expand Down Expand Up @@ -65,9 +79,9 @@ module.exports = defineConfig({
],

/* Run your local dev server before starting the tests */
webServer: {
command: isCI ? '' : 'npm run serve',
url: isCI ? 'https://deploy-preview-515--thingweb-playground.netlify.app' : 'http://127.0.0.1:5100',
reuseExistingServer: !isCI,
}
// webServer: {
// command: isCI ? '' : 'npm run serve',
// url: isCI ? '' : 'http://127.0.0.1:5100',
// reuseExistingServer: !isCI,
// }
});

0 comments on commit 55f4685

Please sign in to comment.