def METHOD_NAME(page, port):
    grid = GridBox(
        Spacer(width=50, height=10),
        Spacer(width=40, height=10),
        Spacer(width=60, height=20),
        Spacer(width=20, height=10),
        Spacer(width=20, height=30),
        ncols=4
    )
    serve(grid, port=port, threaded=True, show=False)
    time.sleep(0.2)
    page.goto(f"http://localhost:{port}")
    bbox = page.locator(".bk-GridBox").bounding_box()
    children = page.locator(".bk-GridBox div")
    assert bbox['width'] == 170
    assert bbox['height'] == 50
    bbox1 = children.nth(0).bounding_box()
    assert bbox1['x'] == 0
    assert bbox1['width'] == 50
    bbox2 = children.nth(1).bounding_box()
    assert bbox2['x'] == 50
    assert bbox2['width'] == 40
    bbox3 = children.nth(2).bounding_box()
    assert bbox3['x'] == 90
    assert bbox3['width'] == 60
    bbox4 = children.nth(3).bounding_box()
    assert bbox4['x'] == 150
    assert bbox4['width'] == 20
    bbox5 = children.nth(4).bounding_box()
    assert bbox5['x'] == 0
    assert bbox5['y'] == 20
    assert bbox5['width'] == 20
    assert bbox5['height'] == 30
    grid.ncols = 5
    time.sleep(0.1)
    bbox = page.locator(".bk-GridBox").bounding_box()
    children = page.locator(".bk-GridBox div")
    assert bbox['width'] == 190
    assert bbox['height'] == 30
    bbox1 = children.nth(0).bounding_box()
    assert bbox1['x'] == 0
    assert bbox1['width'] == 50
    bbox2 = children.nth(1).bounding_box()
    assert bbox2['x'] == 50
    assert bbox2['width'] == 40
    bbox3 = children.nth(2).bounding_box()
    assert bbox3['x'] == 90
    assert bbox3['width'] == 60
    bbox4 = children.nth(3).bounding_box()
    assert bbox4['x'] == 150
    assert bbox4['width'] == 20
    bbox5 = children.nth(4).bounding_box()
    assert bbox5['x'] == 170
    assert bbox5['y'] == 0
    assert bbox5['width'] == 20
    assert bbox5['height'] == 30