-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Testing improvements #42
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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,27 @@ | ||
import { test, expect } from '@playwright/test' | ||
|
||
// a playwright test that uploads a file with a missing required column, and checks that the correct error message is displayed | ||
test('when the user uploads a file with a missing required column, the page correctly indicates there\'s an error', async ({ page }) => { | ||
await page.goto('/') | ||
await page.getByRole('button', { name: 'Start now' }).click() | ||
|
||
await page.waitForURL('**/dataset') | ||
|
||
await page.getByLabel('Conservation area dataset').check() | ||
await page.getByRole('button', { name: 'Continue' }).click() | ||
|
||
await page.waitForURL('**/upload') | ||
|
||
const fileChooserPromise = page.waitForEvent('filechooser') | ||
await page.getByText('Upload data').click() | ||
const fileChooser = await fileChooserPromise | ||
await fileChooser.setFiles('test/testData/conservation-area-errors.csv') | ||
|
||
await page.getByRole('button', { name: 'Continue' }).click() | ||
|
||
await page.waitForURL('**/errors') | ||
|
||
expect(await page.title()).toBe('Your data has errors - Publish planning and housing data for England') | ||
|
||
expect(await page.textContent('.govuk-list')).toContain('Missing required column reference') | ||
}) |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
geometry,reference,name,area(ha),documentation-url,Layer,start-date,organisation | ||
"MULTIPOLYGON (((417470.001684007 567301.714013675,417470.028180008 567301.819869675,417472.17410001 567315.500253689,417474.129300011 567328.516317701,417475.822612013 567339.523037711,417476.087188013 567341.110621711,417477.674644015 567341.851357713,417477.992212015 567346.296413718,417477.806996015 567347.592925718,417478.600724015 567353.281373724,417494.860052031 567353.394269723,417495.795988032 567353.585885724,417496.989332032 567353.757661724,417497.669652034 567353.899485724,417499.820308035 567354.233949725,417516.118676051 567357.805789728,417520.566804055 567358.743773729,417534.692500068 567361.827549731,417537.999764071 567362.224349732,417544.190996077 567363.097437732,417554.456852086 567364.552669734,417568.3210441 567366.351837736,417576.576148107 567367.463133737,417580.41256411 567367.939421738,417581.814932112 567368.230365738,417583.137812113 567368.600797737,417584.936980114 567368.944733739,417589.911188119 567369.553373739,417596.790292126 567370.426461739,417616.131348143 567373.813085742,417622.50792415 567375.241949745,417635.842964162 567377.808349747,417642.748564169 567379.051869748,417648.992660174 567380.189661749,417663.095060187 567382.888413751,417663.756564188 567382.994141752,417665.052948189 567383.417565752,417667.063828191 567383.920221752,417668.704276193 567384.528733753,417669.498004193 567384.952157753,417670.609172194 567385.481309753,417671.508756195 567386.010461753,417673.202196197 567386.830685755,417685.029012208 567392.730845761,417686.034452209 567393.207133761,417686.378388209 567393.49820576,417688.495124212 567394.450653762,417690.267796213 567395.006301763,417695.585940218 567397.043549765,417700.136724222 567401.197533768,417700.507156222 567408.579421775,417707.809684229 567409.188061776,417718.102036239 567410.008157777,417721.118228242 567410.008157777,417723.578900244 567409.770077776,417728.394388248 567409.002845775,417730.80206825 567408.261981774,417731.966228251 567407.812189775,417739.427476259 567404.584285771,417754.111892272 567398.154845765,417769.881108287 567391.355101759,417776.098836293 567388.682717757,417781.628564298 567386.301533755,417781.998996298 567384.475869752,417782.263572298 567384.158429753,417782.766356299 567382.83542175,417783.057428299 567381.96233375,417783.163156299 567381.38018975,417783.1896523 567379.581021748,417783.136788299 567379.078365747,417782.9779403 567378.469853748,417782.157844299 567373.813085742,417780.041108296 567362.621277733,417778.850452296 567357.197277727,417776.919060294 567346.957917718,417775.543188293 567339.708253711,417774.087956291 567332.299869703,417772.209428289 567322.616157696,417768.796308286 567305.603421679,417767.790868285 567300.735069675,417766.150420283 567292.162525667,417764.192532281 567281.949661657,417759.959188278 567258.877917636,417747.071892265 567190.413917571,417742.999316262 567168.443101551,417742.829204261 567167.567069551,417742.563092262 567166.196701549,417741.994004261 567166.19414155,417735.141268254 567166.591069549,417724.346260244 567167.067357549,417704.846356226 567168.152157551,417686.087444209 567169.210461551,417667.010836191 567170.268765554,417655.23688418 567170.930269554,417646.796692172 567169.501533553,417645.367956171 567162.410589546,417634.943380161 567163.151453547,417613.750164142 567164.686045548,417601.28821213 567165.638493549,417592.054292121 567166.220637549,417571.152148101 567167.570013551,417555.197716087 567168.654813552,417532.152468066 567170.295261553,417510.641812045 567171.803357555,417500.402452036 567172.544221556,417493.92014803 567173.390813556,417477.198484015 567174.581469556,417464.180884002 567175.481053557,417447.829651987 567176.592349559,417450.68712399 567185.984989567,417452.645011991 567197.547357578,417453.756307992 567204.082525585,417454.788115993 567210.53846159,417456.613779996 567221.650909601,417459.047955997 567235.277021613,417460.370835999 567242.76476562,417462.858004001 567256.893533634,417464.921748003 567269.408349646,417467.091348005 567282.584669657,417469.207956007 567296.50172567,417470.001684007 567301.714013675)))",4,South Jesmond,35.4,https://www.newcastle.gov.uk/services/planning-building-and-development/historic-enviornment-and-urban-design/conservation-areas,Conservation Area,04/04/2024,local-authority-eng:CAT | ||
"MULTIPOLYGON (((-0.307721 51.724964, -0.307831 51.72504, -0.307919 51.725121, -0.309609 51.724308, -0.309719 51.724396, -0.309827 51.724351, -0.310567 51.724111, -0.311557 51.724209, -0.311289 51.725021, -0.312243 51.725144, -0.313361 51.724663, -0.313442 51.724816, -0.313542 51.724941, -0.313769 51.725148, -0.313958 51.725282, -0.314149 51.725388, -0.314346 51.725476, -0.314968 51.72568, -0.315165 51.725757, -0.315342 51.725857, -0.315646 51.7261, -0.315062 51.726357, -0.31565 51.726857, -0.315697 51.726829, -0.316334 51.726541, -0.315174 51.725607, -0.315196 51.725567, -0.316655 51.724859, -0.319179 51.723653, -0.319324 51.72359, -0.319542 51.723529, -0.319311 51.723296, -0.319208 51.72317, -0.319171 51.723098, -0.319121 51.722938, -0.319074 51.722819, -0.318901 51.722609, -0.318655 51.722231, -0.318531 51.722079, -0.318429 51.721913, -0.318361 51.721818, -0.318117 51.721539, -0.31806 51.721433, -0.317967 51.721297, -0.317954 51.721231, -0.317906 51.721137, -0.317558 51.720619, -0.31744 51.720403, -0.317395 51.720347, -0.317332 51.720289, -0.317188 51.720327, -0.317193 51.720374, -0.316058 51.720405, -0.315945 51.720396, -0.315832 51.720366, -0.315523 51.720249, -0.314269 51.719732, -0.314235 51.719711, -0.314208 51.719682, -0.314108 51.719528, -0.314055 51.719543, -0.313452 51.718625, -0.311919 51.718993, -0.311247 51.718465, -0.309691 51.718939, -0.309808 51.719455, -0.30981 51.719479, -0.309762 51.719529, -0.30977 51.71964, -0.309807 51.719735, -0.304259 51.721425, -0.304714 51.721882, -0.304754 51.721885, -0.30476 51.721903, -0.304774 51.721904, -0.304756 51.721927, -0.305138 51.722323, -0.305439 51.722622, -0.306437 51.723516, -0.306725 51.723869, -0.306781 51.723867, -0.306827 51.723892, -0.306886 51.723969, -0.306895 51.723991, -0.30688 51.724023, -0.30685 51.724037, -0.307218 51.724556, -0.307196 51.724572, -0.307501 51.72482, -0.307721 51.724964)))",6,Northumberland Gardens,6.2,https://www.newcastle.gov.uk/services/planning-building-and-development/historic-enviornment-and-urban-design/conservation-areas,Conservation Area,40/04/2024,local-authority-eng:CAT | ||
geometry,name,area(ha),documentation-url,Layer,start-date,organisation | ||
"MULTIPOLYGON (((417470.001684007 567301.714013675,417470.028180008 567301.819869675,417472.17410001 567315.500253689,417474.129300011 567328.516317701,417475.822612013 567339.523037711,417476.087188013 567341.110621711,417477.674644015 567341.851357713,417477.992212015 567346.296413718,417477.806996015 567347.592925718,417478.600724015 567353.281373724,417494.860052031 567353.394269723,417495.795988032 567353.585885724,417496.989332032 567353.757661724,417497.669652034 567353.899485724,417499.820308035 567354.233949725,417516.118676051 567357.805789728,417520.566804055 567358.743773729,417534.692500068 567361.827549731,417537.999764071 567362.224349732,417544.190996077 567363.097437732,417554.456852086 567364.552669734,417568.3210441 567366.351837736,417576.576148107 567367.463133737,417580.41256411 567367.939421738,417581.814932112 567368.230365738,417583.137812113 567368.600797737,417584.936980114 567368.944733739,417589.911188119 567369.553373739,417596.790292126 567370.426461739,417616.131348143 567373.813085742,417622.50792415 567375.241949745,417635.842964162 567377.808349747,417642.748564169 567379.051869748,417648.992660174 567380.189661749,417663.095060187 567382.888413751,417663.756564188 567382.994141752,417665.052948189 567383.417565752,417667.063828191 567383.920221752,417668.704276193 567384.528733753,417669.498004193 567384.952157753,417670.609172194 567385.481309753,417671.508756195 567386.010461753,417673.202196197 567386.830685755,417685.029012208 567392.730845761,417686.034452209 567393.207133761,417686.378388209 567393.49820576,417688.495124212 567394.450653762,417690.267796213 567395.006301763,417695.585940218 567397.043549765,417700.136724222 567401.197533768,417700.507156222 567408.579421775,417707.809684229 567409.188061776,417718.102036239 567410.008157777,417721.118228242 567410.008157777,417723.578900244 567409.770077776,417728.394388248 567409.002845775,417730.80206825 567408.261981774,417731.966228251 567407.812189775,417739.427476259 567404.584285771,417754.111892272 567398.154845765,417769.881108287 567391.355101759,417776.098836293 567388.682717757,417781.628564298 567386.301533755,417781.998996298 567384.475869752,417782.263572298 567384.158429753,417782.766356299 567382.83542175,417783.057428299 567381.96233375,417783.163156299 567381.38018975,417783.1896523 567379.581021748,417783.136788299 567379.078365747,417782.9779403 567378.469853748,417782.157844299 567373.813085742,417780.041108296 567362.621277733,417778.850452296 567357.197277727,417776.919060294 567346.957917718,417775.543188293 567339.708253711,417774.087956291 567332.299869703,417772.209428289 567322.616157696,417768.796308286 567305.603421679,417767.790868285 567300.735069675,417766.150420283 567292.162525667,417764.192532281 567281.949661657,417759.959188278 567258.877917636,417747.071892265 567190.413917571,417742.999316262 567168.443101551,417742.829204261 567167.567069551,417742.563092262 567166.196701549,417741.994004261 567166.19414155,417735.141268254 567166.591069549,417724.346260244 567167.067357549,417704.846356226 567168.152157551,417686.087444209 567169.210461551,417667.010836191 567170.268765554,417655.23688418 567170.930269554,417646.796692172 567169.501533553,417645.367956171 567162.410589546,417634.943380161 567163.151453547,417613.750164142 567164.686045548,417601.28821213 567165.638493549,417592.054292121 567166.220637549,417571.152148101 567167.570013551,417555.197716087 567168.654813552,417532.152468066 567170.295261553,417510.641812045 567171.803357555,417500.402452036 567172.544221556,417493.92014803 567173.390813556,417477.198484015 567174.581469556,417464.180884002 567175.481053557,417447.829651987 567176.592349559,417450.68712399 567185.984989567,417452.645011991 567197.547357578,417453.756307992 567204.082525585,417454.788115993 567210.53846159,417456.613779996 567221.650909601,417459.047955997 567235.277021613,417460.370835999 567242.76476562,417462.858004001 567256.893533634,417464.921748003 567269.408349646,417467.091348005 567282.584669657,417469.207956007 567296.50172567,417470.001684007 567301.714013675)))",South Jesmond,35.4,https://www.newcastle.gov.uk/services/planning-building-and-development/historic-enviornment-and-urban-design/conservation-areas,Conservation Area,04/04/2024,local-authority-eng:CAT | ||
"MULTIPOLYGON (((-0.307721 51.724964, -0.307831 51.72504, -0.307919 51.725121, -0.309609 51.724308, -0.309719 51.724396, -0.309827 51.724351, -0.310567 51.724111, -0.311557 51.724209, -0.311289 51.725021, -0.312243 51.725144, -0.313361 51.724663, -0.313442 51.724816, -0.313542 51.724941, -0.313769 51.725148, -0.313958 51.725282, -0.314149 51.725388, -0.314346 51.725476, -0.314968 51.72568, -0.315165 51.725757, -0.315342 51.725857, -0.315646 51.7261, -0.315062 51.726357, -0.31565 51.726857, -0.315697 51.726829, -0.316334 51.726541, -0.315174 51.725607, -0.315196 51.725567, -0.316655 51.724859, -0.319179 51.723653, -0.319324 51.72359, -0.319542 51.723529, -0.319311 51.723296, -0.319208 51.72317, -0.319171 51.723098, -0.319121 51.722938, -0.319074 51.722819, -0.318901 51.722609, -0.318655 51.722231, -0.318531 51.722079, -0.318429 51.721913, -0.318361 51.721818, -0.318117 51.721539, -0.31806 51.721433, -0.317967 51.721297, -0.317954 51.721231, -0.317906 51.721137, -0.317558 51.720619, -0.31744 51.720403, -0.317395 51.720347, -0.317332 51.720289, -0.317188 51.720327, -0.317193 51.720374, -0.316058 51.720405, -0.315945 51.720396, -0.315832 51.720366, -0.315523 51.720249, -0.314269 51.719732, -0.314235 51.719711, -0.314208 51.719682, -0.314108 51.719528, -0.314055 51.719543, -0.313452 51.718625, -0.311919 51.718993, -0.311247 51.718465, -0.309691 51.718939, -0.309808 51.719455, -0.30981 51.719479, -0.309762 51.719529, -0.30977 51.71964, -0.309807 51.719735, -0.304259 51.721425, -0.304714 51.721882, -0.304754 51.721885, -0.30476 51.721903, -0.304774 51.721904, -0.304756 51.721927, -0.305138 51.722323, -0.305439 51.722622, -0.306437 51.723516, -0.306725 51.723869, -0.306781 51.723867, -0.306827 51.723892, -0.306886 51.723969, -0.306895 51.723991, -0.30688 51.724023, -0.30685 51.724037, -0.307218 51.724556, -0.307196 51.724572, -0.307501 51.72482, -0.307721 51.724964)))",Northumberland Gardens,6.2,https://www.newcastle.gov.uk/services/planning-building-and-development/historic-enviornment-and-urban-design/conservation-areas,Conservation Area,40/04/2024,local-authority-eng:CAT |
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,31 @@ | ||
import { describe, it, expect } from 'vitest' | ||
|
||
import toErrorList from '../../src/filters/toErrorList' | ||
|
||
describe('toErrorList', () => { | ||
it('returns an empty array if there are no errors', () => { | ||
expect(toErrorList([])).toEqual([]) | ||
}) | ||
|
||
it('returns an array of errors', () => { | ||
expect( | ||
toErrorList({ | ||
'email-address': { | ||
type: 'required' | ||
}, | ||
'first-name': { | ||
type: 'required' | ||
} | ||
}) | ||
).toEqual([ | ||
{ | ||
text: 'Enter an email address', | ||
href: '#email-address' | ||
}, | ||
{ | ||
text: 'Enter your first name', | ||
href: '#first-name' | ||
} | ||
]) | ||
}) | ||
}) |
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,14 @@ | ||
// test the validation lookup function | ||
|
||
import { describe, it, expect } from 'vitest' | ||
import validationMessageLookup from '../../src/filters/validationMessageLookup.js' | ||
|
||
describe('validationMessageLookup', () => { | ||
it('returns the correct message for a given field and type', () => { | ||
expect(validationMessageLookup('email-address', 'required')).toBe('Enter an email address') | ||
}) | ||
|
||
it('throws an error if the field or type is not found', () => { | ||
expect(() => validationMessageLookup('email-address', 'missing')).toThrow('No validation message found for field email-address and type missing') | ||
}) | ||
}) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I were being really nitpicky it might be helpful if you could name the file with which errors were in it for other people looking at it later, e.g 'conservation-area-missing-reference(-error?).csv'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's only one file with errors that i have. and it has missing ref and invalid values
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay fair