title,body,link,tags,view_count,is_answered,score,answer_count
End to end Testing Elasticsearch,"<p>A quick question relating the end to end Elasticsearch testing using Nest in c#.
I was able to setup an InMemoryConnection for Elasticsearch and be able to get a mock response when I do the search query. The problem is when I run the delete query, it doesn't delete the data. Is there a way to test it end to end? Thank you</p>
",https://stackoverflow.com/questions/71605713/end-to-end-testing-elasticsearch,"['c#', 'elasticsearch', 'integration-testing', 'nest', 'in-memory-database']",245,False,0,0
End to End Testing in Xcode Swift,"<p>I am creating an app, where the user can enter their credit score and the app will display the APR (Interest Rate) they are eligible for. The APR is calculated using a JSON service. This is not an external service and our team manages it.</p>
<p>Here is what our end-to-end test looks like. The ENV = TEST is sent to the app, where a test URL is used instead of the dev URL.</p>
<pre><code>final class APRTests: XCTestCase {
 
    func test_CalculateAPRSuccessfully() {
        
        let app = XCUIApplication()
        app.launchEnvironment = [&quot;ENV&quot;: &quot;TEST&quot;]
        app.launch()
        
        // enter credit score in text field
        let creditScoreTextField = app.textFields[&quot;creditScoreTextField&quot;]
        creditScoreTextField.tap()
        creditScoreTextField.typeText(&quot;700&quot;)
        
        // button
        let calculateAPRButton = app.buttons[&quot;calculateAPR&quot;]
        calculateAPRButton.tap()
        
        // text
        let aprText = app.staticTexts[&quot;aprText&quot;]
        // ? what to check over here
        XCTAssertFalse(aprText.label.isEmpty)
    }
}
</code></pre>
<p>Few questions.</p>
<ul>
<li><p>At the end of the test, I just check if the APR is displayed on the Text view. I cannot check for an actual amount, because it changes daily. I cannot use Mock because I need to test the real service (hosted on TEST server).</p>
</li>
<li><p>What other tests I should write?</p>
</li>
<li><p>Should I also test if the UI is validated successfully meaning user is not leaving fields blank.</p>
</li>
<li><p>How can I test if the APR service is offline then it should display a message to the user?</p>
</li>
<li><p>If I am writing detailed end to end tests then do I even need UI tests?</p>
</li>
</ul>
",https://stackoverflow.com/questions/73338924/end-to-end-testing-in-xcode-swift,"['ios', 'swift', 'xcode', 'testing']",139,False,0,0
Framework for end to end testing flutter application,"<p>What is the most popular or most convenient framework to write automation tests (user flows) with flutter framework? any help advice would be kindly appreciated.</p>
",https://stackoverflow.com/questions/73276564/framework-for-end-to-end-testing-flutter-application,"['flutter', 'testing', 'automation', 'e2e']",1829,True,2,3
Should I mock APIs in end-to-end testing?,"<p>When you are doing e2e tests for your application, you want to test the whole application, not some portions of it like unit tests or integration testing.</p>
<p>But in some situations, people do mock APIs.<br>
For example, when you have a massive microservice as your back-end, which makes your e2e tests very slow, or beside your own API, you rely on other third-party APIs, which makes your e2e tests fail occasionally.<br>
So you only want to make sure that your front-end application works well, what should you do?</p>
<p>In my company, we have a massive system with a really heavy database which makes e2e testing very ineffective. Is it right to mock APIs in such a scenario?</p>
",https://stackoverflow.com/questions/71969081/should-i-mock-apis-in-end-to-end-testing,"['testing', 'automated-tests', 'end-to-end']",4261,True,7,1
End-to-end testing of Static Web App behind EasyAuth?,"<p>I have an Angular webapp hosted in Static Web Apps and running behind EasyAuth with an AAD provider. I'm looking for suggestions and best practices as to how to do end-to-end testing as I'm struggling with the authentication. I want to setup a Playwright project to do the testing but I cannot log in using the normal login flow as I don't want to rely on a test-user and password (also because of MFA). My thinking was to authenticate using a managed identity of some sort but this is where I run into issues.</p>
<p>I can see that the EasyAuth uses the <code>StaticWebAppsAuthCookie</code> but is there any way to retrieve that programmatically without following the normal auth flow and using a managed identity? Or is this the wrong approach and if so what would be a best practise?</p>
",https://stackoverflow.com/questions/71996086/end-to-end-testing-of-static-web-app-behind-easyauth,"['azure', 'testing', 'azure-static-web-app']",116,False,1,0
Mocking server side requests for end to end testing by cypress,"<p>I am using Cypress for end to end tests. To test my payment process I need to mock the request of my back end(express) to bank for transaction. So when the cypress test clicks buy, a request goes to backend and the backend sends a request to bank for purchase, then the bank sends response to backend. So I need to test everything except requests to/from bank. From <a href=""https://stackoverflow.com/a/51439954/6687545"">this</a> answer I assume there is no way to mock server side requests by cypress. Hope someone can show me that I am wrong and the way of doing that!
I was hoping that cypress plugins will let me to do that, but seems like I misunderstood the purpose of them.</p>
",https://stackoverflow.com/questions/71285178/mocking-server-side-requests-for-end-to-end-testing-by-cypress,"['testing', 'cypress', 'end-to-end']",2128,False,3,0
Azure pipeline : When and how to do end to end testing?,"<p>I have a react project and all the backend stuff is hosted as docker images.
I understand most of what azure pipelines are and i have set up a initial pipeline which does the following.
Installs nodes
Installs packages
Runs unit tests
Finalises and builds the project
Then publishes the artefact</p>
<p>This then continues to the release branch to deliver the artefact.</p>
<p>My question is, how and where would end to end testing fit in? Would it be in the initial pipeline or the release pipeline, additionally, how would this be done?. My confusion is that my application relies on a database, however if its running in a pipeline it will not have access to this. Using either puppeteer, or any other end to end testing library, I'm i meant to mimic a database, or can I run my docker instance within the pipeline for my backend services? If im completely missing the mark, please let me know as well.</p>
",https://stackoverflow.com/questions/71936170/azure-pipeline-when-and-how-to-do-end-to-end-testing,"['javascript', 'reactjs', 'azure-devops', 'end-to-end']",526,False,-1,1
How to login manually then start end-to-end testing using Cypress,"<p>I have been working on an end-to-end test using Cypress. Our website requires user to login to azure active directory before opening the portal. I found various ways to automate the authentication process using cy.request() but I am wondering if there is a way to login to azure active directory &quot;manually&quot;, such as launching new window to prompt user to login or something similar, then start the test as we only have to automate the test of functionality of our website not the authentication.</p>
<p>Any idea is welcome.</p>
",https://stackoverflow.com/questions/73903162/how-to-login-manually-then-start-end-to-end-testing-using-cypress,"['azure-active-directory', 'cypress']",152,False,0,0
Testing scrolling behaviour in End-to-end testing ReactNative application with Cavy,"<p>I am building a Mobile application for both Android and IOS using ReactNative and TypeScript. I am writing End-to-end tests for my application using Cavy, <a href=""https://cavy.app/"" rel=""nofollow noreferrer"">https://cavy.app/</a>.</p>
<p>Now I am trying to tests the scroll behaviour of the Flat List view. I want make sure that the app fetes more data when the user scroll to the end of the list. The following is the dummy code of my Flat List view.</p>
<pre><code>&lt;FlatList
                    data={orderListHook.orders}
                    renderItem={renderItem}
                    keyExtractor={(item, index) =&gt; index.toString()}
                    onEndReachedThreshold={0.2}
                    onEndReached={orderListHook.loadMoreOrders}
                /&gt;
</code></pre>
<p>Basically, to test onEndReached, I need to scroll programatically in the tests. There are helpers method to filling in the input fields and pressing the button. But I could not find the functions to perform such scrolling. How can I stimulate that behaviour in the tests?</p>
",https://stackoverflow.com/questions/73079824/testing-scrolling-behaviour-in-end-to-end-testing-reactnative-application-with-c,"['react-native', 'end-to-end']",68,False,0,0
ERR_CONNECTION_REFUSED at http://localhost:3000/ when running End-to-End testing by puppeteer,"<p>I am trying to implement an End-to-End test on my React application after all 3 other steps of testing is completed. However, I am stuck on the aforementioned error. The project is running successfully on http://localhost:3000/.</p>
<pre><code>import puppeteer from 'puppeteer';

describe('show/hide an event details', () =&gt; {
  let browser;
  let page;

  beforeAll(async () =&gt; {
    jest.setTimeout(30000);
    browser = await puppeteer.launch();
    page = await browser.newPage();
    await page.goto('http://localhost:3000/');
    await page.waitForSelector('.event');
  });

  test('An event element is collapsed by default', async () =&gt; {
    const eventDetails = await page.$('.event .event__Details');
    expect(eventDetails).toBeNull();
  });

  afterAll(() =&gt; {
    browser.close();
  });

});

</code></pre>
",https://stackoverflow.com/questions/71941063/err-connection-refused-at-http-localhost3000-when-running-end-to-end-testing,['reactjs'],571,False,2,0
Prisma is opening too many connections with PostgrsQL when running Jest end to end testing,"<p>I'm trying here to do end to end testing with Jest on a NestJS/GraphQL app and Prisma as my ORM.</p>
<p>What happens here is Prisma is opening too many connections with Postgres, I've tried to fix this problem by using prisma.$disconnect() after each test but it doesn't seem to work...</p>
<p>This is what I've tried so far.</p>
<pre><code>import { PrismaService } from '../src/prisma.service';

describe('Users', () =&gt; {
  let app: INestApplication;
  const gql = '/graphql';
  let prisma;

  beforeEach(async () =&gt; {
    prisma = new PrismaService();

    const moduleFixture: TestingModule = await Test.createTestingModule({
      imports: [AppModule],
    }).compile();

    app = moduleFixture.createNestApplication();
    await app.init();
  });

  afterEach(async () =&gt; {
    await prisma.$disconnect();
  });

  it('Query - Users', async () =&gt; {
    //Using prisma to query database
  });
});
</code></pre>
<p>My Prisma service (I got it from NestJS documentation <a href=""https://docs.nestjs.com/recipes/prisma#use-prisma-client-in-your-nestjs-services"" rel=""nofollow noreferrer"" title=""documentation"">Text</a> ):</p>
<pre><code>import { INestApplication, Injectable, OnModuleInit } from '@nestjs/common';
import { PrismaClient } from '@prisma/client';

@Injectable()
export class PrismaService extends PrismaClient implements OnModuleInit {
  async onModuleInit() {
    await this.$connect();
  }

  async enableShutdownHooks(app: INestApplication) {
    this.$on('beforeExit', async () =&gt; {
      await app.close();
    });
  }
}
</code></pre>
<p>These are the errors I'm getting after running all the tests (serially):</p>
<p><a href=""https://i.stack.imgur.com/nloMQ.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/nloMQ.png"" alt=""enter image description here"" /></a></p>
<p>I've already looked through Prisma documentation but didn't find anything about how to setup properly a Jest environment with NestJS and Prisma.</p>
<p>Thanks for your help !</p>
",https://stackoverflow.com/questions/71259682/prisma-is-opening-too-many-connections-with-postgrsql-when-running-jest-end-to-e,"['jestjs', 'nestjs', 'prisma']",3171,True,3,1
Why protractor deprecated in jhipster?,"<p>I am curious to understand why jhipster 7.8.1 deprecated the protractor. Is there roadmap to include any other end-to-end testing framework?</p>
",https://stackoverflow.com/questions/74073315/why-protractor-deprecated-in-jhipster,"['protractor', 'jhipster']",52,True,0,1
How to add Cypress &quot;data-cy&quot; to Next.js Link?,"<p>This is how I can add <code>data-cy</code> if <code>Link</code> has an <code>&lt;a&gt;</code>. But what if <code>Link</code> does not have it?</p>
<pre class=""lang-js prettyprint-override""><code>&lt;Link href=&quot;/about/&quot;&gt;
    &lt;a data-cy=&quot;nav-item&quot;&gt;About&lt;/a&gt;
&lt;/Link&gt;
</code></pre>
<p><a href=""https://imranhsayed.medium.com/using-cypress-with-next-js-for-end-to-end-testing-cypress-nextjs-example-af100609cf16"" rel=""nofollow noreferrer"">https://imranhsayed.medium.com/using-cypress-with-next-js-for-end-to-end-testing-cypress-nextjs-example-af100609cf16</a></p>
",https://stackoverflow.com/questions/72057271/how-to-add-cypress-data-cy-to-next-js-link,"['next.js', 'cypress']",442,True,0,1
Cypress for Flutter (android),"<p>Is there a best practice variant for end-to-end testing in Flutter that is like Cypress or works emulator based?
It should cover the app for Android and not the webapp or PWA.</p>
<p>I look forward to your input!</p>
",https://stackoverflow.com/questions/71727087/cypress-for-flutter-android,"['flutter', 'testing', 'integration-testing', 'end-to-end']",643,True,4,1
How to integrate Testrail with Karate Framework,"<p>I want to integrate Testrail with my karate Script to so I can esily track my apis test cases</p>
<p>I am creating a end to end testing script using karate included easy tracking of my test cases using test rail</p>
",https://stackoverflow.com/questions/74360453/how-to-integrate-testrail-with-karate-framework,"['karate', 'testrail']",7,False,1,0
E2E Testing NestJS,"<p>Im new to NestJS and im trying to setup my end to end testing. It does not throw any errors but the request always returns 404.
The test look like this:</p>
<pre><code>import { CreateProductDto } from './../src/products/dto/create-product.dto';
import { ProductsModule } from './../src/products/products.module';
import { Product } from './../src/products/entities/product.entity';
import { Repository } from 'typeorm';
import { INestApplication } from '@nestjs/common';
import * as request from 'supertest';
import { createTypeOrmConfig } from './utils';
import { Test, TestingModule } from '@nestjs/testing';
import { TypeOrmModule } from '@nestjs/typeorm';

describe('ProductsController (e2e)', () =&gt; {
  let app: INestApplication;
  let productRepository: Repository&lt;Product&gt;;

  beforeEach(async () =&gt; {
    const config = createTypeOrmConfig();

    const moduleFixture: TestingModule = await Test.createTestingModule({
      imports: [
        TypeOrmModule.forRoot(config),
        TypeOrmModule.forFeature([Product]),
        ProductsModule,
      ],
    }).compile();

    app = moduleFixture.createNestApplication();
    productRepository = moduleFixture.get('ProductRepository');

    await app.init();
  });

  afterAll(async () =&gt; {
    await app.close();
  });

  it('create', async () =&gt; {
    // Arrange
    const createProductDto = new CreateProductDto();
    createProductDto.name = 'testname';
    createProductDto.description = 'testdescription';
    createProductDto.price = 120;
    createProductDto.image = 'testimage';

    // Act
    const response = await request(app.getHttpServer())
      .post(`/api/v1/products`)
      .send(createProductDto);

    // Assert
    expect(response.status).toEqual(201);
  });
});
</code></pre>
<p>I expected it to returns a 201 response. I tried more routes and same as before.</p>
<p><img src=""https://i.stack.imgur.com/iUBey.png"" alt=""enter image description here"" /></p>
",https://stackoverflow.com/questions/73758195/e2e-testing-nestjs,"['nestjs', 'supertest']",854,True,-1,1
Generate type out of multiple objects in array,"<p>I want to make my End-to-End testing easier and typesafer, by collecting and transforming the data-attributes in a typed constant object.
However, I cannot make it work.</p>
<p>How can I create an union type out of an attribute value of multiple objects within an array?</p>
<pre><code>interface Itest {
  name: string
  values: readonly string[]
}

const testAttributes: readonly Itest[] = [
  {
    name: &quot;testid&quot;,
    values: [
      &quot;playbarQueueIcon&quot;,
      &quot;queueBar&quot;,
      &quot;playbarPlayButton&quot;,
      &quot;playbarPauseButton&quot;,
      &quot;playbarPreviousButton&quot;,
      &quot;playbarNextButton&quot;,
      // ...
    ] as const,
  } as const,
  {
    name: &quot;testgroup&quot;,
    values: [&quot;queueNextTracks&quot;, &quot;queuePreviousTracks&quot;] as const,
  } as const,
] as const

// ***********************
// Why does this not work?
// ***********************
type ITest = typeof testAttributes[number][&quot;values&quot;][number]


const attr = testAttributes.reduce((acc, {name, values}) =&gt; {
  for (const value of values) {
    acc[value] = `[data-${name}=${value}]`
  }

  return acc
}, {} as Record&lt;ITest, string&gt;
)

attr.queueBarXXXX // =&gt; Should not work
attr.queueBar // =&gt; Should work
</code></pre>
",https://stackoverflow.com/questions/71831169/generate-type-out-of-multiple-objects-in-array,['typescript'],176,True,1,1
TestCafe - Shared singleton between testcafe and application,"<p>I have an application running with <code>Vue</code>, and I am using <code>testcafe</code> to do end-to-end testing.</p>
<h2>MyModule.ts</h2>
<pre><code>class MyModule {
    public value: string;

    constructor() {}
}

export default new MyModule();
</code></pre>
<h2>Test cafe file</h2>
<pre><code>import MyModule from '../models/utils/MyModule';

fixture('Getting Started')
  .page('http://localhost:8080/en/home/')
  .before(async (ctx) =&gt; {
    MyModule.value = 'Set by Test Cafe';
  });

test('Get to the home page', async (t) =&gt; {
  ....
});
</code></pre>
<h2>App.vue</h2>
<pre><code>&lt;template&gt;.....&lt;/template&gt;
&lt;script&gt;
    import TeMyModulestModule from '@/test/e2e/models/utils/MyModule';
    export default {
    
        created() {
          console.log('MyModule.value', MyModule.value);
        }
    }
&lt;/script&gt;
</code></pre>
<h2>Actual result</h2>
<blockquote>
<p>MyModule.value undefined</p>
</blockquote>
<h2>Expected result</h2>
<blockquote>
<p>MyModule.value 'Set by Test Cafe'</p>
</blockquote>
<h2>Question</h2>
<p>Is it possible to achieve this with testCafe? If so what am I doing wrong?</p>
",https://stackoverflow.com/questions/70801582/testcafe-shared-singleton-between-testcafe-and-application,"['testing', 'automation', 'automated-tests', 'e2e-testing', 'testcafe']",74,True,0,1
This document requires &#39;TrustedHTML&#39; assignment,"<p>I am doing End-to-End testing using <strong>botium webdriverIO connector</strong> and getting the following error:</p>
<p><em><strong>&quot;...WebDriver error on UserSays: javascript error: Failed to set the 'innerHTML' property on 'Element': This document requires 'TrustedHTML' assignment.&quot;</strong></em></p>
<p>Did someone have such problem? How it can be fixed?</p>
<p>Thank you in advance.</p>
",https://stackoverflow.com/questions/70884060/this-document-requires-trustedhtml-assignment,"['javascript', 'html', 'bots', 'webdriver-io', 'botium-box']",1951,False,0,0
Is there a way to pause a test and let the user control mouse and keyboard in Playwright?,"<p>Using automated end-to-end testing tool <a href=""https://playwright.dev/"" rel=""nofollow noreferrer"">Playwright</a>, I want to pause a test, take over the mouse and type something on the screen or click on something, and then resume the test.</p>
<p>Is there a way to do this? Is there a Playwright command that lets me enter input?</p>
",https://stackoverflow.com/questions/73965384/is-there-a-way-to-pause-a-test-and-let-the-user-control-mouse-and-keyboard-in-pl,['playwright'],248,False,0,0
Automation tests passed in local but failed in Jenkins get Error: connect ECONNREFUSED 127.0.0.1:3000,"<p>In my project I am using React for frontend, Python/Django for backend and Cypress for end to end testing. Locally all the test cases passess. But when I push my code to github one of this test Fails  <code>name: Run tests</code>.</p>
<p>Below is the tests.yml file</p>
<p>tests.yml</p>
<pre><code>
name: Tests
on:
  push:
    branches:
      - '*'
      - '*/*'
      - '!master'
      - '!main'
jobs:
  tests:
    runs-on: ubuntu-20.04
    steps:
      - name: Fetch apiUrl
        run: echo ::set-output name=apiUrl::$(jq -r .env.apiUrl cypress.json)/ping
        id: fetchApiUrl
      - name: Ensure mochawesome
        run: 'jq -r &quot;.[\&quot;devDependencies\&quot;] |= (.mochawesome = \&quot;^6.2.2\&quot;)&quot; package.json &gt; package.json.tmp &amp;&amp; mv package.json.tmp package.json'
      - name: Install deps
        run: npm install
      - name: Update test reporter
        run: 'jq -M &quot;. + {\&quot;reporter\&quot;: \&quot;mochawesome\&quot;, \&quot;reporterOptions\&quot;: { \&quot;reportDir\&quot;: \&quot;cypress/results\&quot;, \&quot;overwrite\&quot;: false, \&quot;html\&quot;: false, \&quot;json\&quot;: true }}&quot; cypress.json &gt; cypress.json.tmp &amp;&amp; mv cypress.json.tmp cypress.json'
      - name: Run tests
        uses: cypress-io/github-action@v2
        with:
          build: npm run build
          start: npm run start
          wait-on: ${{ steps.fetchApiUrl.outputs.apiUrl }}
   
</code></pre>
<p>Below is cypress.json</p>
<pre><code>{
  &quot;baseUrl&quot;: &quot;http://localhost:3000&quot;,
  &quot;env&quot;: {
    &quot;apiUrl&quot;: &quot;http://localhost:3000/api&quot;
  }
}

</code></pre>
<p>I am getting below error</p>
<pre><code>&gt; echo build your fullstack app here

build your fullstack app here
start server &quot;npm run start command &quot;npm run start&quot;
current working directory &quot;/home/runner/work/transaction-management-fullstack-level-1_83d83d9-h61jhd-cihba8/transaction-management-fullstack-level-1_83d83d9-h61jhd-cihba8&quot;
waiting on &quot;http://localhost:3000/api/ping&quot; with timeout of 60 seconds
/usr/local/bin/npm run start

&gt; account-management-fullstack-level-1@0.0.1 start
&gt; echo start your fullstack app here

start your fullstack app here
http://localhost:3000/api/ping timed out on retry 91 of 3, elapsed 90258ms, limit 90000ms
Error: connect ECONNREFUSED 127.0.0.1:3000
</code></pre>
",https://stackoverflow.com/questions/71623613/automation-tests-passed-in-local-but-failed-in-jenkins-get-error-connect-econnr,"['jenkins', 'testing', 'automation', 'cypress']",687,False,0,1
How to replace strawberry shake websocket client?,"<p>I need to replace strawberry shake web socket client with asp .net test server one for end to end testing is it possible? I was able to replace http client which used for queries and mutations with test server one by registering <code>IHttpClientFactory</code> but I don't know how to do the same for web sockets.</p>
",https://stackoverflow.com/questions/71125729/how-to-replace-strawberry-shake-websocket-client,"['graphql', 'integration-testing', 'hotchocolate']",552,True,-1,1
Testing countdown timer with cypress,"<p>I have a web app that in one part of it a timer needs to count 1 minute. Now for doing the end to end testing I am using Cypress, In Cypress documentation I found cy.clock and cy.tick. The documentaion is vague to me. So which of these should I use for testing a countdown timer?</p>
",https://stackoverflow.com/questions/71975406/testing-countdown-timer-with-cypress,"['testing', 'cypress']",625,False,0,1
Azure pipeline : When and how to do end to end testing?,"<p>I have a react project and all the backend stuff is hosted as docker images.
I understand most of what azure pipelines are and i have set up a initial pipeline which does the following.
Installs nodes
Installs packages
Runs unit tests
Finalises and builds the project
Then publishes the artefact</p>
<p>This then continues to the release branch to deliver the artefact.</p>
<p>My question is, how and where would end to end testing fit in? Would it be in the initial pipeline or the release pipeline, additionally, how would this be done?. My confusion is that my application relies on a database, however if its running in a pipeline it will not have access to this. Using either puppeteer, or any other end to end testing library, I'm i meant to mimic a database, or can I run my docker instance within the pipeline for my backend services? If im completely missing the mark, please let me know as well.</p>
",https://stackoverflow.com/questions/71936170/azure-pipeline-when-and-how-to-do-end-to-end-testing,"['javascript', 'reactjs', 'azure-devops', 'end-to-end']",526,False,-1,1
Expo React Native Detox Testing,"<p>I have a Expo React Native where I need to do some end to end testing.</p>
<p>Im following this tutorial:</p>
<p><a href=""https://blog.expo.dev/testing-expo-apps-with-detox-and-react-native-testing-library-7fbdbb82ac87"" rel=""nofollow noreferrer"">https://blog.expo.dev/testing-expo-apps-with-detox-and-react-native-testing-library-7fbdbb82ac87</a></p>
<p>I need to install the following library:</p>
<pre><code>npm install --save-dev react-native-testing-library
</code></pre>
<p>And after I install it I get this message:</p>
<pre><code>npm WARN deprecated react-native-testing-library@6.0.0: 🚨 react-native-testing-library has moved to @testing-library/react-native. Please uninstall react-native-testing-library and install @testing-library/react-native instead, or use an older version of react-native-testing-library. Learn more about this change here: https://github.com/callstack/react-native-testing-library/issues/442. Thanks! :)
</code></pre>
<p>Does anyone how to use Detox with <code>@testing-library/react-native</code> or any link to a tutorial?</p>
<p>Thanks a lot</p>
",https://stackoverflow.com/questions/73324468/expo-react-native-detox-testing,"['react-native', 'expo']",112,False,0,0
How to perform playwright testing framework in NUXT?,"<p>Currently I want to perform end-to-end testing for my nuxt project. However , it keep stuck on the rendering side of NUXT project as shown in the image <a href=""https://i.stack.imgur.com/uY4mj.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/uY4mj.png"" alt=""enter image description here"" /></a>.</p>
<p>Previously , i was able to access the website with the same code. After i restart my computer , i cant access the website anymore and it stuck in the rendering side of NUXT project. Can anyone help me with this ?</p>
<p><code>browser.spec.ts</code></p>
<pre><code>import { resolve, join } from 'path'
import { test, expect } from '@playwright/test'

const ROOT_PATH = resolve(__dirname, '..', 'screenshots')

test('testing', async ({ page, baseURL }) =&gt; {
  // Nuxt app is running and route '/' is showing.
  await page.goto(baseURL + '/')

  // await expect(page.locator('h2').locator('text= meow')).toBeVisible()


  // Step 1 - Ensure It is in home page after login
  await page.screenshot({ path: join(ROOT_PATH, 'meow.png')})

})

</code></pre>
",https://stackoverflow.com/questions/72710372/how-to-perform-playwright-testing-framework-in-nuxt,"['html', 'typescript', 'nuxt.js', 'playwright']",270,False,0,0
How to test a transformation in Palantir Foundry?,"<p>We try to create a test function for the whole transformation.</p>
<pre class=""lang-py prettyprint-override""><code>import os
from transforms.verbs.testing.TransformRunner import TransformRunner
from transforms.api import Pipeline
from .myproject.datasets import my_transform

# This assumes your test data exists in the folder /test/fixtures/data/ within the repo next to this test
TEST_DATA_DIR = os.path.join(os.path.dirname(__file__), 'fixtures', 'data')

def test_my_transform(spark_session):
    pipeline = Pipeline()
    pipeline.add_transforms(my_transform)

    runner = TransformRunner(pipeline, '/my_fabulous_project', TEST_DATA_DIR)

    output = runner.build_dataset(spark_session, '/my_fabulous_project/output/test')
    assert output.first()['col_c'] == 3
</code></pre>
<p>Based on the documentation and <a href=""https://stackoverflow.com/questions/70570164/taking-full-input-dataset-when-testing-transformations-in-palantir-foundry#70765939"">this post</a>, we tried to modify the import of the function, but we always get one of these errors:</p>
<blockquote>
<p>transforms._errors.TransformTypeError: Expected arguments to be of type &lt;class 'transforms.api._transform.Transform'&gt;</p>
</blockquote>
<blockquote>
<p>ModuleNotFoundError: No module named 'test.myproject'</p>
</blockquote>
<blockquote>
<p>ValueError: attempted relative import beyond top-level package</p>
</blockquote>
<p>How to create a working end-to-end testing function for a transformation?</p>
",https://stackoverflow.com/questions/73218988/how-to-test-a-transformation-in-palantir-foundry,"['unit-testing', 'apache-spark', 'pyspark', 'palantir-foundry', 'foundry-code-repositories']",697,True,2,2
How to button clicked using playwright testing framework?,"<p>Currently , i am doing an end to end testing in my nuxt project. I want to test the frontend of my project to ensure the UI is presentable and clickable. However , I am facing a problem for my button. It felt like button is not clicked. I am pretty sure the css selector for my button is correctly defined as shown in here</p>
<p><img src=""https://i.stack.imgur.com/jKVwn.png"" alt=""Button Screenshot"" /></p>
<p>The screenshot shows that the button is hovered over or partially clicked. Is there any way to solve this issue ?</p>
<p><code>page.spec.ts</code></p>
<pre class=""lang-js prettyprint-override""><code>import { resolve, join } from 'path'
import { test, expect } from '@playwright/test'

const ROOT_PATH = resolve(__dirname, '..', 'screenshots')

test('job board test', async ({ page, baseURL }) =&gt; {
  await page.goto(baseURL + '/') // &lt;-- Nuxt app is running and route '/' is showing.
  const html = await page.innerHTML('body')
  console.log(html)
  await expect(page.locator('h2').locator('text= meow')).toBeVisible()
  await page.fill('text=User name', 'jeff');
  await page.fill('text= Password', 'jeff');

  await page.locator('.v-btn').click(); // button clicked

  // Step 1 - Is Homepage working
  await page.screenshot({ path: join(ROOT_PATH, 'detail.png') })

})
</code></pre>
",https://stackoverflow.com/questions/72708728/how-to-button-clicked-using-playwright-testing-framework,"['javascript', 'html', 'typescript', 'nuxt.js', 'playwright']",2653,True,2,1
How can you perform UI Testing without Using Mocks?,"<p>I have SwiftUI application and I need to test my user interface. The interface contains login view, where the button sends a request to the authentication service and get result back. Since, I am not using Mocks how can I test my interface. For the UI Test, I can switch to the test server but then I am very close to writing an end to end test.</p>
<p>Would it make sense to skip UI Tests and simply perform End to End testing with a real test server?</p>
",https://stackoverflow.com/questions/74704413/how-can-you-perform-ui-testing-without-using-mocks,"['ios', 'testing']",16,False,0,0
Jest test suites fail when executed in parallel but succeed when run individually,"<p>I'm using JestJS for end-to-end testing of my NestJS API</p>
<p>When I run all end-to-end tests (which are split up across many files, each file contains one test suite):</p>
<p>'npm run test:e2e'</p>
<p>Multiple tests are filing (different ones everytime).</p>
<p>When I run each test suite individually, the tests pass 100% of the time.</p>
<p>Here's one of my test files:</p>
<pre><code>describe('Cameras - /components/cameras (e2e)', () =&gt; {
const camerasRequest = {
  CameraSerialNumber: 1,
  Status: &quot;online&quot;,
};

const camerasResponse = {
  CameraSerialNumber: 1,
  Status: &quot;online&quot;,
};

let app: INestApplication;

beforeAll(async () =&gt; {
    const moduleFixture: TestingModule = await Test.createTestingModule({
        imports: [
          TypeOrmModule.forRoot({
            type: 'mysql',
            host: 'localhost',
            username: 'root',
            password: 'pass',
            database: 'test',
            autoLoadEntities: true,
            synchronize: false,
          }),
          CamerasModule,
        ],
        providers: [{
            provide: APP_FILTER,
            useClass: GlobalExceptionFilter,
        }],
    }).compile();

    app = moduleFixture.createNestApplication();
    await app.init();
});

describe(&quot;Response code: 200&quot;, () =&gt; {
  it('Delete one camera [DELETE /components/cameras/:id]', async () =&gt; {
    await request(app.getHttpServer())
      .post('/components/cameras')
      .send(camerasRequest as CreateCameraDto)

    await request(app.getHttpServer())
      .delete('/components/cameras/1')
      .expect(200)
      .then(({ body }) =&gt; {
        expect(body.affected).toStrictEqual(1);
      });

    await request(app.getHttpServer())
      .get('/components/cameras/1')
      .expect(200)
      .then(({ body }) =&gt; {
        expect(body).toStrictEqual({});
      });

    return
  });

  it('Delete one camera with unknown camera serial number [DELETE /components/cameras/:id]', async () =&gt; {
    await request(app.getHttpServer())
        .delete('/components/cameras/99')
        .expect(200)
        .then(({ body }) =&gt; {
          expect(body.affected).toStrictEqual(0)
        });

    return
  });
});

describe(&quot;Response code: 400&quot;, () =&gt; {
});

afterEach( async () =&gt; {
    await request(app.getHttpServer())
      .delete('/components/cameras/1');

    await request(app.getHttpServer())
      .delete('/components/cameras/2');
    return;
})
</code></pre>
<p>});</p>
<p>My guess is that the problem lies within the way Jest parallelizes the execution of my test suites... I can't find a fix for this. What can I do?</p>
",https://stackoverflow.com/questions/72793139/jest-test-suites-fail-when-executed-in-parallel-but-succeed-when-run-individuall,"['jestjs', 'nestjs']",515,False,2,0
Cypress login with google account don&#39;t work when i run my tests,"<p>I am using cypress for end-to-end testing. I have to login to the app using google account.
I follow documentation of Cypress to use the third-party authentication API to login with google account. all works fine when I do cypress open to excute my scrpit but have trouble and my test fail when i do cypress run . I cannot access google's login form with cypress google doesn't allow bot to login.
Please help me with this</p>
<p>To login with google account i use :</p>
<pre><code>Cypress.Commands.add(&quot;loginByGoogleApi&quot;, () =&gt; {

 
    cy.request({
        method: &quot;POST&quot;,
        url: &quot;https://www.googleapis.com/oauth2/v4/token&quot;,
        body: {
            grant_type: &quot;refresh_token&quot;,
            client_id: Cypress.env(&quot;client_id&quot;),
            client_secret: Cypress.env(&quot;client_secret&quot;),
            refresh_token: Cypress.env(&quot;refresh_token&quot;),
        },
    }).then(({ body }) =&gt; {
        const { access_token, id_token } = body;

        cy.request({
            method: &quot;GET&quot;,
            url: &quot;https://www.googleapis.com/oauth2/v3/userinfo&quot;,
            headers: { Authorization: `Bearer ${access_token}` },
        }).then(({ body }) =&gt; {
            cy.log(body);
            const userItem = {
                token: id_token,
                user: {
                    googleId: body.sub,
                    email: body.email,
                    givenName: body.given_name,
                    familyName: body.family_name,
                    imageUrl: body.picture,
                },
            };

            window.localStorage.setItem(&quot;googleCypress&quot;, JSON.stringify(userItem));
        });
    });
});
</code></pre>
<p>I get this error when I do cypress run</p>
<p><a href=""https://i.stack.imgur.com/868CX.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/868CX.png"" alt=""enter image description here"" /></a></p>
",https://stackoverflow.com/questions/72055585/cypress-login-with-google-account-dont-work-when-i-run-my-tests,"['google-oauth', 'cypress']",528,False,0,0
Selenium Javascript - Headless mode record video,"<p>I use <code>selenium</code> in javascript along with <code>jest</code> to do some end-to-end testing of an application. Eventually those tests runs in <code>headless</code> mode on <code>Azure Pipelines</code></p>
<p>To help debugging, I would like to have a video record in case a test fails. I could not find any package which would work with <code>jest</code> and <code>selenium</code>.</p>
<p>I already managed to upload a screenshot in case of failure so I have <code>takeScreenshot</code> working.</p>
<p>For the video, I wanted to try to take a picture every second before &quot;compiling&quot; it with <code>ffpmeg</code> but I have a memory issue.</p>
<p><code>FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory</code></p>
<p>Am I on the right track?</p>
<pre><code>public async startRecording() {
    this.recording = true;
    let count = 1;
    let interval;
    while (this.recording) {
      interval = setInterval(async () =&gt; {
        await this.takeScreenshot(`test_${count}`);
        count += 1;
      }, 1000);
    }
    clearInterval(interval);
  }

  public stopRecording() {
    this.recording = false;
  }
</code></pre>
",https://stackoverflow.com/questions/73723862/selenium-javascript-headless-mode-record-video,['selenium-webdriver'],18,False,0,0
Access not given while integrating cypress dashboard with bitbucket,"<p>I tried integrating cypress dashboard with bitbucket and when i click the button below</p>
<p><img src=""https://i.stack.imgur.com/Q7aOD.png"" alt=""1"" /></p>
<p>It redirects me to this page instead of linking it up with the bitbucket even though i have right and correct access to the bitbucket.</p>
<p><img src=""https://i.stack.imgur.com/PyUWm.png"" alt=""2"" /></p>
<p>Just to be sure, I tried creating new project in cypress dashboard and integrate it with bitbucket as an owner of the repo but still I face the same issue.</p>
<p>PS: I was trying to implement parallelization for end to end testing integrating cypress dashboard with bitbucket.</p>
<p>Can you guys please help me out. Been stuck to this for days now.</p>
",https://stackoverflow.com/questions/74860322/access-not-given-while-integrating-cypress-dashboard-with-bitbucket,"['testing', 'cypress', 'bitbucket', 'e2e-testing', 'dashboard']",21,False,0,0
docker-compose wait for certain service to exit for e2e testing,"<p>I am trying to establish end-to-end testing with docker-compose.</p>
<p>For E2E tests I need several services:</p>
<pre><code>version: &quot;3.4&quot;
services:
  service1:
  service2:
  main_service:
    depends_on:
      - service1
</code></pre>
<p>main_service is not a daemon, it starts, do the staff, and ends.</p>
<p>So I would like all other services to live as long as main_service is alive.
I was trying this way:</p>
<pre><code>docker-compose up --exit-code-from=main_service
</code></pre>
<p>And it works, except one point :</p>
<p>service2 is also not a daemon and exists after 2 or 3 seconds.
And docker-compose with  <code>--exit-code-from=main_service</code> stops all services not when <code>main_service</code> is finished, but when <code>service2</code> is finished.</p>
<p>How can I stop all services when <code>main_service</code> is finished, but not any of them?</p>
",https://stackoverflow.com/questions/72964735/docker-compose-wait-for-certain-service-to-exit-for-e2e-testing,"['docker', 'docker-compose']",81,False,0,0
Prisma is opening too many connections with PostgrsQL when running Jest end to end testing,"<p>I'm trying here to do end to end testing with Jest on a NestJS/GraphQL app and Prisma as my ORM.</p>
<p>What happens here is Prisma is opening too many connections with Postgres, I've tried to fix this problem by using prisma.$disconnect() after each test but it doesn't seem to work...</p>
<p>This is what I've tried so far.</p>
<pre><code>import { PrismaService } from '../src/prisma.service';

describe('Users', () =&gt; {
  let app: INestApplication;
  const gql = '/graphql';
  let prisma;

  beforeEach(async () =&gt; {
    prisma = new PrismaService();

    const moduleFixture: TestingModule = await Test.createTestingModule({
      imports: [AppModule],
    }).compile();

    app = moduleFixture.createNestApplication();
    await app.init();
  });

  afterEach(async () =&gt; {
    await prisma.$disconnect();
  });

  it('Query - Users', async () =&gt; {
    //Using prisma to query database
  });
});
</code></pre>
<p>My Prisma service (I got it from NestJS documentation <a href=""https://docs.nestjs.com/recipes/prisma#use-prisma-client-in-your-nestjs-services"" rel=""nofollow noreferrer"" title=""documentation"">Text</a> ):</p>
<pre><code>import { INestApplication, Injectable, OnModuleInit } from '@nestjs/common';
import { PrismaClient } from '@prisma/client';

@Injectable()
export class PrismaService extends PrismaClient implements OnModuleInit {
  async onModuleInit() {
    await this.$connect();
  }

  async enableShutdownHooks(app: INestApplication) {
    this.$on('beforeExit', async () =&gt; {
      await app.close();
    });
  }
}
</code></pre>
<p>These are the errors I'm getting after running all the tests (serially):</p>
<p><a href=""https://i.stack.imgur.com/nloMQ.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/nloMQ.png"" alt=""enter image description here"" /></a></p>
<p>I've already looked through Prisma documentation but didn't find anything about how to setup properly a Jest environment with NestJS and Prisma.</p>
<p>Thanks for your help !</p>
",https://stackoverflow.com/questions/71259682/prisma-is-opening-too-many-connections-with-postgrsql-when-running-jest-end-to-e,"['jestjs', 'nestjs', 'prisma']",3171,True,3,1
How to use IdlingResource for Jetpack Compose,"<p>I understand how to use the EspressoIdle resource for my purposes. But what about Compose? It is said that it could be done the same as with the espresso idling resource (<a href=""https://developer.android.com/jetpack/compose/testing#idling-resources"" rel=""nofollow noreferrer"">https://developer.android.com/jetpack/compose/testing#idling-resources</a>). Unfortunately, I can't find any example of that.
I want to skip any Loading state before making an assertion, but I can't figure out how it could be done. For exclusive tests, I can easily pass a certain state, but for end-to-end testing with the mock server, I need to use something like an idling resource.
Does anyone have any ideas on how it could be implemented?</p>
",https://stackoverflow.com/questions/71398616/how-to-use-idlingresource-for-jetpack-compose,"['android', 'testing', 'synchronization', 'android-jetpack-compose']",464,False,1,0
Cypress can&#39;t detect any elements on a particular site,"<p>I've started using Cypress (v10.2.0) as an end to end testing framework and wanted to try out logging onto a banking site and filling the input fields.</p>
<p>However, when my Cypress opens <a href=""https://www.anytimebanking.ulsterbank.co.uk"" rel=""nofollow noreferrer"">https://www.anytimebanking.ulsterbank.co.uk</a> with either Chrome (v102) or Edge (v102), it can't seem to find any site elements, the playground doesn't work and in addition throws a bunch of extension errors:</p>
<p><a href=""https://i.stack.imgur.com/hefbh.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/hefbh.png"" alt=""enter image description here"" /></a></p>
<p>I am not sure why this is happening as all the other sites I've tried work as expected, can find the page body and any other elements and don't throw any console errors.</p>
<p>Any help would be appreciated, cheers!</p>
<p>Spec file is as follows:</p>
<pre><code>describe('Online Banking spec', () =&gt; {
  it('opens the site', () =&gt; {
    cy.visit('https://www.anytimebanking.ulsterbank.co.uk')
  })
})
</code></pre>
",https://stackoverflow.com/questions/72730822/cypress-cant-detect-any-elements-on-a-particular-site,"['javascript', 'testing', 'cypress', 'e2e-testing']",337,True,1,1
ReferenceError: Request is not defined - during E2E testing NestJS project,"<p>I have a NestJsS project with a lot of controllers and I want to test it with Supertest as described here: <a href=""https://docs.nestjs.com/fundamentals/testing#end-to-end-testing"" rel=""nofollow noreferrer"">https://docs.nestjs.com/fundamentals/testing#end-to-end-testing</a></p>
<p>But if I create a controller that has a method where I inject request with Req() I get this error:</p>
<pre><code> FAIL  test/app.e2e-spec.ts
 Test suite failed to run

ReferenceError: Request is not defined

   5 | export class AuthController {
   6 |   @Get()
&gt;  7 |   getAll(@Req() request: Request) {
     |                          ^
   8 |     console.log('### AuthController.getAll()');
   9 |   }
  10 |

  at Object.&lt;anonymous&gt; (../src/auth/auth.controller.ts:7:26)
  at Object.&lt;anonymous&gt; (../src/auth/auth.module.ts:2:1)
</code></pre>
<p>You can simply reproduce this issue if you create a new project, then try to run E2E test with</p>
<pre><code>yarn test:e2e
</code></pre>
<p>First, it works, but if you create any controller which has a method with @Req() parameter, you get the error above.</p>
<p>Why? How can I fix it?</p>
<p>I thought Nest solved this issue, documentation wrote this:
&quot;Nest makes it easy to use the Supertest library to simulate HTTP requests.&quot;</p>
",https://stackoverflow.com/questions/74709850/referenceerror-request-is-not-defined-during-e2e-testing-nestjs-project,"['nestjs', 'e2e-testing', 'supertest']",647,True,1,1
How would one create different environments in Commercetools?,"<p>I am trying to set up Commercetools with a CI/CD pipeline. It is my first time working with microservices and cloud architectures.</p>
<p>With a monolithic code base you can have development, QA and production environments - how would one go about this with Commercetools? Would you setup two/three projects? Should the projects share the same microservices or would you set up multiple of those as well? If not, then I suppose you would do end-to-end testing on production, that can't be right?</p>
<p><em>I am not interested in how to setup microservices, I am interested in how to set up the project that performs changes to the Commercetools API.</em></p>
<p>Thanks for any help.</p>
",https://stackoverflow.com/questions/72123454/how-would-one-create-different-environments-in-commercetools,"['cloud', 'microservices', 'cicd', 'commercetools']",137,False,0,1
NestJS returns buffer instead of JSON in e2e,"<p>While e2e testing with jest/supertest the body returned from my app seems to be a buffer rather than just JSON.</p>
<p>The test module:</p>
<pre><code>const testingModule = await Test.createTestingModule({
  imports: [AppModule],
}).compile();

const app = testingModule.createNestApplication();

app.useGlobalPipes(
  new ValidationPipe({
    whitelist: true,
    forbidNonWhitelisted: true,
  }),
);

await app.init();
server = app.getHttpServer();
</code></pre>
<p>In the test I expect the <code>ValidationPipe</code> to throw an error about the password being too short:</p>
<pre><code>const res = request(server)
  .post(path)
  .accept('application/json')
  .responseType('application/json')
  .set('Authorization', `Bearer ${token}`)
  .send({
    email: 'abc@abc.abc',
    displayName: 'Abc',
    password: 'abc'
  });

res.expect({error: 'Bad Request'}); // fails with expected { error: 'Bad Request' } response body, got &lt;Buffer 7b 22 73 74...
</code></pre>
<p>The endpoint is:</p>
<pre><code>@Post()
@UseGuards(AnonymousGuard)
@ApiBearerAuth('Firebase JWT')
@ApiCreatedResponse({ description: 'Success' })
@ApiUnauthorizedResponse({ description: 'Authorization failed' })
@ApiConflictResponse({ description: 'User exists' })
@ApiBadRequestResponse({ description: 'Malformed request' })
createUser(@Body() body: CreateUserBody) {
  throw new HttpException('not implemented', HttpStatus.NOT_IMPLEMENTED);
}
</code></pre>
<p>And the validation in:</p>
<pre><code>export class CreateUserBody {
  @IsEmail()
  @ApiProperty()
  email: string;

  @IsString()
  @MinLength(2)
  @MaxLength(30)
  @ApiProperty()
  displayName: string;

  @IsString()
  @MinLength(8)
  @ApiProperty()
  password: string;
}
</code></pre>
<p>The problem is that the test response doesn't contain JSON but rather a buffer:</p>
<pre><code>console.log(res.body);             // &lt;Buffer 7b 22 73 74 61 74 75...
console.log(JSON.parse(res.body)); // { error: &quot;Bad request&quot;,
    message: [ 'password must be longer...
</code></pre>
<p>I do not use any interceptors but some middleware I've got is async – could this be a problem?</p>
<p>I can get away with parsing the body, but every example on the internet seems to just use <code>req.body</code> (e.g. <a href=""https://docs.nestjs.com/fundamentals/testing#end-to-end-testing"" rel=""nofollow noreferrer"">https://docs.nestjs.com/fundamentals/testing#end-to-end-testing</a>) while I can't seem to be able to and I'm not sure what could cause that.</p>
",https://stackoverflow.com/questions/73443902/nestjs-returns-buffer-instead-of-json-in-e2e,"['json', 'jestjs', 'nestjs', 'supertest']",54,True,0,1
Electron - Need unit testing framework for bundled app,"<p>we are using electron framework to create <strong>WINDOWS</strong> and <strong>MAC</strong> installer. For frontend, we are using Angular to show data.
We are also using <strong>sqlite3</strong> database to store data locally in user's system using node.js.</p>
<p>Everything working fine like api calling using <strong>AXIOS</strong>, intercating with our local database(CRUD), intercating with client side(frontend) with <strong>electron-ipc-renderer</strong>, file system handling.
Our application is working properly as expected.</p>
<p>We are stuck with unit testing of our application.</p>
<p>We want to do end to end testing which will consume electrons basic libraries like:-</p>
<ul>
<li><strong>app</strong></li>
<li><strong>BrowserWindow</strong></li>
<li><strong>dialog</strong></li>
<li><strong>Menu</strong></li>
<li><strong>remote</strong></li>
<li><strong>screen</strong></li>
<li><strong>ipcMain</strong></li>
</ul>
<p>And we are using other node libraries also like <strong>axios, path, chokidar, sqlite3</strong>.</p>
<p>Has anyone achieved Unit test cases for such kind Electron App/knows anything which can help us?</p>
",https://stackoverflow.com/questions/74949787/electron-need-unit-testing-framework-for-bundled-app,"['node.js', 'unit-testing', 'electron', 'electron-builder', 'testcase']",56,False,3,0
Cypress can&#39;t find data-testid,"<p>I am new to end to end testing and using Cypress for the first time . I have an application, made with Nextjs &amp; Material UI in which I want to write a test for a profile page. I have the following test to check whether username is shown or not:</p>
<pre><code>it(&quot;Username&quot;,()=&gt;{
        cy.wait(10000)
        cy.get('[data-testid=&quot;username&quot;]',{withinSubject:null}).should('exit'); // getting error on this command.
        cy.contains('@').should('exit')
      })
</code></pre>
<p>But Cypress is not able to find the <code>data-testid=&quot;username&quot;</code> even I have set the <code>data-testid=&quot;username&quot;</code> to the component which will show the username:</p>
<pre><code>{loading ? (
                &lt;Skeleton variant=&quot;text&quot; width={100} animation=&quot;wave&quot; /&gt;
              ) : (
                &lt;span className=&quot;text-sm text-grey-normal&quot; data-testid=&quot;username&quot;&gt;
                  @{userInfo?.get(&quot;spectUsername&quot;)}
                &lt;/span&gt;
              )}
</code></pre>
<p>I have also tried the method included in this <a href=""https://github.com/cypress-io/cypress/issues/14566"" rel=""nofollow noreferrer"">issue</a> to solve the problem but this also don't work for me. I have searched a lot about this issue but can't find a working solution . What I am doing wrong ? How to make it work ? Is there any module I am forgetting to import to make this working ?</p>
",https://stackoverflow.com/questions/70957143/cypress-cant-find-data-testid,"['reactjs', 'testing', 'cypress', 'end-to-end']",5076,True,3,1
Calling cypress-firebase&#39;s cy.login() does not result in logged-in user,"<p>I am using Cypress for end-to-end testing an application, together with the <a href=""https://github.com/prescottprue/cypress-firebase"" rel=""nofollow noreferrer""><code>cypress-firebase</code></a> package. I followed the official setup instructions (using TypeScript, and the Firebase Web SDK version 9 with the <code>compat</code> mode).</p>
<p>In my tests, calling <code>cy.login()</code> seems to work as expected in that Cypress logs that the <code>createCustomToken</code> task successfully performs two HTTP <code>POST</code>s with status code 200 each.</p>
<p>However, when visiting a page of the application afterwards, no user is logged in. In the application, the login status is supposed to be detected using Firebase's <code>onAuthStateChanged</code> function. It seems that <code>cy.login()</code> never triggers <code>onAuthStateChanged</code>, though.</p>
<p>My best guess is that maybe the <code>auth</code> instances used by <code>cypress-firebase</code> and the application code are not the same?! Is there a way to confirm this, or could there be another reason?</p>
<p>Happy to provide further information if it may help.</p>
",https://stackoverflow.com/questions/71942582/calling-cypress-firebases-cy-login-does-not-result-in-logged-in-user,"['firebase', 'firebase-authentication', 'cypress']",541,True,0,1
"How to easily debug flutter end-to-end tests, such as time traveling, action logs, and screenshots?","<p>When doing end-to-end testing for Flutter, I find it very inconvenient to debug them. For example, for an e2e test that taps, drags, and asserts a ton of things, when it fails, I cannot know easily what indeed causes the failure. It may be caused by misbehavior that happens 10 steps ago.</p>
<p>Thus, I hope I can have the well-known time traveling functionality for Flutter tests (or, action logs, or screenshots for every step). In other words, with a button tap I can see &quot;what did the UI look like when that button was tapped 50 steps ago?&quot; Then I can go through the history and easily spot what goes wrong.</p>
<p>Is it possible to implement it? Can I integrate it into <code>integration_test</code>-based tests or do I have to create a brand new framework?</p>
",https://stackoverflow.com/questions/72338575/how-to-easily-debug-flutter-end-to-end-tests-such-as-time-traveling-action-log,"['flutter', 'dart', 'testing', 'e2e-testing']",467,True,1,1
End-to-end testing of Static Web App behind EasyAuth?,"<p>I have an Angular webapp hosted in Static Web Apps and running behind EasyAuth with an AAD provider. I'm looking for suggestions and best practices as to how to do end-to-end testing as I'm struggling with the authentication. I want to setup a Playwright project to do the testing but I cannot log in using the normal login flow as I don't want to rely on a test-user and password (also because of MFA). My thinking was to authenticate using a managed identity of some sort but this is where I run into issues.</p>
<p>I can see that the EasyAuth uses the <code>StaticWebAppsAuthCookie</code> but is there any way to retrieve that programmatically without following the normal auth flow and using a managed identity? Or is this the wrong approach and if so what would be a best practise?</p>
",https://stackoverflow.com/questions/71996086/end-to-end-testing-of-static-web-app-behind-easyauth,"['azure', 'testing', 'azure-static-web-app']",116,False,1,0
How to receive any information from Windows Sandbox when run from terminal or script,"<p>I'm working on automating an end-to-end testing process for my desktop app.</p>
<p>I have prepared a script that opens the sandbox, installs all dependencies, runs tests and everything, but after testing is done, my script doesn't know when to terminate the task, as sandbox process is not sending any information back to the host.</p>
<p>Even when If I shut down a remote machine, it doesn't terminate my process on the host as there is a popup that says &quot;Windows Sandbox is shutting down and will be closed&quot; and requires me to click OK button manually</p>
<p>My question is - Is there a way to communicate somehow with the sandbox, to send any signal back, so that I can force shutdown it when tests are done OR is there a way to close the sandbox without this popup?</p>
<p>Thanks</p>
",https://stackoverflow.com/questions/74655042/how-to-receive-any-information-from-windows-sandbox-when-run-from-terminal-or-sc,"['windows', 'powershell', 'windows-sandbox']",40,False,0,1
Jest test completing before promise has resolved,"<p>This is my first post on stackoverflow so please be gentle...</p>
<p>I am trying to use Jest to do some end-to-end testing of a function that communicates with a smart contract deployed on a local development blockchain.</p>
<p>The issues I'm having probably stem from my lack of thourough understanding of how promises and the event loop work, but the test completes, before the stake function completes.</p>
<p>Here is the test:</p>
<pre><code>test('stake', async () =&gt; {
        
        let tokenId;
        
        // test set up - make sure the address owns at least 1 NFT
        const currentBalance = (await nftContract.balanceOf(address)).toNumber();
        if (currentBalance &gt; 0) {
            tokenId = (await stakingContractAddress.tokenOfOwnerByIndex(address, 0)).toNumber();
        } else {
            // if address owns no NFTs, mint one
            await mint(address)
        }
        
        // pre stake
        const addressBalance = (await nftContract.balanceOf(address)).toNumber();
        const stakedBalance = (await stakingContractAddress.numStaked(address)).toNumber();

        console.log(`addressBalance: ${addressBalance}`) // should be 1
        console.log(`stakedBalance: ${stakedBalance}`) // should be 0
        
        // stake
        await stake(tokenId, address); // I want this to fully complete before moving on.

        // post stake
        const newAddressBalance = (await nftContract.balanceOf(address)).toNumber();
        const newStakedBalance = (await stakingContractAddress.numStaked(address)).toNumber();

        console.log(`newAddressBalance: ${newAddressBalance}`) // should be 0 but is still 1
        console.log(`newStakedBalance: ${newStakedBalance}`) // should be 1 but is stil 0
        
        expect(newStakedBalance).toEqual(addressBalance);
        expect(newAddressBalance).toEqual(stakedBalance);

    });
</code></pre>
<p>Here is the stake function:</p>
<pre><code>async function stake(tokenId, _address) {
    try {
        const tx = await nftContract['safeTransferFrom(address,address,uint256,bytes)'](
            _address, // from
            stakingContractAddress, // to
            tokenId,
            gas_price
        );
        await tx.wait(); // this is meant to wait until the transaction is mined on-chain
    } catch (err) {
        logger.info({message: err});
        process.exit(1);
    }
}
</code></pre>
<p>I have tried adding in at deliberate wait (below) right after the stake function is called in the test. But this has no effect. It also felt like it shouldn't be needed, as the transaction with the local blockchain should complete instantly.</p>
<pre><code>function wait(ms){
    console.log(`waiting ${ms /1000} seconds`)
    var start = new Date().getTime();
    var end = start;
    while(end &lt; start + ms) {
      end = new Date().getTime();
   }
 }
</code></pre>
<p>I've spent so much time trying to find a solution to this already with no luck.</p>
<p>Any help would be greatly appreciated!</p>
",https://stackoverflow.com/questions/71229240/jest-test-completing-before-promise-has-resolved,"['javascript', 'testing', 'promise', 'solidity', 'ethers.js']",831,True,0,1
How to properly handle lots of (format) constants in Python?,"<p>I am setting up an end-to-end testing framework with Selenium in Python. In order to click on DOM elements I have to define a lot of locators (like XPaths, CSS-selectors etc.) which are mostly constant.</p>
<p>However, there are some constants that vary in each run, so some content needs to be formatted in at runtime.</p>
<p>At the moment I have a basic <code>locators.py</code> file which organizes all of the constants in a view-corresponding way like this:</p>
<pre class=""lang-py prettyprint-override""><code>class Locators:

    class LoginPage:
        USERNAME_INPUT = &quot;//input[@id='username']&quot;
        PASSWORD_INPUT = &quot;//input[@id='password']&quot;
        LOGIN_BUTTON = &quot;//button[text()='Login']&quot;
        # ...
    
    class Homepage:
        ACTION_BUTTON = lambda t: f&quot;//buton[text()='{t}']&quot;
        # ...

# ...
</code></pre>
<p>This can then be used like this:</p>
<pre class=""lang-py prettyprint-override""><code>from locators import Locators

browser.click(Locators.LoginPage.USERNAME_INPUT)
browser.click(Locators.Homepage.ACTION_BUTTON(var))
</code></pre>
<p>The last example here (<code>ACTION_BUTTON</code>) is of most interest to me. Since e.g. PyCharm displays a PEP 8 warning that using lambdas is discouraged I wonder whether there is a more elegant way of handling such &quot;formattable&quot; constants?</p>
<p>Furthermore, I would like to be able to generalize e.g. all buttons to the outer class like this:</p>
<pre class=""lang-py prettyprint-override""><code>class Locators:

    _BUTTON = lambda s: f&quot;//button[text()='{s}']&quot;

    class LoginPage:
        USERNAME_INPUT = &quot;//input[@id='username']&quot;
        PASSWORD_INPUT = &quot;//input[@id='password']&quot;
        LOGIN_BUTTON = _BUTTON(&quot;Login&quot;)

    class Homepage:
        ACTION_BUTTON = _BUTTON
</code></pre>
<p>But this gives a syntax error.</p>
",https://stackoverflow.com/questions/71313938/how-to-properly-handle-lots-of-format-constants-in-python,"['python', 'python-3.x', 'selenium', 'pycharm', 'automated-tests']",38,False,1,2
Cypress cy.visit() is not redirecting to correct URL,"<p>I am trying to bypass the UI login by using cy.request() to log a user in and cy.visit() to go to the restricted route. I have followed this doc: <a href=""https://docs.cypress.io/guides/end-to-end-testing/testing-your-app#Bypassing-your-UI"" rel=""nofollow noreferrer"">https://docs.cypress.io/guides/end-to-end-testing/testing-your-app#Bypassing-your-UI</a></p>
<p>However, the test fails because the visit URL ('http://localhost:3000/join-or-create') is not loaded and instead the home page URL is loaded (http://localhost:3000/).</p>
<p>This is my test code:</p>
<pre><code>describe('when user is signed in but has not joined a group', () =&gt; {
  beforeEach(() =&gt; {
    cy.request('POST', 'http://localhost:5000/api/testing/reset');
    const user = {
      name: 'Joe Bloggs',
      email: 'Joe@Bloggs.com',
      password: 'Password',
    };
    cy.request('POST', 'http://localhost:5000/register', user);
    cy.request('POST', 'http://localhost:5000/sign-in', user);
    cy.visit('http://localhost:3000/join-or-create');
  });

  it.only('should allow a logged in user to join or create a group', () =&gt; {
    cy.contains('Join a group');
    cy.contains('Create a group');
  });
});
</code></pre>
<p>If I change cy.contains('Join a group'); to cy.contains('Welcome'); (which is content on the URL 'http://localhost:3000/') then the test passes.</p>
<p>If I use:</p>
<pre><code>cy.visit('http://localhost:3000');
cy.get('[data-testid=&quot;email&quot;]').type('Joe@Bloggs.com');
cy.get('[data-testid=&quot;password&quot;]').type('Password');
cy.contains('sign in').click();
</code></pre>
<p>instead of cy.visit('http://localhost:3000/join-or-create'); the test passes.</p>
<p>The output of the test body shows that is redirecting to a new URL 'http://localhost:3000/' (as shown in the screenshot below) but I can't figure out why.</p>
<p><a href=""https://i.stack.imgur.com/hbGmT.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/hbGmT.png"" alt=""enter image description here"" /></a></p>
<p>Thanks for any help.</p>
",https://stackoverflow.com/questions/73477041/cypress-cy-visit-is-not-redirecting-to-correct-url,"['cypress', 'e2e-testing']",857,True,1,1
Postman test script - how to call an api twice to simulate 409 error,"<p>I am trying to run a few automated testing using the Postman tool.  For regular scenarios, I understand how to write pre-test and test scripts.  What I do not know (and trying to understand) is, how to write scripts for checking 409 error (let us call it duplicate resource check).</p>
<p>I want to run a create resource api like below, then run it again and ensure that the 2nd invocation really returns 409 error.</p>
<pre><code>POST  /myservice/books
</code></pre>
<p>Is there a way to run the same api twice and check the return value for 2nd invocation. If yes, how do I do that.  One crude way of achieving this could be to create a dependency between two tests, where the first one creates a resource, and the second one uses the same payload once again to create the same resource.  I am looking for a single test to do an end-to-end testing.</p>
",https://stackoverflow.com/questions/74839231/postman-test-script-how-to-call-an-api-twice-to-simulate-409-error,"['postman', 'postman-collection-runner', 'postman-pre-request-script', 'postman-testcase']",342,False,0,2
Best way to mock authenticated (auth0) API calls in Cypress,"<p>I have a regular single page application (Vue), which authenticate via auth0 and generates a token which is validated by the backend on API calls.</p>
<p>I would like to test the vue application using cypress.</p>
<p>There are various &quot;official&quot; strategies (i.e. log in for every call or using a session and logging in once).</p>
<p><a href=""https://auth0.com/blog/end-to-end-testing-with-cypress-and-auth0/"" rel=""nofollow noreferrer"">https://auth0.com/blog/end-to-end-testing-with-cypress-and-auth0/</a>
<a href=""https://docs.cypress.io/guides/testing-strategies/auth0-authentication"" rel=""nofollow noreferrer"">https://docs.cypress.io/guides/testing-strategies/auth0-authentication</a></p>
<p>I could find only one resource about stubbing the auth0, instead of actually sending requests for tokens - <a href=""https://github.com/auth0/auth0-spa-js/issues/210"" rel=""nofollow noreferrer"">https://github.com/auth0/auth0-spa-js/issues/210</a> .</p>
<p>I reached the above link by following another Stackoverflow post - <a href=""https://stackoverflow.com/questions/59664721/how-to-test-single-page-application-with-cypress-and-auth0"">How to test single page application with Cypress and Auth0</a> .</p>
<p>I have only little experience, but the stubbing solution seems closer to the best practices of test driven development.</p>
<p>I wanted to ask why it seems much less popular and if I miss the actual reasons behind the &quot;actual auth0 call&quot; options.</p>
<p>Thank you!</p>
",https://stackoverflow.com/questions/71084972/best-way-to-mock-authenticated-auth0-api-calls-in-cypress,"['cypress', 'auth0']",1579,True,2,1
How do I resolve conflicting assertion types in Angular?,"<p>I am developing an Angular application that uses the Jasmine framework for regular unit testing and the Cypress framework for end-to-end testing.</p>
<p>While I have had no trouble conducting my E2E tests with Cypress, the <code>spec.</code> files used with Jasmine inside my source code folder <code>src</code> all underline the <code>toBe</code> method calls in red and display the following error message:</p>
<p><code>TS2339: Property 'toBe' does not exist on type 'Assertion'</code></p>
<p>A code sample for one my tests is displayed below:</p>
<pre><code>it('Should have a category of \'A\'', () =&gt; {(
    expect(category.category).toBe('A');
})
</code></pre>
<p>After doing research, I have discovered that the problem is due to both frameworks using the same assertion library. I have tried applying solutions from the following two posts but neither have worked.</p>
<ul>
<li><p><a href=""https://stackoverflow.com/questions/58999086/cypress-causing-type-errors-in-jest-assertions"">Cypress causing type errors in jest assertions</a></p>
</li>
<li><p><a href=""https://stackoverflow.com/questions/69291905/how-do-i-resolve-conflicting-type-identifiers-for-cypress-and-jquery"">How do I resolve conflicting type identifiers for Cypress and jQuery?</a></p>
</li>
</ul>
<p>Both solutions suggest editing one or more of the <code>tsconfigjson</code> files, though since I have started to use Cypress at version 10 and above, the <code>cypress</code> root folder has not come with its own config file.</p>
",https://stackoverflow.com/questions/74851654/how-do-i-resolve-conflicting-assertion-types-in-angular,"['angular', 'jasmine', 'cypress', 'assertion']",120,False,2,0
Cypress Inserting an already authenticated token,"<p>I have an application to test that requires MFA. I am trying to get my UI tests through Cypress to hit the application already authenticated.</p>
<p>I've seen a few posts about setting up a new Cypress command to handle logging in where it sends auth details to the 3rd party, gets the details back and puts this into local storage using something like <code>cy.setLocalStorage</code>.</p>
<p>But I already have an external method that I use for my API tests where it grabs me a valid Bearer token. This works fine for API calls on the application. So I'm wondering, is there a place I can simply insert this valid token for my UI tests with Cypress or do I need to go the kind of way as defined in the linked article below where I build a <code>cy.login()</code> command?</p>
<p>Edit: Should add that we actually have a service principal account for the API calls to bypass MFA.</p>
<p><a href=""https://auth0.com/blog/end-to-end-testing-with-cypress-and-auth0/"" rel=""nofollow noreferrer"">https://auth0.com/blog/end-to-end-testing-with-cypress-and-auth0/</a></p>
",https://stackoverflow.com/questions/70966212/cypress-inserting-an-already-authenticated-token,"['authentication', 'automated-tests', 'local-storage', 'cypress']",2601,True,2,2
Why is my if statement within an it block getting ignored?,"<p>I am using JavaScript, Appium, Mocha, and Webdriver.io to do end to end testing on an android application. I am trying to create an if statement for &quot;if this button is on the screen then press it, if not press this button&quot;. For some reason it completely ignores the if statement and just reads it like it is a normal line of code.</p>
<p>Here are my page objects:</p>
<pre><code>class createACompanyFirstTimeBtn {
    // For the first time
    get createNewCompanyBtn(){
        return $('id=com.truckpay.truckpay:id/btn_create');
    }
    // All times after
    get createAnotherNewCompanyBtn(){
        return $('id=com.truckpay.truckpay:id/btn_right');
    }

    // CHECKER
    get checker_aCompanyExists(){
        return $('id=com.truckpay.truckpay:id/tv_lineOne');
    }

    get checker_aCompanyDoesNotExist(){
        return $('id=com.truckpay.truckpay:id/btn_create');
    } 
}

module.exports = new createACompanyFirstTimeBtn();
</code></pre>
<p>Here is the code I am trying to run (it is within a describe block):
In plain english, it is saying, if this item exists click create another company. If that button does not exist click createANewCompanyBtn. However when I run it it keeps trying to hit the &quot;createAnotherNewCompanyBtn&quot; even when the checker does not appear on the screen. Maybe the if statement is just checking if it is something existing in my files? If so how would I make it check if it is existing on the screen?</p>
<pre><code>  it('it checks if a company has already been created or not', async () =&gt; {
  if (createACompanyFirstTimeBtn.checker_aCompanyExists) {
      console.log('IT CREATED A COMPANY AGAIN');
      await createACompanyFirstTimeBtn.createAnotherNewCompanyBtn.click();
      await driver.pause(3000);
  
  } else {
      console.log('IT CREATED A COMPANY FOR THE FIRST TIME');
      await createACompanyFirstTimeBtn.createNewCompanyBtn.click();
      await driver.pause(3000);
  }
});
</code></pre>
<p>Here is the error log:</p>
<pre><code>[0-0] 2022-09-02T20:45:14.625Z INFO webdriver: COMMAND findElements(&quot;id&quot;, &quot;com.truckpay.truckpay:id/btn_right&quot;)
[0-0] 2022-09-02T20:45:14.626Z INFO webdriver: [POST] http://localhost:4723/session/469623be-a1a9-4922-8c0e-95c099dace73/elements
[0-0] 2022-09-02T20:45:14.626Z INFO webdriver: DATA { using: 'id', value: 'com.truckpay.truckpay:id/btn_right' }
[0-0] 2022-09-02T20:45:14.649Z INFO webdriver: RESULT []
[0-0] 2022-09-02T20:45:15.126Z INFO webdriver: COMMAND findElements(&quot;id&quot;, &quot;com.truckpay.truckpay:id/btn_right&quot;)
[0-0] 2022-09-02T20:45:15.127Z INFO webdriver: [POST] http://localhost:4723/session/469623be-a1a9-4922-8c0e-95c099dace73/elements
[0-0] 2022-09-02T20:45:15.127Z INFO webdriver: DATA { using: 'id', value: 'com.truckpay.truckpay:id/btn_right' }
[0-0] 2022-09-02T20:45:15.145Z INFO webdriver: RESULT []
[0-0] 2022-09-02T20:45:15.626Z INFO webdriver: COMMAND findElements(&quot;id&quot;, &quot;com.truckpay.truckpay:id/btn_right&quot;)
[0-0] 2022-09-02T20:45:15.627Z INFO webdriver: [POST] http://localhost:4723/session/469623be-a1a9-4922-8c0e-95c099dace73/elements
[0-0] 2022-09-02T20:45:15.627Z INFO webdriver: DATA { using: 'id', value: 'com.truckpay.truckpay:id/btn_right' }
[0-0] 2022-09-02T20:45:15.647Z INFO webdriver: RESULT []
[0-0] 2022-09-02T20:45:16.127Z INFO webdriver: COMMAND findElements(&quot;id&quot;, &quot;com.truckpay.truckpay:id/btn_right&quot;)
[0-0] 2022-09-02T20:45:16.128Z INFO webdriver: [POST] http://localhost:4723/session/469623be-a1a9-4922-8c0e-95c099dace73/elements
[0-0] 2022-09-02T20:45:16.129Z INFO webdriver: DATA { using: 'id', value: 'com.truckpay.truckpay:id/btn_right' }
[0-0] 2022-09-02T20:45:16.148Z INFO webdriver: RESULT []
[0-0] Error in &quot;truckPay create a company for the first time.it checks if a company has already been created or not&quot;
Error: Can't call click on element with selector &quot;id=com.truckpay.truckpay:id/btn_right&quot; because element wasn't found
    at async Context.&lt;anonymous&gt; (/Users/XXXXXX/Desktop/TRUCKPAY/appium-docs-test-hello-world/tests/specs/createACompanyForFirstTime.js:72:7)
[0-0] 2022-09-02T20:45:16.633Z INFO webdriver: COMMAND deleteSession()
[0-0] 2022-09-02T20:45:16.633Z INFO webdriver: [DELETE] http://localhost:4723/session/469623be-a1a9-4922-8c0e-95c099dace73
[0-0] FAILED in android - /tests/specs/createACompanyForFirstTime.js
2022-09-02T20:45:17.006Z INFO @wdio/cli:launcher: Run onWorkerEnd hook
2022-09-02T20:45:17.007Z INFO @wdio/cli:launcher: Run onComplete hook

 &quot;spec&quot; Reporter:
------------------------------------------------------------------
[emulator-5554 android 10 #0-0] Running: emulator-5554 on android 10 executing /Users/christianfortin/Desktop/TRUCKPAY/android/android-official-new/app/build/outputs/apk/debug/app-debug.apk
[emulator-5554 android 10 #0-0] Session ID: 469623be-a1a9-4922-8c0e-95c099dace73
[emulator-5554 android 10 #0-0]
[emulator-5554 android 10 #0-0] » /tests/specs/createACompanyForFirstTime.js
[emulator-5554 android 10 #0-0] truckPay create a company for the first time
[emulator-5554 android 10 #0-0]    ✓ it puts in the wrong credentials
[emulator-5554 android 10 #0-0]    ✓ it hits the login button and logs in
[emulator-5554 android 10 #0-0]    ✖ it checks if a company has already been created or not
[emulator-5554 android 10 #0-0]    - it chooses what type of company it is
[emulator-5554 android 10 #0-0]    - it enters a new company with no details - Error
[emulator-5554 android 10 #0-0]    - it clicks on the add photo button and cancels
[emulator-5554 android 10 #0-0]    - it enters a new company name details
[emulator-5554 android 10 #0-0]    - it enters a new company phone number and address
[emulator-5554 android 10 #0-0]    - it scrolls down to the bottom section
[emulator-5554 android 10 #0-0]    - it enters minority - SSN or EIN - USDOT
[emulator-5554 android 10 #0-0]    - it goes through general liability doc option
[emulator-5554 android 10 #0-0]    - it enters a new company with new details
[emulator-5554 android 10 #0-0]
[emulator-5554 android 10 #0-0] 2 passing (20.9s)
[emulator-5554 android 10 #0-0] 1 failing
[emulator-5554 android 10 #0-0] 9 skipped
[emulator-5554 android 10 #0-0]
[emulator-5554 android 10 #0-0] 1) truckPay create a company for the first time it checks if a company has already been created or not
[emulator-5554 android 10 #0-0] Can't call click on element with selector &quot;id=com.truckpay.truckpay:id/btn_right&quot; because element wasn't found
[emulator-5554 android 10 #0-0] Error: Can't call click on element with selector &quot;id=com.truckpay.truckpay:id/btn_right&quot; because element wasn't found
[emulator-5554 android 10 #0-0]     at async Context.&lt;anonymous&gt; (/Users/XXXXX/Desktop/XXXXXX/appium-docs-test-hello-world/tests/specs/createACompanyForFirstTime.js:72:7)


Spec Files:      0 passed, 1 failed, 1 total (100% completed) in 00:00:30 

2022-09-02T20:45:17.007Z INFO @wdio/local-runner: Shutting down spawned worker
2022-09-02T20:45:17.259Z INFO @wdio/local-runner: Waiting for 0 to shut down gracefully
2022-09-02T20:45:17.261Z INFO @wdio/local-runner: shutting down
XXXXXXX:appium-docs-test-hello-world/ (main✗) $        
</code></pre>
<p>Please let me know if you need more details.</p>
",https://stackoverflow.com/questions/73587834/why-is-my-if-statement-within-an-it-block-getting-ignored,"['android', 'testing', 'webdriver', 'mocha.js']",47,False,0,1
Starting a Flask Server from Within Test Code?,"<p>I'm working through the Flasky tutorial from Miguel Grinberg's book <em>Flask Web Development 2e</em> and I've run into a snag with the end-to-end testing in Chapter 15. When I try to run the code I get a console message</p>
<pre><code>* Ignoring a call to 'app.run()' that would block the current 'flask' CLI command.
   Only call 'app.run()' in an 'if __name__ == &quot;__main__&quot;' guard.
</code></pre>
<p>followed by the browser reporting &quot;Firefox cannot establish a connection...&quot; This suggest to me that the test server is not starting.</p>
<p>Here's the code, from pages 231-233 of the book (the file is <code>tests/test_selenium.py</code>):</p>
<pre class=""lang-py prettyprint-override""><code>import threading
import unittest
from selenium import webdriver

from app import create_app, db, fake
from app.models import Role, User


class SeleniumTestCase(unittest.TestCase):
    browser = None

    @classmethod
    def setUpClass(cls) -&gt; None:
        try:
            cls.browser = webdriver.Firefox()
        except Exception as e:
            pass
        
        if cls.browser:
            cls.app = create_app('testing')
            cls.app_context = cls.app.app_context()
            cls.app_context.push()

            import logging
            logger = logging.getLogger('werkzeug')
            logger.setLevel('ERROR')

            db.create_all()
            Role.insert_roles()
            fake.users(10)
            fake.posts(10)

            admin_role = Role.query.filter_by(permissions=0xff).first()
            admin = User(email='john@example.com', password='cat', username='john', role=admin_role, confirmed=True)
            db.session.add(admin)
            db.session.commit()

            cls.server_thread = threading.Thread(
                target=cls.app.run,
                kwargs={
                    'debug': 'false',
                    'use_reloader': False,
                    'use_debugger': False,
                    'host': '0.0.0.0',
                    'port': 5000
                }
            )
            cls.server_thread.start()
    
    @classmethod
    def tearDownClass(cls) -&gt; None:
        if cls.browser:
            cls.browser.get('http://localhost:5000/shutdown')
            cls.browser.quit()
            cls.server_thread.join()

            db.drop_all()
            db.session.remove()

            cls.app_context.pop()
    
    def setUp(self) -&gt; None:
        if not self.browser:
            self.skipTest('Web browser not available')
    
    def tearDown(self) -&gt; None:
        pass

    def test_admin_home_page(self):
        self.browser.get('http://localhost:5000/')   # fails here
        self.assertRegex(self.browser.page_source, 'Hello,\s+Stranger!')

        self.fail('Finish the test!')
</code></pre>
<p>How can I get a test server up and running from within the test code? (I putzed around with Flask-Testing for a few days before giving it up as unmaintained.)</p>
<p>ADDENDUM: Further experimentation has determined that the problem lies in the explicit call to <code>app.run()</code> conflicting with the Flask CLI's <em>implicit</em> call to <code>app.run()</code>, but without the explicit call the test server doesn't start.</p>
<p>I want to run this from the Flask CLI the same as my unit tests. This means I need to find a way to start the test server <em>after</em> the test database is populated, which happens after the test class's code begins to run. The CLI command code is:</p>
<pre class=""lang-py prettyprint-override""><code>@app.cli.command()
@click.argument('test_names', nargs=-1)
def test(coverage, test_names):
    &quot;&quot;&quot;Run the unit tests&quot;&quot;&quot;
    import unittest
    if test_names:
        tests = unittest.TestLoader().loadTestsFromNames(test_names)
    else:
        tests = unittest.TestLoader().discover('tests')
    unittest.TextTestRunner(verbosity=2).run(tests)
</code></pre>
<p>so running from <code>__main__</code> would bypass the tests' load/run sequence.</p>
",https://stackoverflow.com/questions/74891264/starting-a-flask-server-from-within-test-code,"['python-3.x', 'selenium', 'flask', 'functional-testing']",311,False,2,1
GitHub Actions: How to pass toJSON() result to shell commands,"<p>So, I'm working with Github Actions on end-to-end testing. The setup I'm looking at is having one job retrieve a list of urls to be tested, and my second job creates a matrix with that list and tests them all. My problem here is that when I actually run my testing script, it has to be done from the command line, because I'm using Playwright. Therefore I can't use my matrix object directly; I have to output it to a JSON file. The problem is that toJSON creates invalid pretty-printed JSON when I output it to my file, which breaks my script. Here's my code:</p>
<pre class=""lang-yaml prettyprint-override""><code>name: &lt;name&gt;

on:
    push:
    workflow_dispatch:

jobs:
    fetch_strategic_urls:
        runs-on: ubuntu-latest
        outputs:
            urls: ${{ steps.req-urls.outputs.urls }}
        steps:
            - name: Request Urls
              id: req-urls
              run: |
                  export RESPONSE=$(
                    curl -X GET -H &quot;Accept: application/json&quot; &lt;api-endpoint&gt;)
                  echo &quot;::set-output name=urls::$RESPONSE&quot;
    run_tests:
        runs-on: ubuntu-latest
        strategy:
            matrix:
                url: ${{needs.fetch_strategic_urls.outputs.urls}}
        needs: fetch_strategic_urls
        steps:
            - ...
            - ...
            - run: |
                  ls
                  echo '${{ toJSON(matrix.url) }}' &gt;&gt; props.json
                  cat props.json
                  npm test
              working-directory: E2E.Tests
</code></pre>
<p>No matter which configuration of <code>echo ${{matrix.url}} &gt;&gt; props.json</code> I've tried (<code>cat &lt;&lt;'EOF' &gt; props.json ${{matrix.url}}</code>, adding and removing quotes), it always produced JSON files that have no quotes, i.e.: <code>{ url: string }</code> instead of <code>{&quot;url&quot;: &quot;string&quot;}</code>, which is invalid. This is obviously pretty breaking behavior. I've seen a lot of people online recommending jq, but I don't see how I would use it in this case, since I doubt jq can parse a GitHub-type JSON object, which is necessary for me to use when sharding my jobs. Any help is greatly appreciated!</p>
",https://stackoverflow.com/questions/72953526/github-actions-how-to-pass-tojson-result-to-shell-commands,"['json', 'bash', 'yaml', 'github-actions', 'jsonparser']",4219,True,1,2
SignalR C# Client not receiving data when executed in unit test (SpecFlow),"<p>I'm trying to do an end-to-end testing of an application using SpecFlow. The system under test is some kind of ticketing system; a new ticket can (only) be created by calling a Web API, and when a new ticket has been created, a notification is sent using SignalR. The SpecFlow scenario looks like</p>
<pre><code>@Notifications
Scenario: A notification is sent when a new ticket has been created
    Given I am receiving change notifications when a new ticket has been created
    When I create a new ticket
    Then the new ticket is sent by a push notification
</code></pre>
<p>which maps to the following methods:</p>
<pre><code>//Step 1
[Given(@&quot;I am receiving change notifications when a new ticket has been created&quot;)]
public async Task GivenIAmReceivingChangeNotificationsWhenANewTicketHasBeenCreated()
{    
    var connection = new HubConnectionBuilder()
    .WithUrl(&quot;https://localhost:5001/ws/v1/ticket&quot;)
    .AddJsonProtocol(o =&gt; o.PayloadSerializerOptions.Converters.Add(new JsonStringEnumConverter()))
    .ConfigureLogging(x =&gt;
    {
        //Custom ILogger which does nothing but enables me to set breakpoints
        x.AddProvider(new DoNothingLoggerProvider());
    })
    .Build();

    await connection.StartAsync(CancellationToken.None);

    connection.On&lt;TicketDetails&gt;(&quot;NewTicketRegistered&quot;, ticket =&gt;
    {
      throw new NotImplementedException(&quot;Never reached&quot;)
    });
}

//Step 2
[When(@&quot;I create a new ticket&quot;)]
public async Task WhenICreateANewTicket()
{        
    var ticketId = await MyApiClient.TicketsPostAsync(new NewTicket(), CancellationToken.None);
    ticketId.Should().NotBe(default(Guid));
}

//Step 3
[Then(@&quot;the new ticket is sent by a push notification&quot;)]
public async Task ThenTheNewTicketIsSentByAPushNotification()
{   
   await Task.Delay(5000);
}
</code></pre>
<p>Here, <code>TicketDetails</code> and <code>MyApiClient</code> are generated from OpenAPI.</p>
<p>My problem is that the callback listed in <code>connection.On&lt;TicketDetails&gt;</code> is never invoked, SpecFlow will after step 2 (API is called to create a new ticket) go on to step 3 where it waits for 5 sec before the test scenario completes. During these 5 seconds, the notification from SignalR has been sent. I have verified that by created a super simple console application, which does the same as step 1, except it writes a message to the console instead of throwing an exception. When I run that console app while executing the SpecFlow test, I see that data is sent to the console at the same time as SpecFlow advances to step 3. This tells me that the code for setting up the connection works, and that the notifications are sent before the SpecFlow test completes.</p>
<p>What am I missing here?.</p>
",https://stackoverflow.com/questions/71875667/signalr-c-client-not-receiving-data-when-executed-in-unit-test-specflow,"['c#', 'unit-testing', 'signalr', 'specflow']",147,False,1,0
Can&#39;t login by Goggle accounts connect or by Google auth API in Cypress 10x,"<h3>Current behavior</h3>
<p>I've tried to connect to Google account when my tested application redirects to <strong>Google accounts connect</strong> for let the end-user send emails by the application but I'm not able to do it not by <strong>Google Auth API</strong> according to your guidelines:
<a href=""https://docs.cypress.io/guides/end-to-end-testing/google-authentication#Custom-Command-for-Google-Authentication"" rel=""nofollow noreferrer"">https://docs.cypress.io/guides/end-to-end-testing/google-authentication#Custom-Command-for-Google-Authentication</a>
and not by <code>cy.origin()</code> from the UI.</p>
<p>In the first attempt by the API it's ignore of these authentication and popup the dialog to connect by google account as usually even all the credentials and token are valid and return 200 ok.</p>
<p>In the second attempt by <code>cy.origin()</code> it's keep to load the page after the redirect and  always reach to timeout and yell about to increase the timeout even the page seems like it was fully loaded after a few seconds.
I've tried to increase the timeout to 90 seconds and use wait() before and after the redirect and look for some hidden iframes and tried every versa of google domain but nothing help.
it always return errors over there.</p>
<p>all the examples are below.</p>
<h3>This is the error when trying to use <code>cy.origin()</code>::</h3>
<pre><code>Timed out after waiting 30000ms for your remote page to load on origin(s):

- https://google.com

A cross-origin request for https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&amp;scope=https%3A%2F%2Fmail.google.com&amp;include_granted_scopes=true&amp;state=%7B%22redirectUri%22%3A%22https%3A%2F%2Fmyappurl.com%2Fapp%2Fpipeline%2F9some-token-here-b96b599154ac%3Ftab%3Doverview%22%2C%22clientToken%22%3A%mytokenishere-1234567890%22%7D&amp;prompt=consent&amp;response_type=code&amp;client_id=1234567890-aehhht36f7a01d38bmsvvpjrh915i86v.apps.googleusercontent.com&amp;redirect_uri=https%3A%2F%2Fmyredreictedappurl.com%2FusersManagerSrvGoogleLogin was detected.

A command that triggers cross-origin navigation must be immediately followed by a cy.origin() command:

cy.origin('https://google.com', () =&gt; {
  &lt;commands targeting https://accounts.google.com go here&gt;
})

If the cross-origin request was an intermediary state, you can try increasing the pageLoadTimeout value in Users/myname/repos/myreponame/cypress.config.ts to wait longer.

Browsers will not fire the load event until all stylesheets and scripts are done downloading.

When this load event occurs, Cypress will continue running commands.[Learn more](https://on.cypress.io/origin)
</code></pre>
<h3>Desired behavior</h3>
<p><em>No response</em></p>
<h3>Test code to reproduce</h3>
<p><strong>commands.ts</strong></p>
<pre><code>Cypress.Commands.add('loginByGoogleApi', () =&gt; {
    cy.log('Logging in to Google')
    cy.request({
        method: 'POST',
        url: 'https://www.googleapis.com/oauth2/v4/token',
        body: {
            grant_type: 'refresh_token',
            client_id: Cypress.env('googleClientId'),
            client_secret: Cypress.env('googleClientSecret'),
            refresh_token: Cypress.env('googleRefreshToken'),
        },
    }).then(({ body }) =&gt; {
        const { access_token, id_token } = body

        cy.request({
            method: 'GET',
            url: 'https://www.googleapis.com/oauth2/v3/userinfo',
            headers: { Authorization: `Bearer ${access_token}` },
        }).then(({ body }) =&gt; {
            cy.log(body)
            const userItem = {
                token: id_token,
                user: {
                    googleId: body.sub,
                    email: body.email,
                    givenName: body.given_name,
                    familyName: body.family_name,
                    imageUrl: body.picture,
                },
            }

            window.localStorage.setItem('googleCypress', JSON.stringify(userItem))
            cy.visit('/')
        })
    })
})
</code></pre>
<p><strong>test-file.cy.ts</strong></p>
<pre><code>    it.only('Send email to a user - is shown in the activity', () =&gt; {
      cy.loginByGoogleApi();
      cy.get(loc.sideNavBar.buyersPipeline).should('be.visible').click();
      cy.get(loc.pipelineBuyer.nameColumn)
        .eq(4)
        .should('be.visible')
        .click({ force: true });
      cy.get(loc.buyerDetails.basicCard).should('be.visible');
      cy.get(loc.buyerDetails.timelineSendEmailIcon)
        .should('be.visible')
        .click();
        cy.get('div[role=&quot;dialog&quot;]').find('button.MuiButton-root').should('be.visible').click();
           })
        })
</code></pre>
<hr />
<p>By <code>cy.origin()</code> by the UI:</p>
<p><strong>test-file.cy.ts</strong></p>
<pre><code>    it.only('Send email to a user - is shown in the activity', () =&gt; {
      // cy.loginByGoogleApi();
      cy.get(loc.sideNavBar.buyersPipeline).should('be.visible').click();
      cy.get(loc.pipelineBuyer.nameColumn)
        .eq(4)
        .should('be.visible')
        .click({ force: true });
      cy.get(loc.buyerDetails.basicCard).should('be.visible');
      cy.get(loc.buyerDetails.timelineSendEmailIcon)
        .should('be.visible')
        .click();
        cy.get('div[role=&quot;dialog&quot;]').find('button.MuiButton-root').should('be.visible').click();
        cy.wait(5000);
        cy.origin('https://accounts.google.com', () =&gt; {
            cy.wait(5000);
            expect(window.origin).contains('google.com')
            cy.get('input[type=&quot;email&quot;]', {timeout: 60000}).should('be.visible', {timeout: 60000}).type('111');
        })
    });
    ````

### Cypress Version

10.7.0

### Node version

v14.19.1

### Operating System

macOS Montery 12.3.1
</code></pre>
",https://stackoverflow.com/questions/73680234/cant-login-by-goggle-accounts-connect-or-by-google-auth-api-in-cypress-10x,"['redirect', 'google-api', 'automated-tests', 'google-oauth', 'cypress']",301,False,0,0
Stubbing Google Maps JS API loader in Cypress,"<p>I'm using the <a href=""https://developers.google.com/maps/documentation/javascript/overview"" rel=""nofollow noreferrer"">Google Maps JS API</a> in my app for autocompletion and geocoding. The API is loaded using the <a href=""https://www.npmjs.com/package/@googlemaps/js-api-loader"" rel=""nofollow noreferrer"">Google Maps JS API Loader</a>. As I'm end-to-end testing with Cypress, I'm trying to mock out the API, but I can't figure out how to make it work.</p>
<p>I abstract the API in a separate module. This is how it is loaded and instantiated (the code is reduced to the essentials):</p>
<pre class=""lang-js prettyprint-override""><code>import {Loader} from &quot;@googlemaps/js-api-loader&quot;;

// The Google Maps API has to be loaded dynamically.
// We have to do this here as it is loaded asynchronously and otherwise we won't
//  be able to just create the class below.
let loading: Promise&lt;typeof google&gt;;
try {
  loading = new Loader({
    apiKey: &quot;private key&quot;,
    libraries: [&quot;places&quot;],
  }).load();
} catch (e) {
  console.error(&quot;Failed to load Google Maps API&quot;);
}

class GoogleMapsAPI {
  private autocompleteService: google.maps.places.AutocompleteService;
  private readonly sessionToken: google.maps.places.AutocompleteSessionToken;
  private predictions: google.maps.places.AutocompletePrediction[];

  constructor() {
    this.autocompleteService = new google.maps.places.AutocompleteService();

    // As an instance is created every time we use this, we set the session here
    this.sessionToken = new google.maps.places.AutocompleteSessionToken();
    this.predictions = []
  }

  public async getPredictions(input: string): Promise&lt;google.maps.places.AutocompletePrediction[]&gt; {
    // Search for the input string and store the returned results
    try {
      const result = await this.autocompleteService.getPlacePredictions({
        input,
        sessionToken: this.sessionToken
      });

      // Replace the previous predictions
      this.predictions = result.results;
      return this.predictions;
    } catch (e: any) {
      console.error(`Autocomplete call failed: ${e}`);
      return [];
    }
  }
}

async function loadGoogleMapsAPI(): Promise&lt;GoogleMapsAPI | null&gt; {
  // Wait for the loader to load the API, then return the API class.
  try {
    await loading;

    return new GoogleMapsAPI();
  } catch (e) {
    console.error(`Google Maps API could not be loaded`);
  }

  return null;
}
</code></pre>
<p>This is how I use the API in my React app:</p>
<pre class=""lang-js prettyprint-override""><code>import React, {useEffect, useState} from &quot;react&quot;;

import {GoogleMapsAPI, loadGoogleMapsAPI} from &quot;../../services/google&quot;;

export default function Site() {
  const [api, setAPI] = useState&lt;GoogleMapsAPI | null&gt;(null);

  useEffect(() =&gt; {
    loadGoogleMapsAPI()
      .then((api) =&gt; {
        setAPI(api);
      })
  });

  return &lt;div&gt;API valid: {api ? &quot;yes&quot; : &quot;no&quot;}&lt;/div&gt;;
}
</code></pre>
<p>And this is how I try to test it:</p>
<pre class=""lang-js prettyprint-override""><code>import {Loader} from &quot;@googlemaps/js-api-loader&quot;;


describe(&quot;Test&quot;, () =&gt; {
  it(&quot;Google Maps not found&quot;, () =&gt; {
    cy.visit(
      &quot;/&quot;,
      {
        onBeforeLoad(win: Cypress.AUTWindow) {
          // Mock the load method of Loader to prevent it from ever requesting
          //  the Google Maps API script file
          cy.stub(Loader.prototype, &quot;load&quot;).resolves(true);

          // Replace the Google Maps API created by the Google Maps API Loader
          //  with our mocks
          win.google = {
            maps: {
              places: {
                AutocompleteSessionToken: class {},
                AutocompleteService: class {
                  async getPlacePredictions(request: any) {
                    return Promise.resolve({ predictions: [] });
                  }
                } as any,
              } as any
            } as any
          };
        }
      }
    );

    cy.get(&quot;API valid: yes&quot;); // Fails consistently
  });
});
</code></pre>
<p>I'm stubbing out the <code>load</code> method of the <a href=""https://developers.google.com/maps/documentation/javascript/overview#Loading_the_Maps_API"" rel=""nofollow noreferrer""><code>Loader</code></a> class and then try to add a mock Google Maps services to the window.</p>
<p>My problem is that neither stubbing the loader doesn't work - according to Cypress the stub is never even called and, of course, the promise doesn't resolve then either.
Another approach I tried was to stub <code>loadGoogleMapsAPI</code> and manually return an instance of <code>GoogleMapsAPI</code>, but the issue remains the same - I never get the predictions returned by <code>google.maps.places.autocompleteService.getPlacePredictions</code> via <code>getPlacePredictions</code>.</p>
<p>As I'm pretty new to testing with Cypress and testing frontend code in general this might just be a misundernstanding of how stubbing in Cypress works or how code is loaded in JS, but I'm pretty much stuck here and would appreciate any help!</p>
",https://stackoverflow.com/questions/70940991/stubbing-google-maps-js-api-loader-in-cypress,"['typescript', 'mocking', 'cypress', 'sinon']",831,True,0,1
My angular website is not showing its content instead showing some angular stuff after hosting it in git hub pages,"<p>My angular website is not showing its content instead showing some angular stuff after hosting it in git hub pages.
Its showing like below:
coding-master
Coding
This project was generated with Angular CLI version 14.0.4.</p>
<p>Development server
Run ng serve for a dev server. Navigate to http://localhost:4200/. The application will automatically reload if you change any of the source files.</p>
<p>Code scaffolding
Run ng generate component component-name to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module.</p>
<p>Build
Run ng build to build the project. The build artifacts will be stored in the dist/ directory.</p>
<p>Running unit tests
Run ng test to execute the unit tests via Karma.</p>
<p>Running end-to-end tests
Run ng e2e to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.</p>
<p>Further help
To get more help on the Angular CLI use ng help or go check out the Angular CLI Overview and Command Reference page.
m</p>
<p>my index.html</p>
<pre><code>&lt;!doctype html&gt;
&lt;html lang=&quot;en&quot;&gt;
&lt;head&gt;
  &lt;meta charset=&quot;utf-8&quot;&gt;
  &lt;title&gt;Coding&lt;/title&gt;
  &lt;base href=&quot;/&quot;&gt;
  &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&gt;
  &lt;link rel=&quot;icon&quot; type=&quot;image/x-icon&quot; href=&quot;favicon.ico&quot;&gt;
  &lt;link rel=&quot;stylesheet&quot; href=&quot;https://use.fontawesome.com/releases/v6.1.1/css/all.css&quot;&gt;
 &lt;script type=&quot;module&quot; src=&quot;https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.esm.js&quot;&gt;&lt;/script&gt;
  &lt;script nomodule src=&quot;https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.js&quot;&gt;&lt;/script&gt; 
  &lt;link href=&quot;https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css&quot; rel=&quot;stylesheet&quot; integrity=&quot;sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1&quot; crossorigin=&quot;anonymous&quot;&gt;
&lt;!-- JavaScript Bundle with Popper --&gt;
&lt;script src=&quot;https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/js/bootstrap.bundle.min.js&quot; integrity=&quot;sha384-ygbV9kiqUc6oa4msXn9868pTtWMgiQaeYH7/t7LECLbyPA2x65Kgf80OJFdroafW&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;

&lt;script type=&quot;application/javascript&quot; src=&quot;/node_modules/owl.carousel/dist/owl.carousel.js&quot;&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
  &lt;app-root&gt;&lt;/app-root&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
<p>angular.json</p>
<pre><code>{
  &quot;$schema&quot;: &quot;./node_modules/@angular/cli/lib/config/schema.json&quot;,
  &quot;version&quot;: 1,
  &quot;newProjectRoot&quot;: &quot;projects&quot;,
  &quot;projects&quot;: {
    &quot;coding&quot;: {
      &quot;projectType&quot;: &quot;application&quot;,
      &quot;schematics&quot;: {},
      &quot;root&quot;: &quot;&quot;,
      &quot;sourceRoot&quot;: &quot;src&quot;,
      &quot;prefix&quot;: &quot;app&quot;,
      &quot;architect&quot;: {
        &quot;build&quot;: {
          &quot;builder&quot;: &quot;@angular-devkit/build-angular:browser&quot;,
          &quot;options&quot;: {
            &quot;outputPath&quot;: &quot;dist/coding&quot;,
            &quot;index&quot;: &quot;src/index.html&quot;,
            &quot;main&quot;: &quot;src/main.ts&quot;,
            &quot;polyfills&quot;: &quot;src/polyfills.ts&quot;,
            &quot;tsConfig&quot;: &quot;tsconfig.app.json&quot;,
            &quot;assets&quot;: [
              &quot;src/favicon.ico&quot;,
              &quot;src/assets&quot;
            ],
            &quot;styles&quot;: [&quot;node_modules/ngx-owl-carousel-o/lib/styles/prebuilt-themes/owl.carousel.min.css&quot;,
              &quot;node_modules/ngx-owl-carousel-o/lib/styles/prebuilt-themes/owl.theme.default.min.css&quot;,
              &quot;src/styles.css&quot;,&quot;node_modules/@fortawesome/fontawesome-free/css/all.min.css&quot;,
              &quot;node_modules/bootstrap/scss/bootstrap.scss&quot;,
  
  &quot;node_modules/ngx-sharebuttons/themes/circles.scss&quot;,
  &quot;node_modules/ngx-sharebuttons/themes/modern.scss&quot;,
              &quot;node_modules/aos/dist/aos.css&quot;
            ],
            &quot;scripts&quot;: [&quot;./node_modules/jquery/dist/jquery.min.js&quot;
              
              ]
          },
          &quot;configurations&quot;: {
            &quot;production&quot;: {
              &quot;budgets&quot;: [
                {
                  &quot;type&quot;: &quot;initial&quot;,
                  &quot;maximumWarning&quot;: &quot;4mb&quot;,
                  &quot;maximumError&quot;: &quot;5mb&quot;
                },
                {
                  &quot;type&quot;: &quot;anyComponentStyle&quot;,
                  &quot;maximumWarning&quot;: &quot;2kb&quot;,
                  &quot;maximumError&quot;: &quot;4kb&quot;
                }
              ],
              &quot;fileReplacements&quot;: [
                {
                  &quot;replace&quot;: &quot;src/environments/environment.ts&quot;,
                  &quot;with&quot;: &quot;src/environments/environment.prod.ts&quot;
                }
              ],
              &quot;outputHashing&quot;: &quot;all&quot;
            },
            &quot;development&quot;: {
              &quot;buildOptimizer&quot;: false,
              &quot;optimization&quot;: false,
              &quot;vendorChunk&quot;: true,
              &quot;extractLicenses&quot;: false,
              &quot;sourceMap&quot;: true,
              &quot;namedChunks&quot;: true
            }
          },
          &quot;defaultConfiguration&quot;: &quot;production&quot;
        },
        &quot;serve&quot;: {
          &quot;builder&quot;: &quot;@angular-devkit/build-angular:dev-server&quot;,
          &quot;configurations&quot;: {
            &quot;production&quot;: {
              &quot;browserTarget&quot;: &quot;coding:build:production&quot;
            },
            &quot;development&quot;: {
              &quot;browserTarget&quot;: &quot;coding:build:development&quot;
            }
          },
          &quot;defaultConfiguration&quot;: &quot;development&quot;
        },
        &quot;extract-i18n&quot;: {
          &quot;builder&quot;: &quot;@angular-devkit/build-angular:extract-i18n&quot;,
          &quot;options&quot;: {
            &quot;browserTarget&quot;: &quot;coding:build&quot;
          }
        },
        &quot;test&quot;: {
          &quot;builder&quot;: &quot;@angular-devkit/build-angular:karma&quot;,
          &quot;options&quot;: {
            &quot;main&quot;: &quot;src/test.ts&quot;,
            &quot;polyfills&quot;: &quot;src/polyfills.ts&quot;,
            &quot;tsConfig&quot;: &quot;tsconfig.spec.json&quot;,
            &quot;karmaConfig&quot;: &quot;karma.conf.js&quot;,
            &quot;assets&quot;: [
              &quot;src/favicon.ico&quot;,
              &quot;src/assets&quot;
            ],
            &quot;styles&quot;: [
              &quot;src/styles.css&quot;
            ],
            &quot;scripts&quot;: []
          }
        }
      }
    }
  },
  &quot;cli&quot;: {
    &quot;analytics&quot;: &quot;c15638a4-6933-4317-92a8-0db12f3b3f27&quot;
  }
}
</code></pre>
<p>package.json</p>
<pre><code>{
  &quot;name&quot;: &quot;coding&quot;,
  &quot;version&quot;: &quot;0.0.0&quot;,
  &quot;scripts&quot;: {
    &quot;ng&quot;: &quot;ng&quot;,
    &quot;start&quot;: &quot;ng serve&quot;,
    &quot;build&quot;: &quot;ng build&quot;,
    &quot;watch&quot;: &quot;ng build --watch --configuration development&quot;,
    &quot;test&quot;: &quot;ng test&quot;
   
   
  },
  &quot;private&quot;: true,
  &quot;dependencies&quot;: {
    &quot;@angular/animations&quot;: &quot;^14.0.4&quot;,
    &quot;@angular/cdk&quot;: &quot;^14.0.4&quot;,
    &quot;@angular/common&quot;: &quot;^14.0.4&quot;,
    &quot;@angular/compiler&quot;: &quot;^14.0.4&quot;,
    &quot;@angular/core&quot;: &quot;^14.0.4&quot;,
    &quot;@angular/forms&quot;: &quot;^14.0.4&quot;,
    &quot;@angular/platform-browser&quot;: &quot;^14.0.4&quot;,
    &quot;@angular/platform-browser-dynamic&quot;: &quot;^14.0.4&quot;,
    &quot;@angular/router&quot;: &quot;^14.0.4&quot;,
    &quot;@fortawesome/angular-fontawesome&quot;: &quot;^0.11.1&quot;,
    &quot;@fortawesome/fontawesome-free&quot;: &quot;^6.1.1&quot;,
    &quot;@fortawesome/fontawesome-svg-core&quot;: &quot;^6.1.1&quot;,
    &quot;@fortawesome/free-brands-svg-icons&quot;: &quot;^6.1.1&quot;,
    &quot;@fortawesome/free-solid-svg-icons&quot;: &quot;^6.1.1&quot;,
    &quot;animate.css&quot;: &quot;^4.1.1&quot;,
    &quot;aos&quot;: &quot;^2.3.4&quot;,
    &quot;bootstrap&quot;: &quot;^5.1.3&quot;,
    &quot;ng2-carouselamos&quot;: &quot;^4.1.0&quot;,
    &quot;ngx-owl-carousel&quot;: &quot;^2.0.7&quot;,
    &quot;ngx-owl-carousel-o&quot;: &quot;^7.0.3&quot;,
    &quot;ngx-sharebuttons&quot;: &quot;^11.0.0&quot;,
    &quot;rxjs&quot;: &quot;~7.5.5&quot;,
    &quot;script-loader&quot;: &quot;^0.7.2&quot;,
    &quot;tslib&quot;: &quot;^2.4.0&quot;,
    &quot;web-animations-js&quot;: &quot;^2.3.2&quot;,
    &quot;zone.js&quot;: &quot;~0.11.6&quot;
  },
  &quot;devDependencies&quot;: {
    &quot;@angular-devkit/build-angular&quot;: &quot;^14.0.4&quot;,
    &quot;@angular/cli&quot;: &quot;^14.0.4&quot;,
    &quot;@angular/compiler-cli&quot;: &quot;^14.0.4&quot;,
    &quot;@types/aos&quot;: &quot;^3.0.4&quot;,
    &quot;@types/jasmine&quot;: &quot;~4.0.3&quot;,
    &quot;jasmine-core&quot;: &quot;~4.2.0&quot;,
    &quot;karma&quot;: &quot;~6.4.0&quot;,
    &quot;karma-chrome-launcher&quot;: &quot;~3.1.1&quot;,
    &quot;karma-coverage&quot;: &quot;~2.2.0&quot;,
    &quot;karma-jasmine&quot;: &quot;~5.1.0&quot;,
    &quot;karma-jasmine-html-reporter&quot;: &quot;~2.0.0&quot;,
    &quot;typescript&quot;: &quot;~4.7.4&quot;
  }
}
</code></pre>
<p>while doing deploy 🚀 Uploading via git, please wait...
🌟 Successfully published via angular-cli-ghpages! Have a nice day! is coming..but website is not properly hosted.
Please help</p>
",https://stackoverflow.com/questions/72924186/my-angular-website-is-not-showing-its-content-instead-showing-some-angular-stuff,['angular-cli'],67,False,0,0
How to run E2E test with Cypress if backend and frontend are on different repos?,"<p>I have a React frontend and a Node backend, I've made several E2E tests with Cypress for the frontend and run them locally. I love how end to end testing allows me to catch errors in the frontend as well as on the backend! so I'd like to have a way to run them automatically when sending a PR.</p>
<p>I'm using bitbucket pipelines, and I've configured it to run the <code>npm test</code> command which works perfectly to run my unit tests, but what I still don't understand is how to be able to run my Cypress tests automatically, because I'd need to have access to the backend repository from my pipeline that runs on the frontend repo.</p>
<hr />
<p><strong>What I've tried</strong></p>
<p>I've read the <a href=""https://docs.cypress.io/guides/continuous-integration/bitbucket-pipelines#Testing-in-Chrome-and-Firefox-with-Cypress-Docker-Images"" rel=""nofollow noreferrer"">documentation</a> and played with the <a href=""https://github.com/cypress-io/cypress-realworld-app"" rel=""nofollow noreferrer"">example repo</a>, but I still don't understand how could I automate running my tests, on the example both backend and frontend are on the same repository.</p>
<hr />
<p>I'm sorry if this is a vague question, I just <em>don't</em> seem to get if this is even possible with bitbucket pipelines, if it's not, what other tool could help me run my Cypress test in a similar way that I do locally? (running both backend and frontend).</p>
<p>I've really tried to search for an answer to this, maybe it's too obvious and I'm just missing something but I don't seem to find anything on the internet about this, any help will be very appreciated!</p>
",https://stackoverflow.com/questions/70780670/how-to-run-e2e-test-with-cypress-if-backend-and-frontend-are-on-different-repos,"['testing', 'bitbucket', 'cypress', 'e2e-testing', 'bitbucket-pipelines']",1322,True,1,1
vuejs sample app npm run dev not working throwing Error: Cannot find module &#39;node:url&#39;,"<p>I am new to vuejs I am following the below steps to create my vue js app in the local system.</p>
<p>Step:</p>
<blockquote>
<p>npm init vue@latest</p>
</blockquote>
<p>✔ Project name: … <strong>VueDemo</strong>
✔ Add TypeScript? … No / Yes
✔ Add JSX Support? … No / Yes
✔ Add Vue Router for Single Page Application development? … No / Yes
✔ Add Pinia for state management? … No / Yes
✔ Add Vitest for Unit testing? … No / Yes
✔ Add Cypress for both Unit and End-to-End testing? … No / Yes
✔ Add ESLint for code quality? … No / Yes
✔ Add Prettier for code formatting? … No / Yes</p>
<p>Scaffolding project in ./<strong>VueDemo</strong>
Done.</p>
<p>cd VueDemo
npm install
npm run dev</p>
<p>It's throwing the following error in the console:</p>
<blockquote>
<p>failed to load config from
/Users/ashok/MyStudy/Vue/VueDemo/vite.config.js error when starting
dev server: Error: Cannot find module 'node:url' Require stack:</p>
<ul>
<li>/Users/ashok/MyStudy/Vue/VueDemo/vite.config.js</li>
<li>/Users/ashok/MyStudy/Vue/VueDemo/node_modules/vite/dist/node/chunks/dep-0fc8e132.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15)
at Function.Module._load (internal/modules/cjs/loader.js:745:27)
at Module.require (internal/modules/cjs/loader.js:961:19)
at require (internal/modules/cjs/helpers.js:92:18)
at Object. (/Users/ashok/MyStudy/Vue/VueDemo/vite.config.js:31:23)
at Module._compile (internal/modules/cjs/loader.js:1072:14)
at Object._require.extensions. [as .js] (file:///Users/ashok/MyStudy/Vue/VueDemo/node_modules/vite/dist/node/chunks/dep-0fc8e132.js:63096:24)
at Module.load (internal/modules/cjs/loader.js:937:32)
at Function.Module._load (internal/modules/cjs/loader.js:778:12)
at Module.require (internal/modules/cjs/loader.js:961:19)</li>
</ul>
</blockquote>
<p>Package.json file:</p>
<pre><code>{
  &quot;name&quot;: &quot;vuedemo&quot;,
  &quot;version&quot;: &quot;0.0.0&quot;,
  &quot;scripts&quot;: {
    &quot;dev&quot;: &quot;vite&quot;,
    &quot;build&quot;: &quot;vite build&quot;,
    &quot;preview&quot;: &quot;vite preview --port 4173&quot;
  },
  &quot;dependencies&quot;: {
    &quot;vue&quot;: &quot;^3.2.37&quot;
  },
  &quot;devDependencies&quot;: {
    &quot;@vitejs/plugin-vue&quot;: &quot;^3.0.1&quot;,
    &quot;vite&quot;: &quot;^3.0.4&quot;
  }
} 
</code></pre>
<p>vite.config.js:</p>
<pre><code>import { fileURLToPath, URL } from 'node:URL

import { defineConfig } from 'vite'
import Vue from '@vitejs/plugin-vue'

export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    }
  }
})
</code></pre>
",https://stackoverflow.com/questions/73586656/vuejs-sample-app-npm-run-dev-not-working-throwing-error-cannot-find-module-nod,"['javascript', 'vue.js']",3508,True,3,2
How can I supress Vue/Webpack dev server proxy error messages in the terminal?,"<p>My application uses an end-to-end testing framework (Cypress) that outputs results in the
terminal. When testing changes to frontend code, I use the Vue dev server's
<code>proxy</code> option to route API requests to a remote backend server.</p>
<p>Due to the high load of requests pummeling this test server, our application
frontend expects certain requests to fall through, and it is able to
intelligently handle retrying a given failed API call. However, the proxy
handler doesn't know this, and as a result the console log becomes cluttered
with <code>ECONNRESET</code> proxy errors, as can be seen below.</p>
<pre><code>Proxy error: Could not proxy request /api/XXXXXX from local.myapp.io:3000 to https://myapp-dev.appspot.com.
See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNRESET).

Proxy error: Could not proxy request /api/XXXXXX from local.myapp.io:3000 to https://myapp-dev.appspot.com.
See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNRESET).

Proxy error: Could not proxy request /api/XXXXXX from local.myapp.io:3000 to https://myapp-dev.appspot.com.
See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNRESET).

Proxy error: Could not proxy request /api/XXXXXX from local.myapp.io:3000 to https://myapp-dev.appspot.com.
See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNRESET).

    ✓ C22756 should be disabled when no events exist (8018ms)
    ✓ C22757 should be clickable when events exist (2250ms)
  Widget Settings

Proxy error: Could not proxy request /api/XXXXXX from local.myapp.io:3000 to https://myapp-dev.appspot.com.
See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNRESET).

    ✓ C22758 should have name, date range, and account fields (2435ms)
</code></pre>
<p>These errors can get quite verbose and tend to hide/obscure the more laconic
test output, making it difficult to scan and nearly impossible to copy
effectively.</p>
<p><strong>Is there any way to suppress these error messages from the dev server/proxy
handler?</strong> Ideally, there would be some form of configuration in an NPM script
or the Vue/Webpack config JS file that would allow me to ignore or hide these
errors just when running our test suite.</p>
<p>For reference, here is the config object being passed to the <code>vue.config.js</code>
file's <code>devServer</code> property:</p>
<pre class=""lang-js prettyprint-override""><code>const config = {
    allowedHosts: ['localhost', 'local.myapp.io'],
    contentBase: path.join(__dirname, 'root/of/frontend/code'),
    disableHostCheck: true,
    historyApiFallback: true,
    https: {
        cert: LocalDevCert.getCert(),
        key: LocalDevCert.getKey()
    },
    port: 3000,
    proxy: {
    '^(?!/(js|modules|img))': {
        target: 'https://myapp-dev.appspot.com',
        cookieDomainRewrite: 'local.myapp.io',
        changeOrigin: true,
        secure: true,
        bypass (req, res) {
            const xsrfToken = uuid();
            if (req.headers.accept &amp;&amp; req.headers.accept.includes('html')) {
                res.cookie('MyXSRFToken', xsrfToken);
                res.cookie('MyXSRFToken_C80', xsrfToken);

                return '/index.html';
            }

            if (req.method === 'GET' &amp;&amp; req.url.includes('login') &amp;&amp; !req.url.includes('google')) {
                res.cookie('MyXSRFToken', xsrfToken);
                res.cookie('MyXSRFToken_C80', xsrfToken);

                return '/';
            }
        }
    }
    },
    public: 'local.myapp.io:3000'
};
</code></pre>
<p>I have tried:</p>
<ul>
<li>Using the <a href=""https://webpack.js.org/configuration/dev-server/#logging"" rel=""nofollow noreferrer"">devServer.client.logging configuration option</a>, but this only changes what is shown in the browser console (not the command-line terminal).</li>
<li>Adding the <a href=""https://forum.vuejs.org/t/devserver-proxy-in-vue-config-js-not-working/87316/3"" rel=""nofollow noreferrer"">logLevel configuration option</a> to the corresponding proxy configuration object (i.e. object with key <code>^(?!/(js|modules|img))</code> above), but this only seems to <em>increase</em> the amount of logging (info as well as errors).</li>
</ul>
<p>I suspect something needs to be suppressed at a lower level, and perhaps some bash-script magic is the only plausible solution.</p>
",https://stackoverflow.com/questions/71488383/how-can-i-supress-vue-webpack-dev-server-proxy-error-messages-in-the-terminal,"['node.js', 'vue.js', 'webpack', 'cypress']",655,True,0,2
How to do lighthouse test on a protected URL,"<p>I'm working on a project and need to do end-to-end testing using cypress. I need to do a lighthouse test on that project and get the performance and accessibility scores.
Currently, I'm doing lighthouse tests using the cypress-audit package. but the problem is,
we getting very low values for the performance score when compared to the chrome devtool lighthouse plugin. this happened only for the performance, the score of the accessibility got the same value for both ways. as an example for one page I got a performance score of 22 from devtools but running this method in cypress I got 2 as the performance score.</p>
<pre><code>export function lighthouseAudit(scenarioId) {
    Cypress.config('taskTimeout', Cypress.env('lighthousePreloadingTaskTimeout'));
    cy.log(&quot;scenarioId&quot;, scenarioId);
    cy.task(&quot;getExcelData&quot;, Cypress.env(&quot;lighthouseBaseValueFilePath&quot;)).then(data =&gt; {
        const baseValueData = data.find(record =&gt; {
            return record.Id == scenarioId;
        });

        const lighthouseMetrics = {
            performance: baseValueData.performance,
            accessibility: baseValueData.accessibility,
        };

       
        const desktopConfig = {
            formFactor: 'desktop',
            screenEmulation: { disabled: true },
        };

        const lighthouseData = {
            lighthouseReportName : scenarioId,
            thresholds : lighthouseMetrics
        }

        cy.task('setLighthouseData', lighthouseData).then(() =&gt; {
            cy.lighthouse(lighthouseMetrics, desktopConfig);
        });
    });
}
</code></pre>
<p>is it correct or do I need to pass any other option to <code>desktopConfig</code> ?</p>
<p>I saw most of the developers experiencing this issue when using cypress-audit. then I tried a new approach. I installed the lighthouse package globally and use this method to do the lighthouse test.</p>
<pre><code>cy.exec(`lighthouse ${url} --chrome-flags=&quot;--headless&quot; --preset=desktop  --emulatedUserAgent=&quot;Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36&quot; --output=&quot;json&quot; `).then(({ stdout }) =&gt; {
    const { categories } = JSON.parse(stdout);
    var res =  Object.keys(categories).reduce((acc, key) =&gt; {
      return {
        ...acc,
        [key]: categories[key].score
      }
    }, {})

    cy.log(res)

  });
</code></pre>
<p>seems like this will give a fire score for the performance than cypress-audit.
but the issue is we can't do lighthouse tests on a protected URL using this.
because when we run the cypress it opens a new chrome instance in which we can log in to our site and then we can go to protected URLs. but when this method runs it will open a new chrome instance that does not have any previously saved cookies or session ids, because of that we can't access the protected URLs</p>
<p>need help finding a better solution to get the correct performance and accessibility score from the lighthouse test. and it should be able to do a lighthouse test on protected URLs aswell</p>
",https://stackoverflow.com/questions/74858368/how-to-do-lighthouse-test-on-a-protected-url,"['javascript', 'cypress', 'lighthouse']",120,False,0,0
LibGit2Sharp: How to push a local repo commit to Azure DevOps remote repo using a Personal Access Token inside a custom HTTP authentication header?,"<p>I am trying to push a commit I made on my local repository to a remote counterpart, hosted on a private Azure DevOps server, using LibGit2Sharp programmatically.</p>
<p>As per the <a href=""https://learn.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=azure-devops&amp;tabs=Windows#use-a-pat"" rel=""nofollow noreferrer"">Azure documentation</a>, the HTTPS OAuth enabled Personal Access Token needs to sent with the request in a custom Authentication header as 'Basic' with the Base64 encoded token:</p>
<pre><code>var personalaccesstoken = &quot;PATFROMWEB&quot;;

    using (HttpClient client = new HttpClient()) {
        client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(&quot;Basic&quot;,
            Convert.ToBase64String(Encoding.ASCII.GetBytes($&quot;:{personalaccesstoken}&quot;)));

        using (HttpResponseMessage response = client.GetAsync(
                    &quot;https://dev.azure.com/{organization}/{project}/_apis/build/builds?api-version=5.0&quot;).Result) {
            response.EnsureSuccessStatusCode();
        }
    }
</code></pre>
<p>The <a href=""https://github.com/libgit2/libgit2sharp/blob/1e6da83ab8c47058b5b4ef1e4e28e4732de44db0/LibGit2Sharp/CloneOptions.cs#L49"" rel=""nofollow noreferrer""><code>LibGit2Sharp.CloneOptions</code> class has a <code>FetchOptions</code> field</a> which in turn <a href=""https://github.com/libgit2/libgit2sharp/blob/1e6da83ab8c47058b5b4ef1e4e28e4732de44db0/LibGit2Sharp/FetchOptions.cs#L48"" rel=""nofollow noreferrer"">has a <code>CustomHeaders</code> array</a> that can be used to inject the authentication header during the clone operation, like the following (<a href=""https://github.com/libgit2/libgit2sharp/issues/1596#issuecomment-977184992"" rel=""nofollow noreferrer"">as mentioned in this issue</a>):</p>
<pre><code>        CloneOptions cloneOptions = new() {
        CredentialsProvider = (url, usernameFromUrl, types) =&gt; new UsernamePasswordCredentials {
            Username = $&quot;{USERNAME}&quot;,
            Password = $&quot;{ACCESSTOKEN}&quot;
        },
        FetchOptions = new FetchOptions {
            CustomHeaders = new[] {
                $&quot;Authorization: Basic {encodedToken}&quot;
            }
        }
    };
    Repository.Clone(AzureUrl, LocalDirectory, cloneOptions);
    
</code></pre>
<p>And the clone process succeeds (I tested it as well as <a href=""https://github.com/libgit2/libgit2sharp/blob/1e6da83ab8c47058b5b4ef1e4e28e4732de44db0/LibGit2Sharp/Repository.cs#L775"" rel=""nofollow noreferrer"">checked the source code</a> :) )</p>
<p>However, the <code>LibGit2Sharp.PushOptions</code> does not have any such mechanism to inject authentication headers. I am limited to the following code:</p>
<pre><code>PushOptions pushOptions = new()
        {
            CredentialsProvider = (url, usernameFromUrl, types) =&gt; new UsernamePasswordCredentials
            {
                Username = $&quot;{USERNAME}&quot;,
                Password = $&quot;{PASSWORD}&quot;
            }
        };
</code></pre>
<p>This is making my push operation fail with the following message:</p>
<blockquote>
<p>Too many redirects or authentication replays</p>
</blockquote>
<p>I checked the source code for <a href=""https://github.com/libgit2/libgit2sharp/blob/1e6da83ab8c47058b5b4ef1e4e28e4732de44db0/LibGit2Sharp/Network.cs#L374"" rel=""nofollow noreferrer""><code>Repository.Network.Push()</code> on Github</a>.</p>
<pre><code>public virtual void Push(Remote remote, IEnumerable&lt;string&gt; pushRefSpecs, PushOptions pushOptions)
    {
        Ensure.ArgumentNotNull(remote, &quot;remote&quot;);
        Ensure.ArgumentNotNull(pushRefSpecs, &quot;pushRefSpecs&quot;);

        // Return early if there is nothing to push.
        if (!pushRefSpecs.Any())
        {
            return;
        }

        if (pushOptions == null)
        {
            pushOptions = new PushOptions();
        }

        // Load the remote.
        using (RemoteHandle remoteHandle = Proxy.git_remote_lookup(repository.Handle, remote.Name, true))
        {
            var callbacks = new RemoteCallbacks(pushOptions);
            GitRemoteCallbacks gitCallbacks = callbacks.GenerateCallbacks();

            Proxy.git_remote_push(remoteHandle,
                                  pushRefSpecs,
                                  new GitPushOptions()
                                  {
                                      PackbuilderDegreeOfParallelism = pushOptions.PackbuilderDegreeOfParallelism,
                                      RemoteCallbacks = gitCallbacks,
                                      ProxyOptions = new GitProxyOptions { Version = 1 },
                                  });
        }
    }
</code></pre>
<p>As we can see above, the <code>Proxy.git_remote_push</code> method call inside the <code>Push()</code> method is passing a new <code>GitPushOptions</code> object, which indeed <a href=""https://github.com/libgit2/libgit2sharp/blob/1e6da83ab8c47058b5b4ef1e4e28e4732de44db0/LibGit2Sharp/Core/GitPushOptions.cs#L12"" rel=""nofollow noreferrer"">seems to have a <code>CustomHeaders</code> field implemented.</a> But it is not exposed to a consumer application and is being instantiated in the library code directly!</p>
<p>It is an absolute necessity for me to use the LibGit2Sharp API, and our end-to-end testing needs to be done on Azure DevOps repositories, so this issue is blocking me from progressing further.</p>
<p>My questions are:</p>
<ol>
<li>Is it possible to use some other way to authenticate a push operation on Azure from LibGit2Sharp? Can we leverage the <code>PushOptions.CredentialsProvider</code> handler so that it is compatible with the auth-n method that Azure insists on?</li>
<li>Can we cache the credentials by calling <code>Commands.Fetch</code> by injecting the header in a <code>FetchOptions</code> object before carrying out the Push command? I tried it but it fails with the same error.</li>
<li>To address the issue, is there a modification required on the library to make it compatible with Azure Repos? If yes, then I can step up and contribute if someone could give me pointers on how the binding to the native code is made :)</li>
</ol>
",https://stackoverflow.com/questions/71126033/libgit2sharp-how-to-push-a-local-repo-commit-to-azure-devops-remote-repo-using,"['c#', '.net-5', 'libgit2', 'libgit2sharp']",727,True,3,2
cypress - use request for login,"<p>I am trying to test a demo app with cypress. If I use UI to login, it works.</p>
<p>But, looking at <a href=""https://docs.cypress.io/guides/end-to-end-testing/testing-your-app#Logging-in"" rel=""nofollow noreferrer"">https://docs.cypress.io/guides/end-to-end-testing/testing-your-app#Logging-in</a>, the following code does not work.</p>
<pre><code>describe('The Login By Request', () =&gt; {
    it('successfully logs in with request', () =&gt; {

       cy.request('POST', '/', {
        username: &quot;johnny@email.com&quot;,
        passwd: &quot;12345678&quot;
      })       

      cy.visit('/')
      // UI should reflect this user being logged in
      cy.get('h1').should('contain', 'Svelte To-Do List')

    })
  })
</code></pre>
<p>The result is it could not find the h1 element and the browser is left on the login page.</p>
<p>baseUrl is set to localhost:5000</p>
<p>What am I doing wrong?</p>
<p>Updated:</p>
<p>new code</p>
<pre><code>describe('The Login By Request', () =&gt; {
    it('successfully logs in with request', () =&gt; {

      cy.request('POST', '/', {
        username: &quot;johnny@email.com&quot;,
        passwd: &quot;12345678&quot;
      }).its('body').then((body) =&gt; {
        cy.visit(`/`)
        cy.log(body)
        cy.get('h1').should('contain', 'Svelte To-Do List')         
      });

  })
})
</code></pre>
<p>From the command log console</p>
<p>Console was cleared. cypress_runner.js:201262:32</p>
<p>Command:  request cypress_runner.js:201254:13</p>
<p>Request:</p>
<p>Object { &quot;Request Body&quot;: &quot;{&quot;username&quot;:&quot;johnny@email.com&quot;,&quot;passwd&quot;:&quot;12345678&quot;}&quot;, &quot;Request Headers&quot;: {…}, &quot;Request URL&quot;: &quot;http://localhost:5000/&quot;, &quot;Response Body&quot;: &quot;\r\n&lt;html lang=&quot;en&quot;&gt;\r\n\r\n\t\r\n\t\r\n\r\n\tSvelte To-Do List\r\n\r\n\t\r\n\t\r\n\t\r\n\r\n\t\r\n\r\n\r\n\r\n\r\n\r\n&quot;, &quot;Response Headers&quot;: {…}, &quot;Response Status&quot;: 200 }</p>
<p>cypress_runner.js:201254:13</p>
<p>Yielded:</p>
<p>Object { status: 200, duration: 75, body: &quot;\r\n&lt;html lang=&quot;en&quot;&gt;\r\n\r\n\t\r\n\t\r\n\r\n\tSvelte To-Do List\r\n\r\n\t\r\n\t\r\n\t\r\n\r\n\t\r\n\r\n\r\n\r\n\r\n\r\n&quot;, headers: {…} }</p>
<p>cypress_runner.js:201254:13</p>
<p>Console was cleared. cypress_runner.js:201262:32</p>
<p>Command:   its cypress_runner.js:201254:13</p>
<p>Property:  .body cypress_runner.js:201254:13</p>
<p>Subject:</p>
<p>Object { body: &quot;\r\n&lt;html lang=&quot;en&quot;&gt;\r\n\r\n\t\r\n\t\r\n\r\n\tSvelte To-Do List\r\n\r\n\t\r\n\t\r\n\t\r\n\r\n\t\r\n\r\n\r\n\r\n\r\n\r\n&quot;, headers: {…}, status: 200, statusText: &quot;OK&quot;, isOkStatusCode: true, requestHeaders: {…}, requestBody: &quot;{&quot;username&quot;:&quot;johnny@email.com&quot;,&quot;passwd&quot;:&quot;12345678&quot;}&quot;, duration: 6, allRequestResponses: (1) […] }</p>
<p>cypress_runner.js:201254:13</p>
<p>Yielded:</p>
<pre><code>&lt;!DOCTYPE html&gt;
&lt;html lang=&quot;en&quot;&gt;
&lt;head&gt;
    &lt;meta charset='utf-8'&gt;
    &lt;meta name='viewport' content='width=device-width,initial-scale=1'&gt;
    &lt;title&gt;Svelte To-Do List&lt;/title&gt;
    &lt;link rel='icon' type='image/png' href='/favicon.png'&gt;
    &lt;link rel='stylesheet' href='/global.css'&gt;
    &lt;link rel='stylesheet' href='/build/bundle.css'&gt;
    &lt;script defer src='/build/bundle.js'&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
<p>So though the request returns 200, I don't think that I have actually logged in - there is no token returned. Whereas manually using the browser does give a token. And using cypress to log in via the UI also gives a token. And using cypress to directly call the login api returns a token.</p>
<p>It just seems to the cypress request via html that does not work.</p>
",https://stackoverflow.com/questions/72935836/cypress-use-request-for-login,['cypress'],720,True,0,1
finding Element causing chrome driver instance to crash,"<p><strong>First the Environment</strong>:</p>
<ul>
<li><p>Node JS 16.15.0</p>
</li>
<li><p>Web Driver io v7 (wdio)</p>
</li>
<li><p>wdio/cucumber framework</p>
</li>
<li><p>end to end testing of a website</p>
<p>-obviously using cucumber and feature files</p>
</li>
<li><p>using a test configuration file similar to <a href=""https://webdriver.io/docs/configurationfile/"" rel=""nofollow noreferrer"">wdio's</a></p>
</li>
<li><p>using wdio-chromedriver-service v7.2.6 and npm chromedriver package version ^107 to produce a browser to hit</p>
<ul>
<li>my browser : chrome v107.0.5304.62</li>
</ul>
</li>
</ul>
<p><strong>The Question</strong>:</p>
<p>an element cannot be found by webDriver as I expect, but the command causes the instance to crash</p>
<p>I am searching for an element that no longer appears on the page (it is a spinner element that shows the page is loading)</p>
<p>I call</p>
<pre><code>if(await this.spinner.isDisplayed())
</code></pre>
<p>and then the test run hangs, the debugger tells me the command</p>
<p>INFO webdriver: COMMAND findElement(&quot;css selector&quot;, &quot;i.fa-spinner&quot;)</p>
<p>is running and then nothing else, finally the renderer times out</p>
<p>WARN chromedriver: [SEVERE]: Timed out receiving message from renderer: 600.000</p>
<p>DEBUG webdriver: request failed due to response error: timeout</p>
<p>and the chrome instance crashes shortly later</p>
<p>I am unsure why this behavior is happening, is something wrong with my wdio configuration? or with my chrome driver?</p>
<p><strong>What I have tried</strong></p>
<p>I understand that
<a href=""https://webdriver.io/docs/timeouts/#session-implicit-wait-timeout"" rel=""nofollow noreferrer"">browser.setTimeout</a> exists but
I am sure it is not set in my config anywhere.
I have done a global search (using vscode for all development) for browser.setTimeout (no results).
I have manually set browser.setTimeout({ 'implicit': 0 }) (no success).
I have also tried directly hitting a chrome driver instance by manually downloading a chrome driver exe that matched my browser version v107.0.5304.62 and removing the 'services: ['chromedriver']'
from my test config file</p>
<p>when this happens something very interesting occurs, I can keep running after searching for the element that broke the run before, but we dont get very far and the command still causes issues. Chrome driver is throwing errors like</p>
<p>error: 'no such element',
[0-0]   message: 'no such element: Unable to locate element: {&quot;method&quot;:&quot;css selector&quot;,&quot;selector&quot;:&quot;i.fa-spinner&quot;}\n' +
[0-0]     '  (Session info: chrome=107.0.5304.87)'</p>
<p>The browser closes shortly afterwards without progressing through the rest of the tests.</p>
<p>I find it interesting that the version that chrome driver says it is running is 107.0.5304.87 since the version of chromedriver I downloaded clearly says it is v107.0.5304.62 and my chrome version clearly states it is also v107.0.5304.62 .
though theoretically using v107.0.5304.87 shouldnt be an issue according to <a href=""https://sites.google.com/a/chromium.org/chromedriver/downloads/version-selection"" rel=""nofollow noreferrer"">this</a>
since the 107.0.5304 part matches across the board</p>
<p>I could use some assistance.</p>
",https://stackoverflow.com/questions/74265396/finding-element-causing-chrome-driver-instance-to-crash,"['google-chrome', 'selenium-chromedriver', 'webdriver', 'webdriver-io']",512,False,0,1
Automated Chromium-based tests with Authentication redirect from MSAL(Angular),"<p>I'm looking at doing a short proof of concept, validating 2 different UI end to end testing frameworks against each other using an internal project at work.</p>
<p>My project is an Angular based application, which has a login page, which is managed by MSAL for Angular(1) library.  The standard flow of a user is:</p>
<ol>
<li>Navigate website URL (/login)</li>
<li>Press Login Button</li>
<li>User is redirected to an Azure B2C Login Page</li>
<li>User inputs Username/Password clicks &quot;Login&quot;</li>
<li>Azure B2C redirects the user to the Login page, which has a subscription the broadcast channel for the event &quot;msal:loginSuccess&quot;</li>
<li>Once an event has been received the application makes a few API requests(now that the user is authenticated), and then redirects the user to the applications dashboard page (/dashboard)</li>
</ol>
<p>This application has been running for a few years now and we don't have any issues with authentication manually.  But as we started to look both at these testing frameworks as part of the POC, we started to notice an issue where by when the browser is redirected back to the login page(step 5), the broadcast event is either not being triggered, or captured(we still need to determine this). As a result the tests fail to continue, as the browser is waiting to be notified that the user is now authenticated - Theres no way to progress on from here.</p>
<p>If we use Firefox as our browser for Playwright(not tried Firefox in WebdriverIO yet), the tests run without issue, the user logs in, and is redirected successfully, it appears the issue is only happening with Chromium based browsers(we've tried Edge as well) from what we've seen so far.</p>
<p>I've googled but not found anything that might help, and getting fairly stuck in how we progress from here with the proof of concept as the request was to use Chrome not Firefox(larger user base for our application).  We could spin up a test version of the application with some debug statements to confirm the event is not triggered, but that might come out of our scope, and extend the window we have...</p>
<p>We've tried a few chrome arguments like headless and incognito(in WebdriverIO, I believe Chrome is already incognito in Playwright) - I think it has to be something like this since the tests run in Firefox, but not sure where to start with these, as there looks to be a lot of possible arguments: <a href=""https://peter.sh/experiments/chromium-command-line-switches/"" rel=""nofollow noreferrer"">https://peter.sh/experiments/chromium-command-line-switches/</a></p>
<p>Are there any recommendations, for this type of use case?</p>
",https://stackoverflow.com/questions/72035096/automated-chromium-based-tests-with-authentication-redirect-from-msalangular,"['selenium-chromedriver', 'chromium', 'azure-ad-msal', 'webdriver-io', 'playwright']",288,False,2,0
