APIResponseAssertions
APIResponseAssertionsクラスは、テスト内でAPIResponseに関するアサーションを行うために使用できるアサーションメソッドを提供します。
// ...
import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat;
public class TestPage {
// ...
@Test
void navigatesToLoginPage() {
// ...
APIResponse response = page.request().get("https://playwright.dokyumento.jp");
assertThat(response).isOK();
}
}
メソッド
isOK
追加バージョン: v1.18レスポンスのステータスコードが200..299
の範囲内であることを保証します。
使用方法
assertThat(response).isOK();
戻り値
プロパティ
not()
追加バージョン: v1.20アサーションチェックを逆の条件で行います。例えば、このコードはレスポンスステータスが成功ではないことをテストします。
assertThat(response).not().isOK();
使用方法
assertThat(response).not()
戻り値