mirror of https://github.com/grafana/grafana
Storybook: Add basic e2e verification test (#89779)
* add very basic tests to verify storybook builds correctly
* add storybook step to drone
* reorder steps
* drone tweaks
* don't need host since it's set in env
* don't need to wait
* format build.star and readd wait
* install netcat in CI
* do a yarn install here to get correct bindings
* refactoring to hopefully work better in CI
* add wait-on
* add verbose logging
* localhost?
* more logging
* specify storybook host
* ...
* back to grafana-server
* does this work? 🤔
* run storybook e2e test after rgm-package so the backround process is running for less time
* split into separate step
* format
pull/89852/head
parent
895baa95a0
commit
e87646eeb6
@ -0,0 +1,14 @@ |
||||
// very basic test to verify that the button story loads correctly
|
||||
// this is only intended to catch some basic build errors with storybook
|
||||
// NOTE: storybook must already be running (`yarn storybook`) for this test to work
|
||||
describe('Verify storybook', () => { |
||||
it('Loads the button story correctly', () => { |
||||
cy.visit('?path=/story/buttons-button--basic'); |
||||
getIframeBody().find('button:contains("Example button")').should('be.visible'); |
||||
}); |
||||
}); |
||||
|
||||
// see https://www.cypress.io/blog/2020/02/12/working-with-iframes-in-cypress
|
||||
function getIframeBody() { |
||||
return cy.get('#storybook-preview-iframe').its('0.contentDocument.body').should('not.be.empty').then(cy.wrap); |
||||
} |
@ -0,0 +1,41 @@ |
||||
""" |
||||
This module returns the pipeline used for verifying the storybook build. |
||||
""" |
||||
|
||||
load( |
||||
"scripts/drone/steps/lib.star", |
||||
"e2e_storybook_step", |
||||
"identify_runner_step", |
||||
"start_storybook_step", |
||||
"yarn_install_step", |
||||
) |
||||
load( |
||||
"scripts/drone/utils/utils.star", |
||||
"pipeline", |
||||
) |
||||
|
||||
def verify_storybook(trigger, ver_mode): |
||||
"""Generates the pipeline used for verifying the storybook build. |
||||
|
||||
Args: |
||||
trigger: a Drone trigger for the pipeline |
||||
ver_mode: indirectly controls which revision of enterprise code to use. |
||||
|
||||
Returns: |
||||
Drone pipeline. |
||||
""" |
||||
environment = {"EDITION": "oss"} |
||||
|
||||
steps = [ |
||||
identify_runner_step(), |
||||
yarn_install_step(), |
||||
start_storybook_step(), |
||||
e2e_storybook_step(), |
||||
] |
||||
|
||||
return pipeline( |
||||
name = "{}-verify-storybook".format(ver_mode), |
||||
trigger = trigger, |
||||
steps = steps, |
||||
environment = environment, |
||||
) |
Loading…
Reference in new issue