diff --git a/.gitignore b/.gitignore index 18b659878..35366c80f 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,12 @@ pprof/* # Nohup Files - https://man7.org/linux/man-pages/man1/nohup.1p.html nohup.* + +# Cypress tests +cypress.env.json +*/cypress/downloads +*/cypress/fixtures +*/cypress/plugins +*/cypress/screenshots +*/cypress/videos +*/cypress/support diff --git a/acceptanceTests/cypress.json b/acceptanceTests/cypress.json new file mode 100644 index 000000000..21abdfe9d --- /dev/null +++ b/acceptanceTests/cypress.json @@ -0,0 +1,8 @@ +{ + "watchForFileChanges":false, + "viewportWidth": 1920, + "viewportHeight": 1080, + "video": false, + "screenshotOnRunFailure": false, + "testFiles": ["tests/GuiPort.js"] +} diff --git a/acceptanceTests/cypress/integration/tests/GuiPort.js b/acceptanceTests/cypress/integration/tests/GuiPort.js new file mode 100644 index 000000000..bf0199a4f --- /dev/null +++ b/acceptanceTests/cypress/integration/tests/GuiPort.js @@ -0,0 +1,8 @@ +it('check', function () { + cy.visit(`http://localhost:${Cypress.env('port')}/`) + + cy.get('.header').should('be.visible') + cy.get('.TrafficPageHeader').should('be.visible') + cy.get('.TrafficPage-ListContainer').should('be.visible') + cy.get('.TrafficPage-Container').should('be.visible') +}) diff --git a/acceptanceTests/tap_test.go b/acceptanceTests/tap_test.go index 965b77c87..52a9410fa 100644 --- a/acceptanceTests/tap_test.go +++ b/acceptanceTests/tap_test.go @@ -138,6 +138,8 @@ func TestTapGuiPort(t *testing.T) { t.Errorf("failed to start tap pods on time, err: %v", err) return } + + runCypressTests(t, fmt.Sprintf("npx cypress run --spec \"cypress/integration/tests/GuiPort.js\" --env port=%d", guiPort)) }) } } diff --git a/acceptanceTests/testsUtils.go b/acceptanceTests/testsUtils.go index e1aee5806..2a2701d28 100644 --- a/acceptanceTests/testsUtils.go +++ b/acceptanceTests/testsUtils.go @@ -13,6 +13,7 @@ import ( "strings" "sync" "syscall" + "testing" "time" "github.com/gorilla/websocket" @@ -143,6 +144,17 @@ func getDefaultViewCommandArgs() []string { return append([]string{viewCommand}, defaultCmdArgs...) } +func runCypressTests(t *testing.T, cypressRunCmd string) { + cypressCmd := exec.Command("bash", "-c", cypressRunCmd) + t.Logf("running command: %v", cypressCmd.String()) + out, err := cypressCmd.Output() + if err != nil { + t.Errorf("%s", out) + return + } + t.Logf("%s", out) +} + func retriesExecute(retriesCount int, executeFunc func() error) error { var lastError interface{}