Skip to content

Commit

Permalink
added tests
Browse files Browse the repository at this point in the history
- ensure the user is redirected from `/` to `/thread/...` when starting a conversation
- ensure resuming a conversation keeps the user on the same url
  • Loading branch information
tpatel committed Apr 23, 2024
1 parent ad5172d commit 36a9e92
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions cypress/e2e/data_layer/spec.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ function login() {
}

function feedback() {
cy.location('pathname').should((loc) => {
expect(loc).to.eq('/');
});
submitMessage('Hello');
cy.location('pathname').should((loc) => {
// starts with /thread/
expect(loc).to.match(/^\/thread\//);
});
cy.get('.negative-feedback-off').should('have.length', 1);
cy.get('.positive-feedback-off').should('have.length', 1).click();
cy.get('#feedbackSubmit').click();
Expand Down Expand Up @@ -40,7 +47,14 @@ function resumeThread() {
cy.get('#thread-test2').click();
cy.get(`#chat-input`).should('not.exist');
cy.get('#resumeThread').click();
let initialUrl;
cy.url().then((url) => {
initialUrl = url;
});
cy.get(`#chat-input`).should('exist');
cy.url().then((newUrl) => {
expect(newUrl).to.equal(initialUrl);
});

cy.get('.step').should('have.length', 4);

Expand Down

0 comments on commit 36a9e92

Please sign in to comment.