Skip to content

Commit

Permalink
Refactored the naming and cleanup the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mika-robots committed Oct 7, 2023
1 parent 9957088 commit 1e195a7
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 80 deletions.
2 changes: 1 addition & 1 deletion packages/end-to-end/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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': {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe.only('Crops', () => {
describe('Crops', () => {
let users;
let translation;
let crops;
Expand All @@ -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,
Expand Down Expand Up @@ -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')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe.only('Farm People', () => {
describe('Farm People', () => {
let users;
let translation;
let roles;
Expand All @@ -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,
Expand Down
35 changes: 0 additions & 35 deletions packages/end-to-end/cypress/e2e/specs/01-onboarding.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import moment from 'moment';

describe.only('Tasks', () => {
describe('Tasks', () => {
let users;
let translation;
let tasks;
Expand All @@ -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,
Expand Down Expand Up @@ -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();
Expand Down
21 changes: 9 additions & 12 deletions packages/end-to-end/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('/');
});
},
);
Expand All @@ -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();
Expand All @@ -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();
Expand Down

0 comments on commit 1e195a7

Please sign in to comment.