Skip to content

Commit afd2367

Browse files
committed
Logging visit URL in Cypress
1 parent a8ddd28 commit afd2367

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

.github/workflows/deploy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ jobs:
4747
config: baseUrl=http://localhost:5173/ab-test-calculator-link/
4848
env:
4949
CYPRESS_BASE_URL: http://localhost:5173/ab-test-calculator-link/
50+
DEBUG: "cypress:*"
5051

5152
- name: Upload artifact
5253
uses: actions/upload-pages-artifact@v3

cypress.config.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,15 @@ export default defineConfig({
44
e2e: {
55
baseUrl: process.env.CYPRESS_BASE_URL || 'http://localhost:5173',
66
supportFile: false,
7-
specPattern: 'cypress/e2e/**/*.cy.{js,jsx,ts,tsx}'
7+
specPattern: 'cypress/e2e/**/*.cy.{js,jsx,ts,tsx}',
8+
setupNodeEvents(on, config) {
9+
on("task", {
10+
log(message) {
11+
console.log(message);
12+
return null;
13+
},
14+
});
15+
},
816
},
917
component: {
1018
devServer: {

cypress/e2e/home.cy.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
describe('Home Page', () => {
22
beforeEach(() => {
33
const baseUrl = Cypress.env('CYPRESS_BASE_URL') || ''
4-
cy.visit(`${baseUrl}/?cs=1000&cc=24&vs=1000&vc=54`)
4+
const url = `${baseUrl}/?cs=1000&cc=24&vs=1000&vc=54`
5+
6+
cy.task("log", `--> Visiting URL: ${url}`)
7+
8+
cy.visit(url)
59
})
610

711
it('displays the correct heading', () => {

0 commit comments

Comments
 (0)