IT |
気になる、記になる… |
LINEMO、「スマホプラン」にMNP契約で14,000円相当のPayPayポイントが貰えるキャンペーンを開催中(2月28日まで) |
https://taisy0.com/2023/02/23/168841.html
|
linemo |
2023-02-23 07:49:39 |
TECH |
Techable(テッカブル) |
デザイン一新!空気清浄機「Airdog」シリーズからコンパクトモデル新型が発売開始 |
https://techable.jp/archives/196816
|
airdog |
2023-02-23 07:00:52 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
【Pandas】DataFrameの特定の列の値を使って計算を行う方法 |
https://qiita.com/wooooo/items/da7f209a33ee99315b06
|
https |
2023-02-23 16:12:43 |
Ruby |
Rubyタグが付けられた新着投稿 - Qiita |
rails routesエラー |
https://qiita.com/ayamo/items/8b810890e0d1ccd74a96
|
devise |
2023-02-23 16:02:06 |
Linux |
Ubuntuタグが付けられた新着投稿 - Qiita |
自宅サーバー構築譚:Ubuntu 22.04 LTS on ZFS in デスクトップパソコン(BIOS,MBR)・その2 |
https://qiita.com/katz_engineer/items/033471b69143bf76650e
|
biosmbr |
2023-02-23 16:38:47 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
LaravelでS3に画像を保存して表示するときにはまった話 |
https://qiita.com/pq_pods/items/3990a80b15d0c725071c
|
laravel |
2023-02-23 16:41:55 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
Amazon Relational Detabase Serviceとは? |
https://qiita.com/devdia/items/3f7dc313376ae824d72b
|
relationaldetabaseservice |
2023-02-23 16:26:30 |
Docker |
dockerタグが付けられた新着投稿 - Qiita |
Dockerを始めよう! |
https://qiita.com/aich/items/f02ef8e1a4caf6723fc6
|
ckerrunitubuntubashubuntu |
2023-02-23 16:58:21 |
Git |
Gitタグが付けられた新着投稿 - Qiita |
【git】特定のブランチを除外して、ローカルブランチを一括で削除するコマンドの解説 |
https://qiita.com/kabechiyo13/items/ff69236f748a07c91cce
|
除外 |
2023-02-23 16:00:50 |
海外TECH |
DEV Community |
Playwright - Parametrize tests |
https://dev.to/this-is-learning/playwright-parametrize-tests-2p2
|
Playwright Parametrize testsHey folks Today it s time to speak about how to parametrize tests with Playwright There are cases where we want to test the same behaviour but with different values so in these cases it s common to create a structure for the test and reuse it with different parameters The easiest way to do that with Playwright is using vanilla javascript You can create an array with different cases and using the for clause you can call the test N times with different parameters Coming back to the Tic Tac Toe application a real example could be to simulate different rounds and for each round indicate the sequence of the moves and who must be the winner An implementation of this scenario can be done in this wayimport expect test as base from playwright test const test base extend page async baseURL page use gt baseURL amp amp await page goto baseURL await use page type TestCase winner X O moves number const testCases TestCase winner X moves winner O moves for const winner moves of testCases test should win the player winner with these moves async page gt for const move of moves await page locator button nth child move click const winnerParagraph await page getByText winner i await expect winnerParagraph toContainText winner As you can notice the result is quite simple Define a TestCase typeCreate an array with the casesIterate the cases and create a test for each caseRun and check the test resultOk this solution is good and can resolve many of our cases but you can do more with Playwright It s possible to load a csv file and use it to map all the test cases Playwright doesn t fully expose this solution but the simplicity with which Playwright is built permits a simple solution to do this Let me show you an example You can map the previous two cases in a csv file like this ee csv winners cases csv test case winner moves should win the player X X should win the player O O Then using an npm package called csv parse we can load the csv in our test in this wayimport parse from csv parse sync import fs from fs import path from path const cases parse fs readFileSync path join process cwd ee csv winners cases csv columns true skip empty lines true Now in the records variable you have all the data that describe your test cases The last thing to do is to create the tests like in the previous example for const testCase of cases test testCase test case async page gt const moves testCase moves split for const move of moves await page locator button nth child move click const winnerParagraph await page getByText winner i await expect winnerParagraph toContainText testCase winner And voila you have a test suite that runs the test from a csv file In my opinion both ways are good but with the csv file you have less control of your code and your tests and it s easy to face an error that doesn t depend on the test or the code but because someone changed the file in the wrong way So please pay attention to who touches the files Ok I think you have an idea of how you can parameterize your tests It s time to say goodbye to this series this is the last article I ll come back to you in the future if there will be new features to share with you But for now I suppose that s all I hope you enjoyed it and see you soon test afterAll gt Bye bye N b you can find the code of this article here |
2023-02-23 07:00:39 |
海外ニュース |
Japan Times latest articles |
A year after war broke out, Ukrainian evacuees take life in Japan one step at a time |
https://www.japantimes.co.jp/news/2023/02/23/national/ukrainian-evacuees-japan-living/
|
A year after war broke out Ukrainian evacuees take life in Japan one step at a timeForced to abandon careers education plans and other opportunities at home those who made the kilometer journey to East Asia have had their lives |
2023-02-23 16:25:42 |
ニュース |
BBC News - Home |
UK government confirms new football regulator |
https://www.bbc.co.uk/sport/football/64536218?at_medium=RSS&at_campaign=KARANGA
|
independent |
2023-02-23 07:31:47 |
ニュース |
BBC News - Home |
Isle of Wight man, 82, won't leave collapsing cliff house |
https://www.bbc.co.uk/news/uk-england-hampshire-64735785?at_medium=RSS&at_campaign=KARANGA
|
wight |
2023-02-23 07:41:41 |
ニュース |
Newsweek |
完成目標はわずか5年後、中国が「究極のエネルギー」核融合発電に示す本気度 |
https://www.newsweekjapan.jp/stories/technology/2023/02/post-100881.php
|
|
2023-02-23 16:45:00 |
コメント
コメントを投稿