Skip to content

ui: e2e tests, improved cypress test for tsx, overview and db page#63401

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
nanduu04:e2eTestsTransactions
Apr 15, 2021
Merged

ui: e2e tests, improved cypress test for tsx, overview and db page#63401
craig[bot] merged 1 commit intocockroachdb:masterfrom
nanduu04:e2eTestsTransactions

Conversation

@nanduu04
Copy link
Copy Markdown

@nanduu04 nanduu04 commented Apr 9, 2021

Previously, only visual regression tests were written

Wrote cypress tests using the cypress-testing-library

CRDB-2388

Release note: None

@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@nanduu04 nanduu04 requested a review from dhartunian April 9, 2021 19:40
Copy link
Copy Markdown
Collaborator

@dhartunian dhartunian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great start!

Reviewed 1 of 2 files at r1.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @nanduu04)


pkg/ui/cypress/integration/databases/databases.visual.spec.ts, line 16 at r1 (raw file):

    cy.findAllByText("Databases").should("exist");
    cy.findAllByText("defaultdb").should("exist");
    cy.findAllByText("postgres").should("exist");

Seems odd to check for the postgres database in a CRDB test 😄


pkg/ui/cypress/integration/databases/databases.visual.spec.ts, line 23 at r1 (raw file):

  it("renders the view for databases/tables view", () => {
    cy.visit("#/databases/tables");
    cy.exec('cockroach sql --insecure --execute="create table test (id int)";');

I recommend using create table if not exists so that this test can be run multiple times on the same DB, or execute a drop operation at the end of the test.


pkg/ui/cypress/integration/databases/databases.visual.spec.ts, line 34 at r1 (raw file):

    cy.findAllByText("public.test").should("exist");
    cy.findAllByText("public.test1").should("exist");
    cy.findAllByText("public.test2").should("exist");

Can you add a test for loading table stats as well? This is the button you can click to see detailed statistics on individual db tables. It loads data asynchronously.


pkg/ui/cypress/integration/transactions/transactions.visual.spec.ts, line 18 at r1 (raw file):

});

describe("Transactions - Check check whether the transactions have been exectuted properly", () => {

nit: The naming on this test should be more specific. We're testing that transaction statistics show up properly, not that the transaction executes.
sp: executed


pkg/ui/cypress/integration/transactions/transactions.visual.spec.ts, line 24 at r1 (raw file):

      'cockroach sql --insecure --execute="BEGIN; CREATE TABLE cypress_test (id int); INSERT INTO cypress_test VALUES (234); INSERT INTO cypress_test VALUES (234); SELECT * FROM cypress_test; COMMIT;"'
    );
    cy.findAllByPlaceholderText("Search transactions")

Do you need findAll here if you're targeting a single element? Would findByPlaceholderText work?


pkg/ui/cypress/integration/transactions/transactions.visual.spec.ts, line 26 at r1 (raw file):

    cy.findAllByPlaceholderText("Search transactions")
      .should("exist")
      .click()

Do you need to click in order to type in the field?


pkg/ui/cypress/integration/transactions/transactions.visual.spec.ts, line 28 at r1 (raw file):

      .click()
      .type("CREATE TABLE cypress_test");
    cy.findAllByRole("button", "Enter").eq(0).click();

There should only be a single "Enter" button on the page. Can we do it without findAll and without eq(0)?


pkg/ui/cypress/integration/transactions/transactions.visual.spec.ts, line 36 at r1 (raw file):

    cy.findAllByText("CREATE TABLE cypress_test").should("exist");
    cy.findAllByText("INSERT INTO cypress_test").should("exist");
    cy.findAllByText("SELECT FROM cypress_test").should("exist");

Can you add a test that clicks on the Transaction into the Transaction details page and verifies that each statement fingerprint within the transaction shows up individually as well.

@nanduu04 nanduu04 force-pushed the e2eTestsTransactions branch from 2611f87 to 86002fe Compare April 14, 2021 22:54
Copy link
Copy Markdown
Author

@nanduu04 nanduu04 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @dhartunian and @nanduu04)


pkg/ui/cypress/integration/databases/databases.visual.spec.ts, line 16 at r1 (raw file):

Previously, dhartunian (David Hartunian) wrote…

Seems odd to check for the postgres database in a CRDB test 😄

Removed


pkg/ui/cypress/integration/databases/databases.visual.spec.ts, line 23 at r1 (raw file):

Previously, dhartunian (David Hartunian) wrote…

I recommend using create table if not exists so that this test can be run multiple times on the same DB, or execute a drop operation at the end of the test.

Done


pkg/ui/cypress/integration/transactions/transactions.visual.spec.ts, line 18 at r1 (raw file):

Previously, dhartunian (David Hartunian) wrote…

nit: The naming on this test should be more specific. We're testing that transaction statistics show up properly, not that the transaction executes.
sp: executed

Done


pkg/ui/cypress/integration/transactions/transactions.visual.spec.ts, line 24 at r1 (raw file):

Previously, dhartunian (David Hartunian) wrote…

Do you need findAll here if you're targeting a single element? Would findByPlaceholderText work?

Removed


pkg/ui/cypress/integration/transactions/transactions.visual.spec.ts, line 26 at r1 (raw file):

Previously, dhartunian (David Hartunian) wrote…

Do you need to click in order to type in the field?

Yep, we need to click to type


pkg/ui/cypress/integration/transactions/transactions.visual.spec.ts, line 28 at r1 (raw file):

Previously, dhartunian (David Hartunian) wrote…

There should only be a single "Enter" button on the page. Can we do it without findAll and without eq(0)?

removed

@nanduu04 nanduu04 requested a review from dhartunian April 14, 2021 22:56
@nanduu04 nanduu04 force-pushed the e2eTestsTransactions branch from 86002fe to 0195d7e Compare April 15, 2021 02:16
@nanduu04 nanduu04 changed the title ui: e2e tests, improved cypress test for transactions and database page ui: e2e tests, improved cypress test for transactions, overview and database page Apr 15, 2021
Copy link
Copy Markdown
Collaborator

@dhartunian dhartunian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ui: e2e tests, improved cypress test for transactions, overview and database page

this line is too long. truncate to "ui: e2e tests for txns, overview, db pages" or something like that.

:lgtm: otherwise, feel free to merge after fixing the commit message title (make sure to update it to match the PR title as well)

Reviewed 3 of 3 files at r2.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @nanduu04)

Previously, only visual regression tests were written

Wrote cypress tests using the cypress-testing-library

Release note: None
@nanduu04 nanduu04 force-pushed the e2eTestsTransactions branch from 0195d7e to 57e2a22 Compare April 15, 2021 15:06
@nanduu04 nanduu04 changed the title ui: e2e tests, improved cypress test for transactions, overview and database page ui: e2e tests, improved cypress test for tsx, overview and db page Apr 15, 2021
@nanduu04
Copy link
Copy Markdown
Author

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Apr 15, 2021

Build succeeded:

@craig craig bot merged commit 7a6c6bd into cockroachdb:master Apr 15, 2021
@nanduu04 nanduu04 deleted the e2eTestsTransactions branch April 15, 2021 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants