-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1285 from weather-gov/eg-1252-additional-details
Additional observation details
- Loading branch information
Showing
12 changed files
with
415 additions
and
202 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* eslint-disable no-await-in-loop, no-plusplus */ | ||
const { test, expect } = require("@playwright/test"); | ||
|
||
const { describe, beforeEach } = test; | ||
|
||
describe("the location page", () => { | ||
beforeEach(async ({page}) => { | ||
await page.goto("http://localhost:8081/play/testing"); | ||
}); | ||
|
||
test("does not display marine alerts", async ({page}) => { | ||
await page.goto("/point/33.521/-86.812"); | ||
const alertEl = page.locator("weathergov-alert-list > div"); | ||
|
||
await expect(alertEl).toHaveCount(1); | ||
await expect(alertEl).toContainText("Wind Advisory"); | ||
await expect(alertEl).not.toContainText("Small Craft Advisory"); | ||
}); | ||
|
||
test("does include alerts based on fire zone", async ({page}) => { | ||
await page.goto("/point/34.749/-92.275"); | ||
const alertEl = page.locator("weathergov-alert-list > div"); | ||
|
||
await expect(alertEl).toContainText("Red Flag Warning"); | ||
}); | ||
|
||
describe("shows n/a for unavailable data", () => { | ||
test("wind is null", async ({page}) => { | ||
await page.goto("/point/33.211/-87.566"); | ||
const windEl = page.locator(".weather-gov-current-conditions .wx-wind-speed > td"); | ||
|
||
await expect(windEl).toContainText("N/A"); | ||
}); | ||
}); | ||
|
||
describe("Radar component loading tests", () => { | ||
test("does not kload if the current tab is not displaying", async ({page}) => { | ||
await page.goto("/point/33.521/-86.812"); | ||
const radarContainer = page.locator("#wx_radar_container"); | ||
|
||
await expect(radarContainer).toBeEmpty(); | ||
}); | ||
|
||
test("loads correctly after switching to the current tab", async ({page}) => { | ||
await page.goto("/point/33.521/-86.812"); | ||
const currentTab = page.locator('[data-tab-name="current"]'); | ||
const radarContainer = page.locator("#wx_radar_container"); | ||
|
||
await currentTab.click(); | ||
|
||
await expect(radarContainer).not.toBeVisible(); | ||
await page.pause(); | ||
}); | ||
}); | ||
|
||
describe("Page load error messages", () => { | ||
test("should load the default tabbed view without any error messages", async ({page}) => { | ||
await page.goto("/point/34.749/-92.275"); | ||
const errorEl = page.locator(".usa-alert--error"); | ||
|
||
await expect(errorEl).toHaveCount(0); | ||
}); | ||
|
||
test("should load without any error messages in the today tab", async ({page}) => { | ||
await page.goto("/point/34.749/-92.275#today"); | ||
const errorEl = page.locator(".usa-alert--error"); | ||
|
||
await expect(errorEl).toHaveCount(0); | ||
}); | ||
|
||
test("should load without any error messages in the daily (7-day) tab", async ({page}) => { | ||
await page.goto("/point/34.749/-92.275#daily"); | ||
const errorEl = page.locator(".usa-alert--error"); | ||
|
||
await expect(errorEl).toHaveCount(0); | ||
}); | ||
|
||
test("should load without any error messages in the current conditions tab", async ({page}) => { | ||
await page.goto("/point/34.749/-92.275#current"); | ||
const errorEl = page.locator(".usa-alert--error"); | ||
|
||
await expect(errorEl).toHaveCount(0); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
web/modules/weather_data/src/Service/Test/UnitConversion/Pressure.php.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
|
||
namespace Drupal\weather_data\Service\Test; | ||
|
||
use Drupal\weather_data\Service\UnitConversion; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
final class PressureUnitConversionTest extends TestCase | ||
{ | ||
/** | ||
* Test when the pressure value is null | ||
* @group unit | ||
* @group units-utility | ||
*/ | ||
public function testNullPressure(): void | ||
{ | ||
$expected = null; | ||
$actual = UnitConversion::getPressureScalar((object) ["value" => null]); | ||
|
||
$this->assertEquals($expected, $actual); | ||
} | ||
|
||
/** | ||
* Test from Pa to mbar | ||
* @group unit | ||
* @group units-utility | ||
*/ | ||
public function testPaToMbar(): void | ||
{ | ||
$expected = 0.15; | ||
$pressure = (object) [ | ||
"unitCode" => "wmoUnit:Pa", | ||
"value" => 15, | ||
]; | ||
$actual = UnitConversion::getPressureScalar($pressure, false); | ||
|
||
$this->assertEquals($expected, $actual); | ||
} | ||
|
||
/** | ||
* Test from Pa to Mercury | ||
* @group unit | ||
* @group units-utility | ||
*/ | ||
public function testPaToPsi(): void | ||
{ | ||
$expected = 0.0044295; | ||
$pressure = (object) [ | ||
"unitCode" => "wmoUnit:Pa", | ||
"value" => 15, | ||
]; | ||
$actual = round(UnitConversion::getPressureScalar($pressure), 7); | ||
|
||
$this->assertEquals($expected, $actual); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
25 changes: 25 additions & 0 deletions
25
web/themes/new_weather_theme/assets/sass/components/obs-table.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
@use "uswds-core" as *; | ||
|
||
/* Observation table overrides | ||
------------------------------- */ | ||
.usa-table.observation-table { | ||
td, | ||
th { | ||
vertical-align: top; | ||
padding: units(1) units(4) units(0.5) inherit; | ||
} | ||
|
||
th { padding-left: 0; } | ||
|
||
tr:first-of-type > td { | ||
border-top: none; | ||
} | ||
|
||
tr:last-of-type > td, | ||
tr:last-of-type > th { | ||
border-bottom: none; | ||
} | ||
|
||
margin-top: 0; | ||
line-height: line-height('body', 2); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.