Pass Tags from CLI | Playwright & Cucumber - Typescript | Part 11

Поделиться
HTML-код
  • Опубликовано: 8 сен 2024

Комментарии • 75

  • @letcode
    @letcode  Год назад +2

    Source code:
    github.com/ortoniKC/Playwright_Cucumber_TS

  • @rashmib3343
    @rashmib3343 Год назад +2

    You are doing great work , please dont stop it, now a days people want to watch entertainment videos , but some people also there who are waiting for your coding videos. Thank you so much for comeback.

    • @letcode
      @letcode  Год назад

      I won't stop 🛑

  • @abunaseribrahimimani
    @abunaseribrahimimani 9 месяцев назад +1

    Just want say, may God bless you Koushik matey, for your youtube videos on MS Playwright, Type Scripts and Cucumber. It has been a great help for one of my University project.

    • @letcode
      @letcode  9 месяцев назад

      Thank you 😊

  • @Piyush291183
    @Piyush291183 6 месяцев назад +1

    hi koushik excellent videos all of them learnt so much
    is it possible to add a couple of api tests to playwright cucumber framework that would really complete it.

    • @letcode
      @letcode  6 месяцев назад

      Thanks, sure I'll do it.

    • @Piyush291183
      @Piyush291183 6 месяцев назад

      looking forward to it thanks
      @@letcode

  • @sumitgoyal385
    @sumitgoyal385 3 месяца назад +1

    Thnx ,I thought monochrome was going to be used but it was FORCE_COLOR

    • @letcode
      @letcode  3 месяца назад +1

      Yes, that's the change, found in the GitHub documentation but not on the guide docs

  • @akshaypramodpai7736
    @akshaypramodpai7736 Год назад +1

    Awesome tutorial bro

  • @venkateshtumpuru4
    @venkateshtumpuru4 26 дней назад +1

    Hi Koushik, Thanks for the detailed info.
    Could you create a video tutorial on setting up a configuration file? I want to include settings such as tags, retries, parallel count, and environment in this file, so that these values can be utilized in `package.json`. Additionally, I want to set `process.env.BROWSER` and `process.env.ENV` using this configuration file.
    This setup will finalize my framework. Also, I want to be able to pass these configuration values as parameters in Jenkins if not the config file data will be utilised when I run in local.

    • @letcode
      @letcode  26 дней назад

      In this video I explained the same, apart from Jenkins everything is covered in the playlist.

  • @Ajaykumarpottumuthu
    @Ajaykumarpottumuthu Год назад +3

    Hi Koushik, Thanks for tutorials. One thing I would like to ask you. when i execute npm run test --TAGS="@TagName" => all tests run, I followed step by step and in cucumber.js used tags: process.env.npm_config_TAGS || "", command line argument concept is not working for me... Could you please help

    • @letcode
      @letcode  Год назад

      Hi,
      Is the tag name specified within the feature files?

    • @letcode
      @letcode  Год назад

      Lower case and upper case both can be used but have to use the same in cmd and within the script.

    • @sshah1825
      @sshah1825 Год назад

      @@letcode Hello Koushik, I have cloned your repo and trying to run specific tag but it runs all the tests. Same issue as mentioned above.

    • @hozefaali5801
      @hozefaali5801 Месяц назад +1

      That's right I'm facing the same issue, tried both cloning your repo as well implementing it in my existing repo but it's running all the tests

    • @letcode
      @letcode  Месяц назад

      try with lower case process.env.npm_config_tags.
      In a few system it accepts lower case.

  • @alexanderkotov6508
    @alexanderkotov6508 10 месяцев назад +1

    10:28 I used both:) const browserType = process.env.npm_config_BROWSER || process.env.BROWSER;

    • @letcode
      @letcode  10 месяцев назад

      Great 😃

  • @vothiminhngoc9743
    @vothiminhngoc9743 Год назад +2

    Hi Koushik, Thanks for tutorials. One thing I would like to ask you. After run this npm run test --TAGS="@fail" => all tests run, I followed step by step but i don't know why i can't passing command line arguments(using bash terminal). Hope you reply!!!

    • @letcode
      @letcode  Год назад

      I hope in the cucumber.js file u have used the process.env.TAGS in the tags line.

    • @vothiminhngoc9743
      @vothiminhngoc9743 Год назад

      @@letcode yes, I have used tags: process.env.TAGS || "" in cucumber.js file, and it only works when i add --TAGS="@fail" in package.json "test": "cross-env ENV=prod TAGS=@fail cucumber-js --config=config/cucumber.js || true ", but not work when run this npm run test --TAGS="@fail" :(

    • @P-nf7vl
      @P-nf7vl Год назад +1

      @@letcode same is the issue for me. It doesnt work even if I specify it in package.json "test": "cross-env ENV=prod TAGS=@fail cucumber-js --config=config/cucumber.js || true "

    • @letcode
      @letcode  Год назад

      @@P-nf7vl is @fail is mentioned in the scenario - cucumber files

    • @jampanisiva6795
      @jampanisiva6795 7 месяцев назад

      @@vothiminhngoc9743 @letcode any luck on this I am facing same issue when i am trying to over wright from terminal its not working

  • @MaheshPatel-qn7jj
    @MaheshPatel-qn7jj 2 месяца назад +1

    Hi Koushik,
    This is really great video.this helped me lot but I have one question. If I want to pass more then one tag then how to achieve that. As in my project requirement is where I need to run multiple scenarios with different tag Can you please help with that
    Thank you

    • @letcode
      @letcode  2 месяца назад

      Yes you can pass, space then followed by another tag.

  • @PSCYuri
    @PSCYuri 7 месяцев назад +1

    Hi, thanks for the tutorial. I tried the same and all the test are running still, not sure what is the issue I have everything the same way as you do.

    • @letcode
      @letcode  7 месяцев назад

      Are the tags placed on top of the scenario?

  • @krishnarjun2009
    @krishnarjun2009 6 месяцев назад

    Hi Kaushik,
    Thank you this information and it is really helpful. I want to know how can we use different devices in cucumber to perform the testing instead of browsers. It will be really helpful if you provide any information on that.

    • @letcode
      @letcode  6 месяцев назад +1

      Hi.
      Thanks, I will add a video about it.

  • @shabinasiraj7675
    @shabinasiraj7675 4 месяца назад +1

    Anyone have a idea how to pass the path for the test from the CLI ? Instead of tags i want to run a specific test only.

    • @letcode
      @letcode  4 месяца назад

      You can pass the feature= feature file name.

  • @user-pr3nv8ym2l
    @user-pr3nv8ym2l Месяц назад +1

    How do I add headless or browser parameters from command line?

    • @letcode
      @letcode  Месяц назад

      You can use the same concept with node params.

  • @sshah1825
    @sshah1825 Год назад +2

    @letcoce Hello Koushik, thank you for the complete playlist on Playwright cucumber framework. I am using your code but I am not able to run specific tests using tags, instead, it runs all the tests. Can you please help with this?

    • @letcode
      @letcode  Год назад

      Hi, if tags are passed correctly I guess it should work. I don't see any changes in the repo.

    • @gastonvillagra4379
      @gastonvillagra4379 Год назад

      Same problem.

    • @piarus3179
      @piarus3179 9 месяцев назад +1

      @@letcode hi, I have the same issue about this. I'm sure the tag I provided is correct. but still run all the tests.

    • @letcode
      @letcode  9 месяцев назад +1

      @piarus3179 please watch the next video, I have clarified.

  • @amangupta-pp7zn
    @amangupta-pp7zn Год назад +1

    Hi Koushik, one question
    I am passing env, browser, headless (true/false) from the CLI.
    I want to put all this metadata in the report. how can I get this data from the main command?

    • @letcode
      @letcode  Год назад

      Not sure if the report allows meta data, I'll check..

  • @sumitgoyal385
    @sumitgoyal385 3 месяца назад +1

    If I pass command line arguments as in the video ,it will not run in the github actions am I correct or is there a way,please guide me

    • @letcode
      @letcode  3 месяца назад +1

      You can pass environment variables from GitHub actions also, I do in circle CI but GitHub actions are not yet used.

    • @sumitgoyal385
      @sumitgoyal385 3 месяца назад

      @@letcode Hi I will watch your circle CI video soon hope there you covered

  • @vikrantchaudhari7017
    @vikrantchaudhari7017 Год назад +1

    Nice video Koushik. Good job ! I have few questions here. Q1. How do you pass the --headless or --headed from command line? like this: npm run test --TAGS="@fail" --BROWSER="firefox" --headed (I tried but it does not work in this way :( )
    Q2. Where and how to configure the mobile devices viewport?

    • @letcode
      @letcode  Год назад +1

      Like browser headless should also work fine.
      For device config, I'll make a video

    • @vikrantchaudhari7017
      @vikrantchaudhari7017 Год назад +2

      @@letcode Thanks Koushik. I am eagerly waiting for video in device config 😃

  • @amangupta-pp7zn
    @amangupta-pp7zn Год назад +1

    Hi Koushik, I already had exp in Playwright Java but the new company i am joining asked for a ts framework. Your timing could not be better for me.. thank you!

  • @kalyankumar3096
    @kalyankumar3096 Год назад +1

    @Koushik want pass multiple tags and trying run below command
    npm run test --TAGS="[@test,@fail]"
    but no test cases are running

    • @letcode
      @letcode  Год назад

      Replied in WhatsApp group, hope that helps

    • @sureshn369
      @sureshn369 11 месяцев назад

      @@letcode Hi Bro, how to join whatsapp group?

  • @Gauravsharma-yi2dl
    @Gauravsharma-yi2dl 4 месяца назад +1

    @letcode can we use cucumber tags in github workflow ?

    • @letcode
      @letcode  4 месяца назад

      I received your mail too, I will check.

    • @Gauravsharma-yi2dl
      @Gauravsharma-yi2dl 4 месяца назад

      @@letcode we need to set "TAGS" in .yml file as well like
      name: Set npm_config_TAGS
      run: echo "npm_config_TAGS=@TAGS" >> $GITHUB_ENV

  • @shivaKumar-oy7ty
    @shivaKumar-oy7ty 10 месяцев назад +1

    Hello Koushik, Thanks for sharing this video. it's really useful. Just wanted to mention if you want to run with TAGS or BROWSERS from CLI it's not working in your code. I have pulled the latest code and it's the same. I tried to debug but I cannot see any issue could you please help to fix this. example used {npm test --TAGS="@auth"} or {npm test --BROWSER=firefox}

    • @letcode
      @letcode  10 месяцев назад +1

      I was working on the latest code to make some changes, that might be the reason.
      I'll check..

    • @jampanisiva6795
      @jampanisiva6795 7 месяцев назад +1

      @shivaKumar-oy7ty hello, how you are debugging in vs code with cucumber ... can you help me with that ?

    • @letcode
      @letcode  7 месяцев назад

      Page.pause will work..

    • @shivaKumar-oy7ty
      @shivaKumar-oy7ty 7 месяцев назад +1

      I have managed to work this. If you want to run Node, then use tags in the pre-script, i.e., 'TAGS=@auth npm test' or 'BROWSER=firefox npm test'

    • @hozefaali5801
      @hozefaali5801 Месяц назад

      @@shivaKumar-oy7ty do you mean to use the tags in the pre-test script in the package.json rather than using the tags runtime?

  • @sureshn369
    @sureshn369 11 месяцев назад +1

    Hi Brother , I was facing the issue like no tests run when passing tags and browser from CLI and found that it is due to the cucumber.js not getting exported. I modified as below and it is working fine , can you tell me why when i use export in the begining of the file it is not working? Is that something becuase of node.js version used?
    const config = {

    tags : process.env.npm_config_TAGS || "@Login",
    formatOptions : {
    "snippetInterface" : "async-await"
    },
    "paths" : [
    "src/test/features/*.feature"

    ],
    "dryRun" : false,
    "require" : ["src/test/steps/*.ts","src/hooks/hooks.ts"],
    "requireModule" : ["ts-node/register"],
    "format" :[
    "progress-bar",
    "html:test-results/cucumber-report.html",
    "json:test-results/cucumber-report.json",
    "rerun:@rerun.txt"
    ],
    "parallel" : 2,
    "retry" : 1

    }
    module.exports = {
    default: config
    }

    • @letcode
      @letcode  11 месяцев назад

      As u r using const, you cannot use it before initialisation.

    • @sureshn369
      @sureshn369 11 месяцев назад

      @@letcode if i am using module.exports = in the begining it is not getting exported, so i changed to const config = { and then exported at the last

  • @Ashokkumar-uv4fs
    @Ashokkumar-uv4fs 6 месяцев назад +1

    @letcode - The command line argument working in VS Code, if I pass particular tag then working fine, but it is not worked in azure pipeline, In pipeline execute all the scenarios, could you please help me how to solve that issue.
    package.json
    "testQA": "cross-env ENV=qa FORCE_COLOR=0 cucumber-js --config=apps/sos-e2e/Configuration/Cucumber.js"
    cucumber.js
    tags: process.env.npm_config_TAGS || ""
    command:
    npm run testQA --TAGS="@RegressionDealerTest"
    5/6 steps [======================================================================================================= ]P
    ass
    1 scenario (1 passed)
    6 steps (6 passed)
    0m42.963s (executing steps: 0m23.138s)

    • @letcode
      @letcode  6 месяцев назад

      Azure pipeline has a different mechanism to read the variables so you have to use that.
      You'll find in their documentation.