Skip to content

Commit

Permalink
Use Slow 4G / Fast 4G in test
Browse files Browse the repository at this point in the history
  • Loading branch information
campersau committed Sep 29, 2024
1 parent 76829b0 commit cc06a17
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,16 @@ public PageEmulateNetworkConditionsTests() : base()
[Test, Retry(2), PuppeteerTest("emulation.spec", "Emulation Page.emulateNetworkConditions", "should change navigator.connection.effectiveType")]
public async Task ShouldChangeNavigatorConnectionEffectiveType()
{
var slow3G = Puppeteer.NetworkConditions[NetworkConditions.Slow3G];
var fast4G = Puppeteer.NetworkConditions[NetworkConditions.Fast4G];
var slow4G = Puppeteer.NetworkConditions[NetworkConditions.Slow4G];
var fast3G = Puppeteer.NetworkConditions[NetworkConditions.Fast3G];
var slow3G = Puppeteer.NetworkConditions[NetworkConditions.Slow3G];

Assert.That(await Page.EvaluateExpressionAsync<string>("window.navigator.connection.effectiveType").ConfigureAwait(false), Is.EqualTo("4g"));
await Page.EmulateNetworkConditionsAsync(fast4G);
Assert.That(await Page.EvaluateExpressionAsync<string>("window.navigator.connection.effectiveType").ConfigureAwait(false), Is.EqualTo("4g"));
await Page.EmulateNetworkConditionsAsync(slow4G);
Assert.That(await Page.EvaluateExpressionAsync<string>("window.navigator.connection.effectiveType").ConfigureAwait(false), Is.EqualTo("3g"));
await Page.EmulateNetworkConditionsAsync(fast3G);
Assert.That(await Page.EvaluateExpressionAsync<string>("window.navigator.connection.effectiveType").ConfigureAwait(false), Is.EqualTo("3g"));
await Page.EmulateNetworkConditionsAsync(slow3G);
Expand Down

0 comments on commit cc06a17

Please sign in to comment.