WIP #216. QA mentioned that bugs remained, so we keep working on it.

This commit is contained in:
Cindy Chang
2024-06-11 13:55:00 +08:00
parent 314670eafd
commit 82fe104291
3 changed files with 39 additions and 17 deletions

View File

@@ -1,10 +1,14 @@
const urlUnderTest = `https://REDACTED-HOST/login?return-to=aHR0cHM6Ly9sdWNpYS1kZXYuZHNwLmltL2Rpc2NvdmVyL2NvbmZvcm1hbmNlL2xvZy8xODU1MjQ3OTcvY29uZm9ybWFuY2U=`;
describe('Conformance', ()=>{
const conformanceExampleUrl = "https://REDACTED-HOST/discover/conformance/log/185524797/conformance";
const urlUnderTestNotEncoded = `https://REDACTED-HOST/login?return-to=${conformanceExampleUrl}`;
const urlsUnderTest = [urlUnderTestNotEncoded,];
describe('Conformance url pastetd', ()=>{
urlsUnderTest.forEach((curUrl) => {
context(`Testing with URL: ${curUrl}`, () => {
beforeEach(() => {
cy.visit(urlUnderTest);
cy.visit(curUrl);
});
it('After pasting discover/conformance/log/ page, frontend should redirect to corresponding\
it('Positive case: After pasting discover/conformance/log/ page, frontend should redirect to corresponding\
page, not login page', () => {
cy.get('#account').clear().type(`${Cypress.env('user').username}`);
cy.get('#password').clear().type(`${Cypress.env('user').password}`);
@@ -12,6 +16,22 @@ describe('Conformance', ()=>{
cy.get('form').submit();
cy.contains('Conformance Checking Results').should('be.visible');
})
});
it('Negative case: User who is logged out cannout access inner pages', () => {
cy.get('#account').clear().type(`${Cypress.env('user').username}`);
cy.get('#password').clear().type(`${Cypress.env('user').password}`);
cy.get('.btn-lg').click();
cy.get('form').submit();
cy.get('#logout_btn').click();
cy.visit(curUrl);
cy.contains('Account').should('be.visible');
cy.contains('Password').should('be.visible');
cy.contains('Conformance Checking Results').should('not.exist');
});
});
});
});

1
gamunu.vscode-yarn Submodule

Submodule gamunu.vscode-yarn added at 6f18600396

View File

@@ -105,7 +105,8 @@ export default {
},
created() {
// 考慮到使用者可能在未登入的情況下貼入一個頁面網址連結過來瀏覽器
this.setRememberedReturnToUrl(this.$route.query['return-to']);
// btoa: 對字串進行 Base64 編碼
this.setRememberedReturnToUrl(btoa(this.$route.query['return-to']));
},
};
</script>