diff --git a/packages/end-to-end/cypress.config.js b/packages/end-to-end/cypress.config.js index 1247b6eb90..a9a90be25b 100644 --- a/packages/end-to-end/cypress.config.js +++ b/packages/end-to-end/cypress.config.js @@ -2,7 +2,7 @@ const { defineConfig } = require('cypress'); module.exports = defineConfig({ projectId: 'wzcbom', - defaultCommandTimeout: 90 * 1000, + // defaultCommandTimeout: 90 * 1000, video: true, env: { 'cypress-react-selector': { diff --git a/packages/end-to-end/cypress/e2e/specs/03-crops.js b/packages/end-to-end/cypress/e2e/crops.js similarity index 72% rename from packages/end-to-end/cypress/e2e/specs/03-crops.js rename to packages/end-to-end/cypress/e2e/crops.js index c74a6c4560..e3f8ffd571 100644 --- a/packages/end-to-end/cypress/e2e/specs/03-crops.js +++ b/packages/end-to-end/cypress/e2e/crops.js @@ -1,4 +1,4 @@ -describe.only('Crops', () => { +describe('Crops', () => { let users; let translation; let crops; @@ -16,10 +16,6 @@ describe.only('Crops', () => { translation = data; cy.visit('/'); - cy.get('[data-cy=email]', { timeout: 60 * 1000 }).should('exist'); - cy.get('[data-cy=continue]').should('exist'); - cy.get('[data-cy=continue]').should('be.disabled'); - cy.get('[data-cy=continueGoogle]').should('exist'); cy.loginOrCreateAccount( user.email, user.password, @@ -81,18 +77,15 @@ describe.only('Crops', () => { cy.get('[data-cy=crop-supplier]').should('exist').type('New Supplier'); cy.get('[data-cy=crop-annual]').should('exist').check({ force: true }); cy.get('[data-cy=variety-submit]').should('exist').and('not.be.disabled').click(); - // cy.url().should('include', '/crop/new/add_crop_variety/compliance'); - // cy.get('[data-cy=compliance-newVarietySave]').should('exist').and('be.disabled'); - // cy.waitForReact(); - // cy.get('[data-cy=compliance-seed]').eq(1).should('exist').check({ force: true }); - // cy.get('[data-cy=compliance-seed]').eq(1).should('exist').check({ force: true }); - // cy.get('[data-cy=compliance-seedAvailability]').eq(1).should('exist').check({ force: true }); - // cy.get('[data-cy=compliance-seedEngineered]').eq(0).should('exist').check({ force: true }); - // cy.get('[data-cy=compliance-seedTreated]').eq(2).should('exist').check({ force: true }); - // cy.get('[data-cy=compliance-newVarietySave]').should('exist').and('not.be.disabled').click(); - // cy.waitForReact(); - // cy.url().should('include', '/management'); - // cy.waitForReact(); + cy.url().should('include', '/crop/new/add_crop_variety/compliance'); + cy.get('[data-cy=compliance-newVarietySave]').should('exist').and('be.disabled'); + cy.get('[data-cy=compliance-seed]').eq(1).should('exist').check({ force: true }); + cy.get('[data-cy=compliance-seed]').eq(1).should('exist').check({ force: true }); + cy.get('[data-cy=compliance-seedAvailability]').eq(1).should('exist').check({ force: true }); + cy.get('[data-cy=compliance-seedEngineered]').eq(0).should('exist').check({ force: true }); + cy.get('[data-cy=compliance-seedTreated]').eq(2).should('exist').check({ force: true }); + cy.get('[data-cy=compliance-newVarietySave]').should('exist').and('not.be.disabled').click(); + cy.url().should('include', '/management'); // cy.get('[data-cy=spotlight-next]') // .contains('Next') // .should('exist') diff --git a/packages/end-to-end/cypress/e2e/specs/02-farm_people.js b/packages/end-to-end/cypress/e2e/farm_people.js similarity index 94% rename from packages/end-to-end/cypress/e2e/specs/02-farm_people.js rename to packages/end-to-end/cypress/e2e/farm_people.js index 235c8df3af..371221de1f 100644 --- a/packages/end-to-end/cypress/e2e/specs/02-farm_people.js +++ b/packages/end-to-end/cypress/e2e/farm_people.js @@ -1,4 +1,4 @@ -describe.only('Farm People', () => { +describe('Farm People', () => { let users; let translation; let roles; @@ -16,10 +16,6 @@ describe.only('Farm People', () => { translation = data; cy.visit('/'); - cy.get('[data-cy=email]', { timeout: 60 * 1000 }).should('exist'); - cy.get('[data-cy=continue]').should('exist'); - cy.get('[data-cy=continue]').should('be.disabled'); - cy.get('[data-cy=continueGoogle]').should('exist'); cy.loginOrCreateAccount( user.email, user.password, diff --git a/packages/end-to-end/cypress/e2e/specs/01-onboarding.js b/packages/end-to-end/cypress/e2e/specs/01-onboarding.js deleted file mode 100644 index 713376b977..0000000000 --- a/packages/end-to-end/cypress/e2e/specs/01-onboarding.js +++ /dev/null @@ -1,35 +0,0 @@ -describe.only('Onboarding', () => { - let users; - let translation; - - beforeEach(() => { - // Load the users fixture before the tests - cy.fixture('e2e-test-users.json').then((loadedUsers) => { - users = loadedUsers; - const user = users[Cypress.env('USER')]; - - // Load the locale fixture by reusing translations file - cy.fixture('../../../webapp/public/locales/' + user.locale + '/translation.json').then( - (data) => { - // Use the loaded data - translation = data; - - cy.visit('/'); - cy.get('[data-cy=email]').should('exist'); - cy.get('[data-cy=continue]').should('exist'); - cy.get('[data-cy=continue]').should('be.disabled'); - cy.get('[data-cy=continueGoogle]').should('exist'); - cy.loginOrCreateAccount( - user.email, - user.password, - user.name, - user.language, - translation['SLIDE_MENU']['CROPS'], - ); - }, - ); - }); - }); - - it.only('01_Onboard new user if not already created', () => {}); -}); diff --git a/packages/end-to-end/cypress/e2e/specs/04-tasks.js b/packages/end-to-end/cypress/e2e/tasks.js similarity index 84% rename from packages/end-to-end/cypress/e2e/specs/04-tasks.js rename to packages/end-to-end/cypress/e2e/tasks.js index 7e66b6a783..74e6a3d540 100644 --- a/packages/end-to-end/cypress/e2e/specs/04-tasks.js +++ b/packages/end-to-end/cypress/e2e/tasks.js @@ -1,6 +1,6 @@ import moment from 'moment'; -describe.only('Tasks', () => { +describe('Tasks', () => { let users; let translation; let tasks; @@ -18,10 +18,6 @@ describe.only('Tasks', () => { translation = data; cy.visit('/'); - cy.get('[data-cy=email]', { timeout: 60 * 1000 }).should('exist'); - cy.get('[data-cy=continue]').should('exist'); - cy.get('[data-cy=continue]').should('be.disabled'); - cy.get('[data-cy=continueGoogle]').should('exist'); cy.loginOrCreateAccount( user.email, user.password, @@ -73,11 +69,9 @@ describe.only('Tasks', () => { cy.get('[data-cy=addTask-continue]').should('exist').and('not.be.disabled').click(); cy.contains('First Field').should('be.visible'); - cy.get('[data-cy=map-selectLocation]').trigger('mousedown'); - cy.get('[data-cy=map-selectLocation]').trigger('mouseup'); - cy.get('[data-cy=map-selectLocation]').click(530, 216, { - force: false, - }); + // eslint-disable-next-line cypress/no-unnecessary-waiting + cy.wait(500, { log: false }); + cy.get('[data-cy=map-selectLocation]').click({ force: false }); cy.get('[data-cy=addTask-locationContinue]').should('exist').and('not.be.disabled').click(); cy.get('[data-cy=addTask-detailsContinue]').should('exist').and('not.be.disabled').click(); diff --git a/packages/end-to-end/cypress/support/commands.js b/packages/end-to-end/cypress/support/commands.js index 20a83f2104..0438cfd745 100644 --- a/packages/end-to-end/cypress/support/commands.js +++ b/packages/end-to-end/cypress/support/commands.js @@ -57,16 +57,17 @@ Cypress.Commands.add( cy.addFarm('UBC FARM', '49.250833, -123.2410777'); cy.onboardCompleteQuestions('Manager'); cy.acceptSlideMenuSpotlights(crop_menu_name); - cy.createFirstLocation(); + cy.get('[data-cy=home-farmButton]').should('exist').and('not.be.disabled'); + cy.visit('/'); } else { cy.get('[data-cy=enterPassword-password]').type(password); cy.get('[data-cy=enterPassword-submit]').should('exist').and('be.enabled').click(); cy.get('[data-cy=chooseFarm-proceed]').should('exist').and('be.enabled').click(); + cy.get('[data-cy=home-farmButton]').should('exist').and('not.be.disabled'); + cy.visit('/'); } - cy.get('[data-cy=home-farmButton]').should('exist').and('not.be.disabled'); - cy.visit('/'); }); }, ); @@ -83,21 +84,20 @@ Cypress.Commands.add('addFarm', (farmName, location) => { }); Cypress.Commands.add('onboardCompleteQuestions', (role) => { - cy.clock(); + // cy.clock(); cy.url().should('include', '/role_selection'); - cy.tick(); + // cy.tick(); cy.get('[data-cy=roleSelection-continue]').should('exist').and('be.disabled'); cy.waitForReact(); cy.get('[data-cy=roleSelection-role]').should('exist').check(role, { force: true }); cy.get('[data-cy=roleSelection-continue]').should('not.be.disabled').click(); - cy.clock().then((clock) => { - clock.restore(); - }); + // cy.clock().then((clock) => { + // clock.restore(); + // }); // Give Concent cy.log('giveConsent'); cy.url().should('include', '/consent'); - cy.waitForReact(); cy.get('[data-cy=consentPage-content]').should('exist'); cy.get('[data-cy=consent-continue]').should('exist').and('be.disabled'); cy.get('[data-cy=checkbox-component]').should('exist').click(); @@ -115,13 +115,10 @@ Cypress.Commands.add('onboardCompleteQuestions', (role) => { cy.url().should('include', '/certification/selection'); cy.get('[data-cy=certificationSelection-continue]').should('exist').and('be.disabled'); cy.get('[data-cy=certificationSelection-type]').should('exist'); - cy.waitForReact(); cy.get('[type="radio"]').first().check({ force: true }); cy.get('[data-cy=certificationSelection-continue]').should('not.be.disabled').click(); // Select certifier - cy.log('Select Certifier'); - cy.url().should('include', '/certification/certifier/selection'); cy.get('[data-cy=certifierSelection-proceed]').should('exist').and('be.disabled'); cy.get('[data-cy=certifierSelection-item]').should('exist').eq(1).click();