From 1ce621b795004c1c2c82e9342795bef597110f70 Mon Sep 17 00:00:00 2001 From: rmanaem Date: Thu, 9 Nov 2023 13:17:26 -0500 Subject: [PATCH] Removed the `appSetup` command and set the portview in cypress config --- cypress.config.js | 2 ++ cypress/e2e/app/simple-e2etest.cy.js | 6 +----- cypress/e2e/page/annotation-pagetests.cy.js | 6 ------ cypress/e2e/page/categorization-pagetests.cy.js | 6 ------ cypress/e2e/page/download-pagetests.cy.js | 6 ------ cypress/e2e/page/index-pagetests.cy.js | 6 ------ cypress/support/commands.js | 10 ---------- test_contributions.md | 1 - 8 files changed, 3 insertions(+), 40 deletions(-) diff --git a/cypress.config.js b/cypress.config.js index 5e90efb9..f25f21be 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -6,6 +6,8 @@ const fs = require("fs"); module.exports = defineConfig({ e2e: { + viewportHeight: 1080, + viewportWidth: 1920, baseUrl: "http://localhost:3000", diff --git a/cypress/e2e/app/simple-e2etest.cy.js b/cypress/e2e/app/simple-e2etest.cy.js index ad2c75d3..95f21b3d 100644 --- a/cypress/e2e/app/simple-e2etest.cy.js +++ b/cypress/e2e/app/simple-e2etest.cy.js @@ -13,11 +13,7 @@ describe("End to end test using a simple UI path through the app", () => { ]; beforeEach(() => { - - // Standard setup for annotation tool testing - cy.appSetup(); - - // 2. Open the index page + // 1. Open the index page cy.visit("/"); }); diff --git a/cypress/e2e/page/annotation-pagetests.cy.js b/cypress/e2e/page/annotation-pagetests.cy.js index 75e0199b..5009b97d 100644 --- a/cypress/e2e/page/annotation-pagetests.cy.js +++ b/cypress/e2e/page/annotation-pagetests.cy.js @@ -8,12 +8,6 @@ describe("tests on annotation page ui with programmatic state loading and store // NOTE: Add more dataset json files here via 'require' ]; - beforeEach(() => { - - // Standard app setup - cy.appSetup(); - }); - datasets.forEach((p_dataset) => { context("Annotation page tests with " + p_dataset.description + " data", () => { diff --git a/cypress/e2e/page/categorization-pagetests.cy.js b/cypress/e2e/page/categorization-pagetests.cy.js index 936c04cc..69aa827e 100644 --- a/cypress/e2e/page/categorization-pagetests.cy.js +++ b/cypress/e2e/page/categorization-pagetests.cy.js @@ -9,12 +9,6 @@ describe("Tests on categorization page ui via programmatic state loading and sto // NOTE: Add more dataset json files here via 'require' ]; - beforeEach(() => { - - // Standard app setup - cy.appSetup(); - }); - datasets.forEach((p_dataset) => { context("Categorization page tests with " + p_dataset.description + " data", () => { diff --git a/cypress/e2e/page/download-pagetests.cy.js b/cypress/e2e/page/download-pagetests.cy.js index 2bdf4a88..9131d3b2 100644 --- a/cypress/e2e/page/download-pagetests.cy.js +++ b/cypress/e2e/page/download-pagetests.cy.js @@ -9,12 +9,6 @@ describe("tests on download page ui via programmatic state loading and store int // NOTE: Add more dataset json files here via 'require' ]; - beforeEach(() => { - - // Standard app setup - cy.appSetup(); - }); - datasets.forEach((p_dataset) => { context("download page tests with " + p_dataset.description + " data", () => { diff --git a/cypress/e2e/page/index-pagetests.cy.js b/cypress/e2e/page/index-pagetests.cy.js index c3389d2c..bff5ebf5 100644 --- a/cypress/e2e/page/index-pagetests.cy.js +++ b/cypress/e2e/page/index-pagetests.cy.js @@ -12,12 +12,6 @@ describe("Tests on the index page via store interaction", () => { // NOTE: Add more dataset json files here via 'require' ]; - beforeEach(() => { - - // Standard app setup - cy.appSetup(); - }); - datasets.forEach((p_dataset) => { context("index page with " + p_dataset.description + " data", () => { diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 0bddf0cf..e75f05d8 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -26,16 +26,6 @@ // Standard setup functionality for each collection of tests // NOTE: In the future we will likely want to parametrize this for different -// test setups (i.e. testing across different viewport sizes). -Cypress.Commands.add("appSetup", () => { - - // Standard setup for annotation tool testing - - // A. Set viewport size - // NOTE: Standard 13-inch laptop screen to start, but this can be expanded - cy.viewport("macbook-13"); -}); - Cypress.Commands.add("assertButtonStatus", (p_buttonName, p_enabled) => { let chainer = ( p_enabled ) ? "not.have.class" : "have.class"; diff --git a/test_contributions.md b/test_contributions.md index 4919439f..aa66c47b 100644 --- a/test_contributions.md +++ b/test_contributions.md @@ -22,7 +22,6 @@ TBD - `context` is a container function used to group different kinds of tests within the file and also is used to describe that context - `it` defines the individual, specific test you are writing *3.* Both `describe` and `context` can contain `beforeEach` functions that will be run before every `context` or before every `it`, respectively - - Use the `appSetup` function in your `beforeEach` for the `describe` function. This calls a set of common app configuration commands. *4.* Writing individual tests - Tests contain three primary sections: setup, action, and assert. They can be repeated as needed depending on the complexity of the test. But a good guideline to follow is to keep tests as simople as possible. - It is possible to work with multiple datasets for one test file. The paradigm that has been setup can be seen, for example, in `annotation-pagetests.cy.js`. The idea is that you utilize json files in the `fixtures` folder that describe each dataset and can use functions `datasetMeetsTestCriteria` and `loadAppState` to reflect both the data needs of your test and the dataset that's being used for the test.