cypress

In Cypress.io is there anyway to control the test run?

 ̄綄美尐妖づ 提交于 2019-12-12 11:23:32
问题 My 'example-spec.js' tests under the integration folder contain 15 tests, each time the Cypress.io will run all the 15 tests written in the 'example-spec.js'. I would like to choose and specify 'which' test needs to run, maybe 1 or 2 test at a time. The reason maybe I don't want to wait to see the output of all test while adding a 'new' test. Is there any way to control the test run in Cypress.io? 回答1: I don't know if there's way to do it from user interface, but You can use mocha methods to

How does Cypress.io read the Windows environment variables?

蓝咒 提交于 2019-12-12 10:53:23
问题 I have set my environment variables in 'Cypress.env.json' file, while running the cypress test, it read the Cypress.env variables successfully. But to be more on the security aspect, rather than 'hard-cording' the values, my team asked me to keep this variable as separate 'parameters' which read from Windows 10 Environment variables. How do I achieve this ? It would be really helpful if someone could advise on this. { "QA_Server": "https://sometestingsite.com", "username": "testQA", "password

How to emulate vuex store action with cypress

那年仲夏 提交于 2019-12-12 10:05:45
问题 I have a login process where after sending a request to the server and getting a response, I do this: this.$auth.setToken(response.data.token); this.$store.dispatch("setLoggedUser", { username: this.form.username }); Now I'd like to emulate this behavior when testing with cypress, so i don't need to actually login each time I run a test. So I've created a command: Cypress.Commands.add("login", () => { cy .request({ method: "POST", url: "http://localhost:8081/api/v1/login", body: {}, headers:

How to test login to GSuite calendar using Cypress

痴心易碎 提交于 2019-12-12 08:14:30
问题 Environment Windows 10 NodeJs 8 Cypress 3.1.2 Selenium Chromium v59 How to authenticate to Google calendar using Cypress? I need to run automated tests on a Chrome extension that I am developing. The first step is to authenticate/login to GSuite calendar. I am using Cypress but it is not allowing me to login into GSuite calendar. Instead when "clicking sign-in" (from Cypress) it jumps to the Next button again. My code snippet describe('Login',function() { it('Go to GSuite calendar', function(

How to type text by cypress cy.type in <ion-input> Input type?

老子叫甜甜 提交于 2019-12-11 19:08:33
问题 < ion-input data-cy="email" type="email" class="border" placeholder="EMAIL"> If I do var typedText = 'test@email.com' cy.get('[data-cy=email]') .type(typedText,{ force: true }) .should('have.value',typedText) the test run shows error like CypressError: cy.type() failed because it requires a valid typeable element. 回答1: var typedText = 'test@email.com' cy.get('[data-cy=type-email]>[data-cy=type-email]') .type(typedText) .should('have.value',typedText) OR var typedText = 'test@email.com' cy.get

Converting existing cypress tests to cucumber style bdd using cypress-cucumber-preprocessor. Second scenario is not picked up

对着背影说爱祢 提交于 2019-12-11 18:44:54
问题 We have an existing application, the tests are written in cypress. We now want to integrate a cucumber style feature which will internally run using cypress. We used cypress-cucumber-preprocessor for the same. I followed the steps given here on the github page. The problem I'm facing now, is while running tests, it shows both the scenarios, but runs only one. Shows a green tick mark next to it, but doesn't start the second one, and the clock keeps on ticking. On clicking the second scenario

Changing data for route in cypress test for QraphQL endpoint

感情迁移 提交于 2019-12-11 17:08:37
问题 I have an Angular application using QraphQL. I write a test in cypress, looking like this: it('should do something', () => { cy.server(); cy.route('POST', '/graphql', 'fixture:data1.json'); // data is loaded from the endpoint to populate the page cy.visit('http://localhost:3000/#/something/somethingElse'); // when the button is clicked, the same endpoint is called again, // but now I need it to deliver some other data. cy.get('button') .click(); }); Can anyone provide me with a way to set

Getting error “EACCES: permission denied” when i install cypress

拈花ヽ惹草 提交于 2019-12-11 16:57:53
问题 When i try to install cypress using this commnad: sudo npm install cypress or sudo npm install -g cypress It is giving me this error: Error: EACCES: permission denied, open '/Users/humac/node_modules/cypress/cypress.zip' 回答1: Workaround: sudo npm install --unsafe-perm=true --allow-root cypress 来源: https://stackoverflow.com/questions/55151786/getting-error-eacces-permission-denied-when-i-install-cypress

cypress: unable to access app from window object

不羁的心 提交于 2019-12-11 16:19:15
问题 I need to access my vuex store in cypress tests, so i added the app to the window object in my main.js: const app = new Vue({ router, store, render: h => h(App) }).$mount("#app"); window.vueApp = app; And then i try to access it in my login command (commands.js): cy .request({ method: "POST", url: "http://localhost:8081/api/v1/login", body: {}, headers: { Authorization: "Basic " + btoa("administrator:12345678") } }) .then(resp => { console.log("app:", window.vueApp); ... window.localStorage

Assert sorting in an table using Cypress

我是研究僧i 提交于 2019-12-11 15:59:16
问题 Well, I have a table with many rows and columns, I would like to check if the table is sorted for a particular column. I have tried using different expects and asserts but its always returning true . Am I doing anything wrong here? cy.get('table tbody tr').should(function($trs) { var arrayOftd = $trs.map(function (i, tr) { return Cypress.$(tr).find('td').eq(3).text() }) var test = arrayOftd.sort() expect(arrayOftd).to.deep.equal.(test) }) It has to return true when sorted ascending and false