Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: setup cypress #3152

Merged
merged 75 commits into from
Mar 20, 2020
Merged

test: setup cypress #3152

merged 75 commits into from
Mar 20, 2020

Conversation

asbiin
Copy link
Member

@asbiin asbiin commented Oct 31, 2019

Fix cypress run and add it to the pipeline.

List elements

When we deal with list elements, cypress cannot now the id of each item

  • when a list is displayed
  • when an object is added to the list

The solution is to add the id of every items in a v-cy-items attribute:

<div v-cy-name="activities-body" v-cy-items="activities.map(c => c.id)">
  <div v-for="activity in activities" :key="activity.id" class="ba br2 b--black-10 br--top w-100 mb2" v-cy-name="'activity-body-'+activity.id">
...
  <a href="" class="pointer" v-cy-name="'edit-activity-button-'+activity.id" @click.prevent="$set(activity, 'edit', true)">{{ $t('app.edit') }}</a>

The test looks like:

cy.get('[cy-name=activities-body]').should('be.visible')
  .invoke('attr', 'cy-items').then(function (item) {
    cy.get('[cy-name=edit-activity-button-'+item+']').click();
   ...
  })

the item var will contains the value of the cy-items attribute (here there is only 1 item)

Note that the v-cy-items and v-cy-name predicates does not do anything in production. On other environments, they add an attribute with the name of the predicate.

@cypress
Copy link

cypress bot commented Oct 31, 2019



Test summary

16 5 0 0


Run details

Project monica
Status Failed
Commit 366759c
Started Dec 20, 2019 7:38 PM
Ended Dec 20, 2019 7:40 PM
Duration 01:16 💡
OS Linux Ubuntu Linux - 16.04
Browser Electron 78

View run in Cypress Dashboard ➡️


Failures

contacts/gifts_spec.js Failed
1 Gifts > lets you manage a gift
journal/entries_spec.js Failed
1 Journal entries > creates a journal entry when creating an activity
contacts/activities_spec.js Failed
1 Activities > lets you manage an activity
settings/activity_types_spec.js Failed
1 Settings: activity types > lets you add an activity type and use it
contacts/contacts_spec.js Failed
1 Contacts > lets you add a contact as favorite

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@mohammed90
Copy link

I guess this addresses #2835, right?

@asbiin
Copy link
Member Author

asbiin commented Nov 2, 2019

@mohammed90 well, it's related to, but it does not solve this issue.
Here I would like to run cypress tests in the tests pipeline, and that's all.

@asbiin asbiin changed the title tests: setup cypress test: setup cypress Nov 2, 2019
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

78.9% 78.9% Coverage
0.0% 0.0% Duplication

Copy link
Member

@djaiss djaiss left a comment

Choose a reason for hiding this comment

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

Bravo, huge huge work.

@asbiin asbiin merged commit de45518 into master Mar 20, 2020
@asbiin asbiin deleted the test/cypress-2019-10-31 branch March 20, 2020 07:18
@github-actions
Copy link

This pull request has been automatically locked since there
has not been any recent activity after it was closed.
Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants