Rayrun
← Back to Discord Forum

Azure Pipeline - Something wrong

Hello something is wrong with my Azure pipeline.

trigger:

  • main

pool: vmImage: ubuntu-latest

steps:

  • task: NodeTool@0 inputs: versionSpec: '18' displayName: 'Install Node.js'

  • task: Npm@1 displayName: 'Install Angular CLI' inputs: command: custom verbose: false customCommand: 'install @angular/cli@14.1.0 -g'

  • task: Npm@1 displayName: 'Install packages via npm' inputs: command: ci workingDir: XXXXX verbose: false condition: ne(variables['CacheRestored'], 'true')

  • script: npm install @playwright/test -D displayName: 'Install Playwright Dependencies'

  • script: npx playwright install displayName: 'Install Playwright browsers'

  • script: | npx playwright test createTraveler.spec.ts npx playwright test createSingleTrip.spec.ts npx playwright test cancelSingleTrip.spec.ts npx playwright test createPeriodTrip.spec.ts npx playwright test cancelPeriodTrip.spec.ts displayName: 'Run Playwright tests'

For some reason I get

Error: Playwright Test did not expect test() to be called here. Most common reasons include:

  • You are calling test() in a configuration file.

  • You are calling test() in a file that is imported by the configuration file.

  • You have two different versions of @playwright/test. This usually happens when one of the dependencies in your package.json depends on @playwright/test.

    at Digor.Web/playwright-tests/cancelPeriodTrip.spec.ts:10

    8 | test('Cancel Period Trip', async ({ page }) => { 9 | // Login

10 | await loginPage.navigate(page); | ^ 11 | await loginPage.fillEmail(page, LOGIN_DATA_ADMIN.email); 12 | await loginPage.fillPassword(page, LOGIN_DATA_ADMIN.password); 13 | await loginPage.clickNext(page);

at TestTypeImpl._currentSuite (/home/vsts/work/1/s/Digor.Web/node_modules/@playwright/test/lib/common/testType.js:69:13)
at TestTypeImpl._createTest (/home/vsts/work/1/s/Digor.Web/node_modules/@playwright/test/lib/common/testType.js:75:24)
at /home/vsts/work/1/s/Digor.Web/node_modules/@playwright/test/lib/common/transform.js:221:12
at Object.<anonymous> (/home/vsts/work/1/s/Digor.Web/playwright-tests/cancelPeriodTrip.spec.ts:10:16)

It workes locally if I run the script but not in azure.

This thread is trying to answer question "Why is the Azure pipeline throwing an error when running Playwright tests and how can it be fixed?"

0 replies
TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.