Skip to content

Commit

Permalink
Removed the appSetup command and set the portview in cypress config
Browse files Browse the repository at this point in the history
  • Loading branch information
rmanaem committed Nov 9, 2023
1 parent d4be4f2 commit 1ce621b
Show file tree
Hide file tree
Showing 8 changed files with 3 additions and 40 deletions.
2 changes: 2 additions & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ const fs = require("fs");
module.exports = defineConfig({

e2e: {
viewportHeight: 1080,
viewportWidth: 1920,

baseUrl: "http://localhost:3000",

Expand Down
6 changes: 1 addition & 5 deletions cypress/e2e/app/simple-e2etest.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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("/");
});

Expand Down
6 changes: 0 additions & 6 deletions cypress/e2e/page/annotation-pagetests.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {
Expand Down
6 changes: 0 additions & 6 deletions cypress/e2e/page/categorization-pagetests.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {
Expand Down
6 changes: 0 additions & 6 deletions cypress/e2e/page/download-pagetests.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {
Expand Down
6 changes: 0 additions & 6 deletions cypress/e2e/page/index-pagetests.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {
Expand Down
10 changes: 0 additions & 10 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
1 change: 0 additions & 1 deletion test_contributions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 1ce621b

Please sign in to comment.